Hi G Tek IGRS46D916, IGRS40916 Users Manual

Chapter 6
RS 485/232
Communication
Protocol
6
RS 485/232 Communication Protocol
Communication between the Local Site Controller LSC and the STAR READER is based on the master/slave approach. The LSC is the MASTER unit, the READERS are the SLAVE units. The LSC and the READERS communicate via a RS-485 multi drop or RS-232 connection. Each READER has its own address, enabling the LSC to approach each reader individually.
6.2. Physical Layer
6.2.1. Down-link
Down-link is the link from the LSC to the READERS. The link is RS-485 or RS-232 half duplex. Data rate can be one of the following: 2400, 4800, 9600, 19200, 38400 BPS. The default rate is set at 9600 BPS.
6.2.2. Up-link
Up-link is the link from the READERS to the LSC. The link is RS-485 or RS-232 half duplex. Data rate can be one of the following: 2400, 4800, 9600, 19200, 38400 BPS. The default rate is set at 9600 BPS.
6.3. Protocol Flow.
Communication is initiated by a command sent by the LSC to the READER. The READER executes the command and responds accordingly. In a long command session, the session is concluded when the LSC acknowledges the READER within T = 50 msec.
ACK
If the READERS are in sleep mode, the LSC must ensure they are awakened prior to the initialization of the session. In this case, the LSC should wait T = 50 msec before sending the main command.
w
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
116
6
RS 485/232 Communication Protocol
There are 2 types of commands: SHORT COMMANDS and LONG COMMANDS.
Short Commands: These are commands that are relevant to
internal tasks at the reader level. Long Commands: These commands involve sessions with seals.
The READER will respond to commands generated by the LSC within T seconds.
For short commands, response time should be: T = 50 msec.
RLSC
RLSC
For long commands, the LSC should return to retrieve the results after T with the appropriate GET RESULTS command.
T is a derivative of the type of command executed to the seals.
session
session
Acknowledge can be positive or negative. If the LSC detects a problem, Acknowledge will be negative.
The READERS are designed to work in cycles. Following an internal or external trigger, a READER SESSION is generated. This is a full communication cycle going back and forth between a READER and the tags located in the READER's receiving zone.
The LSC operates differently The READERs are scanned on a different time line, using the same frequency as that of the READER's cycles or greater.
This protocol supports RS-485 and RS-232 communication fashions. When working with the LSC using RS-232 communication opposite only one device, address fields should be set to 0xFFFF. When using RS-485 communication in broadcast situations, the address field should be set to 0x0000.
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
117
6
Short Commands Mode:
Long Commands Mode:
RS 485/232 Communication Protocol
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
118
6
STX #B R# CMND data CRC ETX
1 2 2 2 n 2 1
# of bytes
#B
RS 485/232 Communication Protocol
6.4. String Formats.
6.4.1. LSC to READERS messages.
Commands & Acknowledge strings:
CRC
Where:
STX This is the marker for the beginning of the messages. STX = 02 hex. #B String length, the string contains the R#,CMND, the DATA field, and the CRC. R# This session's READER address . CMND This session's command code . DATA The data field contains the data required to execute the command CRC This is the cyclic redundancy check for DATA and fields #B, R#, CMND. ETX This is the marker for the end of the messages. ETX = 03 hex.
6.4.1.1. CRC Calculation.
CRC calculations are based on the following CCITT polynomial:
The result is 2 bytes.
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
X + X + X + 1
16 12 5
119
6
6.4.1.2. CMND Field Structure.
The command field is divided into several sections:
Where:
DIR Denotes string direction. In case of a command from the LSC to the reader, it is equal to 0. PK Denotes whether the command transmitted is composed of packets or not. PK = 0 is for non-packet commands. PK = 1 is for packet commands. ERR this flag indicates an error. ERR = 0 no error. ERR = 1 Error. The first byte in the data field is the error code. CT Is the scenario command type. It describes the
CC
RS 485/232 Communication Protocol
command type, and whether it is in short or long form
00000 designates SHORT commands that stream from the LCR to the Reader for MCU purposes. 00011 is for LONG commands. This is the command code .
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
120
6
6.4.2. Reader to LSC Message
Response & Acknowledge strings:
RS 485/232 Communication Protocol
STX
#B
R#
MSGT
MC R_status
DATA CRC
ETX
This is the marker for the beginning of the messages. STX=02 hex. String length, the string contains the R#, MSGT, MC, R_status, the DATA field and the CRC. This is the address of the READER for the current session. This is the message type response for the current session. The MSGT corresponds to a specific command (see paragraph 6.4.2.1) This is the message code (see paragraph 5.2) This is the status field of the reader. The field contains bytes A&B (see paragraph 6.4.2.2)
The data field contains the relevant response data. This is the cyclic redundancy check for fields #B, MSGT, R_status and DATA. This is the marker for the end of the messages. ETX=03 hex.
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
121
6
6.4.2.1. MSGT Field Structure.
The Message Type field is divided into several sections:
Where:
RS 485/232 Communication Protocol
DIR PK
ERR
MT
MC
Is the string direction.Response will be 1. Denotes whether the transmitted message is
composed of packets. A response of 1 indicates that the message is composed of packets. If the response is 0, the message was transmitted without packets. (If PK=0 there must be 1 reserved data byte).
This flag indicates an error. ERR = 0 no error. ERR = 1 Error. The first byte in the data field stores the error code.
This code reflects the nature of the response. A regular response to a command has the same value as the CC (See paragraph 6.4.1.2).
This field holds the same value as the Command Code of the related commands. This field makes it possible to link the response to the appropriate command.
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
122
6
Byte A Byte B Byte C Byte D
7 6 5 4 3 2 1 0
LCK 485 PCR PER VCCERR VBERR PMC EDC
RS 485/232 Communication Protocol
6.4.2.2. R_Status Field Structure
The READER's STATUS field is 4 bytes.
Byte A represents the status of the main motherboard MCU. The other bytes represent the RF modems' status. In a general Reader response the R-Status reply contains bytes A&B only. In a GET Status command, the reply contains all the R-Status bytes.
Byte A:
Where: LCK
If the response shows 0, the READER's parameters are locked. If the response is 1, the READER's parameters are unlocked. If the response is 0, the READER is using RS-232 mode for communication.
485
If the response shows 1, the READER is using RS-485 mode for communication.
PCR
If the response shows 0, the parameters in the MCU's
2
E ROM are OK. If the reponse is 1, parameters were corrupted and successfully restored.
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
123
6
7 6 5 4 3 2 1 0
Ch1 Ch2 Ch3 Ch4 Ch1err Ch2err Ch3err Ch4err
RS 485/232 Communication Protocol
PER
VCCERR
VBERR
PMC
EDC
Byte B:
Where:
If the response is 0, the parameters in the MCU's E ROM are OK.
2
If the answer is 1, parameters are corrupted.
If response is 0, internal power is OK. If response is 1, internal power is faulty.
If response shows 0, internal battery is OK. If response is1, internal battery is faulty.
If response is 0, program memory in the MCU is OK. If response is 1, program memory is corrupted.
This flag indicates that a delayed command was triggered and is in process.
Ch1
if 0 channel1 is not in use. If 1 channel1 is in use.
Ch2
Iif 0 channel2 is not in use. If 1 channel2 is in use.
Ch3
If 0 channel3 is not in use. If 1 channel3 is in use.
Ch4
If 0 channel4 is not in use. If 1 channel4 is in use.
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
124
6
RS 485/232 Communication Protocol
Ch1err
Ch2err
Ch3err
Ch4err
Bytes C&D:
If 0, channel is OK If 1, channel is defective, details are in byte C. If byte C flags are OK, there is a communication failure with this channel.I If 0, channe2 is OK. If 1, channe2 is defective, details are in byte C. If byte C flags are OK, there is a communication failure with this channel. If 0, channe3 is OK. If 1, channe3 is defective, details are in byte D. If byte D flags are OK, there is a communication failure with this channel. If 0, channe4 is OK. If 1, channe4 is defective, details are in byte D. If byte D flags are OK, there is a communication failure with this channel.
VCCERR
If 0, power is OK. If 1, power is not faulty
PMC
EMC
EME
If 0, program memory in the module is OK. If 1, program memory is corrupted. If 0, E ROM is OK. If 1, E ROM was corrupted and then restored. If 0, E ROM is OK. If 1, E ROM was corrupted.
2
2
2
2
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
125
6
6.4.2.3. Reader Messages Packed Data Format
Where:
RS 485/232 Communication Protocol
PK
P# Ch
Maximum total message length is 128 bytes. Maximum Data* length is 115 bytes.
6.4.2.3.1. Packed Data from the LSC. When the packets originate with the LSC, each packet will be
transmitted after an appropriate response from the READER. The LSC may retransmit the last packet upon receipt of a response indicating that the last packet was not received satisfactorily.
6.4.2.3.2. Packed Data from the READER.
When the packets originate with the READER, each packet will be transmitted after an appropriate acknowledgement from the LSC. The READER may retransmit the last packet upon receipt of an acknowledgment indicating that the packet was not received satisfactorily
The first byte is the total number of packets in the string. The second byte is the packet serial number. The third byte is the channel number from which the message is received.
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
126
6
# Commands
Set
Command Code
Comments
1
Wakeup E0 h This command wakens REA DERS it hat were in sl eep
mode.
2
Execute RF cmnd
20 h This comm and generates an appropriat e command from
the READE R to the tags .
3
Get Results 15 h In a tag-reader sess ion, thi s com mand allows t he LSC to
retrieve the results received by the REA DER from the tags. .
4
Get Status 16 h In case of a sel f-contained c ommand, t he READER will
return to it s current s tatus .
5
Get Burs t Mess age
1C h This comm and should be us ed to retrieve the alert
mess ages retrieved from the seal s when using t he alert burst mode. These are not available through the regular Get Results .
6
Reset Reader
14 h This comm and resets theREADER.
7
Write Parameters
06 h This comm and modifies the PARAM ETERS of a READER.
After is suing a LOCK c ommand, not all the paramet ers are accessible.
8
Read Parameters
07 h This comm and is to read the PARAM ETERS of a READE R.
9
BIT 09 h Exec utes a built in t est
10
Sleep 08 h This comm and puts t he READER int o the sleep mode of
operation to enabl e power conservation.
11
Unsync Ack 0A h Reserved for the unsynchroniz ed response, see table 5. 2
12
Get Reader’s baud rate
FF h This comm and allows t he LSC to obtain t he reader’s baud
rate.
13
Set Reader baud rate
FE h This comm and allows t he LSC to s et the REA DER’s baud
rate.
14
Set Reader’s Address
12 h This comm and sets the READE R’s address for RS-485
usage
15
Ack nowledge OK
92 h This is an ac knowledgement of a mes sage com ing from a
READER.
16
Ack nowledge Failed
94 h This is an ac knowledgement of an improper mess age
coming from a RE ADER.
17
Save Command
0F h This comm and saves one of the above commands for lat er
execut ion. It is used to synchroniz e readers.
18
Exec ute Saved command
17 h This comm and executes the c ommand saved in the
READER. When is used in a broadcas t fashion, all the READERS execut e the command sim ultaneousl y.
19
Read Channel Definitions
11 h This comm and allows the reading of channel definitions ..
20
Write Channel Definitions
10 h This comm and allows the writing of channel defini tions.
RS 485/232 Communication Protocol
6.5. LSC and Reader Messages.
6.5.1. LSC Commands and Acknowledge Table:
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
127
6
#
Message Message
Code
Commen ts
1
Wak eup response
- No response for W AKE UP st ring
2
Exec ute RF cmnd res ponse
20 h
3
Get Results response
15 h
4
Get Status response
16 h
5
Get Burs t Mess age response
1C h
6
Reset Reader response
14 h
7
Write Parameters response
06 h
8
Read Parameters response
07 h
9
BIT response 09 h
10
Sleep response 08 h
11
Unsynch Mess age
0A h When a REA DER is i n unsync h mode, the RE ADER
may s end an unsync h mess age. This oc curs after receiving an alert mes sage from a seal .
12
Get Reader’s baud rate response
FF h
13
Set Reader baud rate response
FE h
14
Set Reader’s Address response
12 h
15
Save Command response
0F h This comm and saves one of the above commands for
later exec ution. It is us ed to sy nchroniz e readers.
16
Exec ute Saved command response
_ This is a broadc ast c ommand. There is noresponse t o
this command.
17
Read Channel Definitions response
11 h This command allows t he reading of channel
definitions .
18
Writ e Channel Definitions response
10 h This command allows t he writing of channel definitions ..
RS 485/232 Communication Protocol
6.5.2. Message Table:
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
128
6
# Parameter
Name
Parameter Code
Parameter Syntax
Read/Write Access *
Default value [unit]
Unit Parameter
length
1
Version of MCU_firmwar e
01 h MVER R 2 Byte
2
Version of S1_firmware
80 h SVER1 R 2 Byte
3
Version of S2_firmware
40 h SVER2 R 2 Byte
4
RSSI ch1 87 h RSSI1 R 1 Byte
5
RSSI ch2 47 h RSSI2 R 1 Byte
6
Reader ID 02 h RID R / 1 00000000 4 Byte
7
ADI ch1 81 h ADI1 R/W 00000000 4 Byte
8
ADI ch2 41 h ADI2 R/W 00000000 4 Byte
9
OrgID* 04 h OrgID R / 2 0000 2 Byte
10
Department ch1
82 h DEP1 R/W 1 Byte
11
Department ch2
42 h DEP2 R/W 1 Byte
12
Thw ch1 85 h Thw1 R/W 997 3.072ms 2 Byte
13
Thw ch2 45 h Thw2 R/W 997 3.072ms 2 Byte
14
Reader Address
03 h RADD R/W 0000 2 Byte
15
Transmitter Power ch1
88 h TRPOR1 R/W 65 1 Byte
16
Transmitter Power ch2
48 h TRPOR2 R/W 65 1 Byte
17
System ch1 83 h SYS1 R/W ** 1 Byte
18
System ch2 43 h SYS2 R/W ** 1 Byte
19
Mode ch1 84 h MODE1 R/W 00 1 Byte
20
Mode ch2 44 h MODE2 R/W 00 1 Byte
21
Hard wakeup ch1
86 h T
HP1
R/W 3256 3.072ms 2 Byte
22
Hard wakeup ch2
46 h T
HP1
R/W 3256 3.072ms 2 Byte
RS 485/232 Communication Protocol
6.5.3. Parameters Table:
The following table relates to the Read and Write Parameters Commands:
* /1 or /2 defines the LOCK level.
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
129
6
Parameters Format:
6.5.3.1. Reader Master Firmware Version MVER,
MVER is the version of the master firmware. This is a read only parameter.
Bits assignment:
6.5.3.2. Reader Slave1 Firmware Version SVER1.
SVER1 is the version of the first slave's firmware. This is a read only parameter.
Bits assignment:
RS 485/232 Communication Protocol
6.5.3.3. Reader Slave1 Firmware Version SVER2,
SVER2 is the version of the second slave's firmware. This is a read only parameter.
Bits assignment:
Hi-G-Tek Ltd. Microelectronics & Asset Tracking Technology
130
Loading...
+ 36 hidden pages