The text of a manual · part 12 of 25
AI1620 SmartPass System Guide, pages 111 to 120
Pages 111 to 120 of 246
The original document is the PDF (4.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Intermec AI1620 and Intermec SmartPass Reader AI1620
Page 111
Communication Protocols
6
Bad CRC If the host detects a bad CRC in a reader message, it retransmits the command with the same sequence number. If the host detects a bad CRC in an asynchronous reader transmission, it transmits a NAK message.
Transmission Timeout If SmartPass does not respond to a host command within a specified interval, the host retransmits the command with the same sequence number.
Receive Timeout If the host receives a <som> but does not receive a matching <eom> within a specified timeout interval, it discards the incomplete message and resets its receiver.
Asynchronous Message/Command Message Collision If the host receives an asynchronous reader transmission at the same time it transmits a command, it ignores the asynchronous message and waits for SmartPass’s response. SmartPass retransmits asynchronous data after it transmits the command message.
ECP Reliability An undetected error is defined as a message having incorrect data or status, but no parity or CRC errors. An error transaction is defined as a message having either a parity or CRC error. Laboratory testing indicates an undetected error rate of less than one undetected error per 1,000,000 error transactions with parity enabled. To ensure this error rate is not exceeded, the host must enable parity and adhere closely to the timing specifications discussed previously in this chapter in the “Timing and Synchronization” section.
CRC Calculation The CRC used by the ECP is based on a 16-bit algorithm. The algorithm, as implemented, operates on 8-bit characters; for example, 7-bit ASCII character plus 1optional parity bit. The 16-bit result is converted to 4 ASCII hex characters and is appended to messages transmitted by SmartPass. SmartPass accepts 4 ASCII < ` > characters (60 hex) as a wild card CRC in lieu of a valid 4-character CRC to facilitate testing and diagnostic checkout. SmartPass implements the algorithm with a 512-byte lookup table to reduce the processing overhead requirements. To simplify the implementation of the CRC algorithm by host software developers, several examples of the calculation are provided in C source code in Table 7-1 through Table 7-4. The calculation may be performed with or without a lookup table, depending on the trade-off between code memory and processing overhead.
6-13
Page 112
AI1620 SmartPass System Guide
Table 6-1 presents an example of a function (CALCCRC) that calculates the CRC through a call to a separate function (UPDCRC). Table 6-2 shows an example of UPDCRC that does not require a lookup table. Table 6-3 contains an example of UPDCRC that does require a lookup table. Table 6-4 shows an example of a function that creates the lookup table. Table 6-1 Example of Routine to Calculate CRC unsigned short calccrc(char *message) { unsigned short crc = 0; for ( ; *message != (char)0;message++) crc = updcrc(*message & 0xff, crc); return (crc) }
Table 6-2 Example of Routine to Calculate CRC-CCITT without Lookup Table
#define BITS_PER_CHAR 8 unsigned short updcrc (unsigned short ch, unsigned short crc) { register short counter = BITS_PER_CHAR; register short temp = crc; while (--counter >= 0) if (temp & 0x8000) { temp <<= 1; temp += (((ch <<= 1) & 0x0100) != 0); temp ^= 0x1021; } else { temp <<= 1; temp += (((ch <<= 1) & 0x0100) != 0); } return(temp); }
6-14
Page 113
Communication Protocols
6
Table 6-3 Example of Routine to Calculate CCITT-CRC with Lookup Table #define updcrc(cp, crc)( crctab[((crc >> 8) & 255)]^ (crc << 8) ^ cp static unsigned short crctab [256] = { 0x0000, 0x8108, 0x1231, 0x9339, 0x2462, 0xa56a, 0x3653, 0xb75b, 0x48c4, 0xc9cc, 0x5af5, 0xdbfd, 0x6ca6, 0xedae, 0x7e97, 0xff9f, 0x9188, 0x1080, 0x83b9, 0x02b1, 0xb5ea, 0x34e2, 0xa7db, 0x26d3, 0xd94c, 0x5844, 0xcb7d, 0x4a75, 0xfd2e, 0x7c26, 0xef1f, 0x6e17, };
0x1021, 0x9129, 0x0210, 0x8318, 0x3443, 0xb54b, 0x2672, 0xa77a, 0x58e5, 0xd9ed, 0x4ad4, 0xcbdc, 0x7c87, 0xfd8f, 0x6eb6, 0xefbe, 0x81a9, 0x00a1, 0x9398, 0x1290, 0xa5cb, 0x24c3, 0xb7fa, 0x36f2, 0xc96d, 0x4865, 0xdb5c, 0x5a54, 0xed0f, 0x6c07, 0xff3e, 0x7e36,
0x2042, 0xa14a, 0x3273, 0xb37b, 0x0420, 0x8528, 0x1611, 0x9719, 0x6886, 0xe98e, 0x7ab7, 0xfbbf, 0x4ce4, 0xcdec, 0x5ed5, 0xdfdd, 0xb1ca, 0x30c2, 0xa3fb, 0x22f3, 0x95a8, 0x14a0, 0x8799, 0x0691, 0xf90e, 0x7806, 0xeb3f, 0x6a37, 0xdd6c, 0x5c64, 0xcf5d, 0x4e55,
0x3063, 0xb16b, 0x2252, 0xa35a, 0x1401, 0x9509, 0x0630, 0x8738, 0x78a7, 0xf9af, 0x6a96, 0xeb9e, 0x5cc5, 0xddcd, 0x4ef4, 0xcffc, 0xa1eb, 0x20e3, 0xb3da, 0x32d2, 0x8589, 0x0481, 0x97b8, 0x16b0, 0xe92f, 0x6827, 0xfb1e, 0x7a16, 0xcd4d, 0x4c45, 0xdf7c, 0x5e74,
0x4048, 0xc18c, 0x52b5, 0xd3bd, 0x64e6, 0xe5ee, 0x76d7, 0xf7df, 0x0840, 0x8948, 0x1a71, 0x9b79, 0x2c22, 0xad2a, 0x3e13, 0xbf1b, 0xd10c, 0x5004, 0xc33d, 0x4235, 0xf56e, 0x7466, 0xe75f, 0x6657, 0x99c8, 0x18c0, 0x8bf9, 0x0af1, 0xbdaa, 0x3ca2, 0xaf9b, 0x2e93,
0x50a5, 0xd1ad, 0x4294, 0xc39c, 0x74c7, 0xf5cf, 0x66f6, 0xe7fe, 0x1861, 0x9969, 0x0a50, 0x8b58, 0x3c03, 0xbd0b, 0x2e32, 0xaf3a, 0xc12d, 0x4025, 0xd31c, 0x5214, 0xe54f, 0x6447, 0xf77e, 0x7676, 0x89e9, 0x08e1, 0x9bd8, 0x1ad0, 0xad8b, 0x2c83, 0xbfba, 0x3eb2,
0x60c6, 0xe1ce, 0x72f7, 0xf3ff, 0x44a4, 0xc5ac, 0x5695, 0xd79d, 0x2802, 0xa90a, 0x3a33, 0xbb3b, 0x0c60, 0x8d68, 0x1e51, 0x9f59, 0xf14e, 0x7046, 0xe37f, 0x6277, 0xd52c, 0x5424, 0xc71d, 0x4615, 0xb98a, 0x3882, 0xabbb, 0x2ab3, 0x9de8, 0x1ce0, 0x8fd9, 0x0ed1,
0x70e7, 0xf1ef, 0x62d6, 0xe3de, 0x5485, 0xd58d, 0x46b4, 0xc7bc, 0x3823, 0xb92b, 0x2a12, 0xab1a, 0x1c41, 0x9d49, 0x0e70, 0x8f78, 0xe16f, 0x6067, 0xf35e, 0x7256, 0xc50d, 0x4405, 0xd73c, 0x5634, 0xa9ab, 0x28a3, 0xbb9a, 0x3a92, 0x8dc9, 0x0cc1, 0x9ff8, 0x1ef0,
6-15
Page 114
AI1620 SmartPass System Guide
Table 6-4 Example of Routine to Create Lookup Table
#include <stdio.h> #define MAX_CHAR 256 #define BITS_CHAR 8 #define SIGN_BIT 0x8000 #define POLY 0x1021 unsigned short crctab [MAX_CHAR]; main () { unsigned short ch; unsigned short workval; unsigned short bit; unsigned short carry; for (ch = 0; ch != MAX_CHAR; ch++) { workval = ch << BITS_CHAR; for (bit = BITS_CHAR; bit != 0; bit--) { carry = (workval & SIGN_BIT); workval <<= 1; if (carry) workval ^= POLY; } crctab[ch] = workval; } for (ch = 0; ch != MAX_CHAR; ch++) printf("0x%04x\n", crctab[ch]); }
6-16
Page 115
7 Commands
Page 116
Page 117
Commands
7
This chapter discusses the host-transmitted commands that are used to control SmartPass configuration and operation.
Introduction SmartPass is delivered from the factory with specified default settings that determine how SmartPass operates. These settings can be changed and additional features can be controlled by commands transmitted by the host. The commands can be transmitted with specialized host software or by manually entering the commands at the host keyboard if the host is in terminal emulation mode. SmartPass can also communicate with ASCII terminals and printers. Note: If you are using Wiegand mode, you must connect the PC, laptop, or terminal emulator to SmartPass using the RS-232 or RS-422 interface before attempting to send commands to the reader. You can leave the Wiegand interface connected during this procedure.
Operating Modes SmartPass has three modes of operation: data mode, command mode, and download mode. The software for SmartPass contains two separate programs, one in boot ROM and one in flash EPROM. The boot ROM program has control of SmartPass on startup and when operating in download mode. The flash EPROM program has control of SmartPass during data mode and command mode operation and holds the application code. Together, they control SmartPass in the three modes of operation.
Data Mode SmartPass is in the data mode upon power-up. While in the data mode, SmartPass sends all communications as data messages, such as tag IDs and reports, to the host computer. Reports provide information on input status changes (input0 and input1), a presence without tag report, and buffer overflow information. The host computer can send only three commands to SmartPass while in data mode:
•
Command 01, switch to command mode, changes SmartPass from the data mode to the command mode. See “01 Switch to Command Mode” on page 7-5.
•
Command 05, switch to download mode, allows the host computer to download new software into SmartPass. See “05 Switch to Download Mode” on page 7-6.
•
Command 8110, perform system check tag test, performs a single system check tag test. See “8110 Perform System Check Tag Test” on page 7-41.
Note: SmartPass transmits tag identification (ID) codes to the host computer when SmartPass is in data mode. If SmartPass is left in the command mode too long, the tag
7-3
Page 118
AI1620 SmartPass System Guide buffer will fill up and any additional tag IDs will be lost. You must return SmartPass to data mode as soon as possible to ensure proper transmission of acquired tag IDs. For information on the data mode, refer to the “Data Mode” on page 7-3. For information on the tag buffer and buffer control, refer to “6160 Disable Buffer Control Mode (Factory Default)” on page 7-27 and “6161 Enable Buffer Control Mode” on page 7-28.
Command Mode While in the command mode, the host computer sends commands to SmartPass. Host-transmitted commands can be used to control the operation and configuration of the reader. After SmartPass receives a command, it transmits a command response message. Typically, the command message contains Error, Done, or data relating specifically to the command request. These messages may be of variable length since some commands require information as part of the message; for example, time and date. The host computer sets a timeout delay when the command is transmitted to SmartPass. If the timeout delay expires before the host receives a command message from SmartPass, a logical NAK condition is declared. The host then retransmits the command request message. Communications can be lost if the host computer attempts to send certain commands under marginal communication conditions. For example, if the host computer transmits the command request to change the baud rate and SmartPass properly receives the request and transmits the Done message, one of the two conditions described below may occur. If the host computer receives the Done message, then both the host and SmartPass switch to the new baud rate, and communication is maintained. Note: SmartPass changes the baud rate immediately after issuing the Done message. However, if the Done message transmitted by SmartPass is not received by the host, the host would assume that the command was not properly sent and would not switch to the new baud rate.
Caution Because this condition would lead to a loss of communications, the host should not attempt to change communications parameters or protocols during marginal communications conditions.
7-4
Page 119
Commands
7
Download Mode In download mode, SmartPass allows the host to download new software and supports a limited set of commands, #90, #91, #96, #97, and #99. SmartPass does not process tags while in download mode. See “90 Load Program Block” on page 7-42 through “99 Exit Download Mode” on page 7-43.
Command List Reader commands are divided into eight groups based on primary function. The following sections provide information about each command in command number order. Refer to Appendix D for a listing of commands in alphabetical order. Note: In the following text, the symbols < and > represent required variable message data. These symbols are not part of the message syntax.
Reader Mode Control, Command Group 0 Group 0 commands control reader mode. The mode determines whether the reader is transmitting data to or receiving data from a host computer or terminal.
00 Switch to Data Mode (Factory Default) Command 00 switches the reader to data mode, which allows the reader to transmit tag data (ID codes) to the host. The reader enters data mode on power up. While operating in data mode, the reader accepts the following commands:
•
Switch to command mode (01)
•
Switch to download mode (05)
•
Invoke check tag (8110)
Reader message: Done
01 Switch to Command Mode Command 01 switches the reader to command mode, which allows the reader to accept commands from a host or terminal. While in command mode, the reader does not transmit tag IDs to the host as they are acquired. The IDs are stored in the reader’s tag buffer for transmission when requested by the host. While operating in command mode, the reader continuously monitors the level of its tag buffer. If the buffer becomes 75% full, the reader transmits an Error 04 message to the host. If the buffer becomes 100% full, it transmits an Error 02 message. When the buffer is full, incoming tag IDs cannot be buffered, and they are lost. The reader does not resume asynchronous tag transmission until it is returned to data mode (command 00). Upon return to data mode, the reader begins to empty the tag buffer. When the
7-5
Page 120
AI1620 SmartPass System Guide buffer is no longer full, the reader transmits the Error 03 message indicating that the tag buffer has been partially cleared, and new IDs are again being stored. When the buffer has emptied to 50%, the reader transmits the Error 05 message. Reader message: Done
05 Switch to Download Mode Command 05 switches the reader to download mode, which allows an external host computer to download new software into the reader flash memory. While operating in download mode, the reader accepts a limited set of commands: load program block (90), verify flash checksum (91), erase flash memory (96), perform destructive memory test (97), and exit download mode (99). Note: While in download mode, the reader communication port parameters are fixed at the following factory default settings: 9600 baud, 8 data bits, 1 stop bit, no parity, software flow control (XON/XOFF), basic protocol. While in download mode, the reader does not echo host commands. To exit the download mode, the host must transmit exit download mode command 99. The reader re-executes startup to ensure proper initialization of operating parameters and to verify the boot ROM and flash memory checksum values. The reader does not accept the switch to download mode command 05 if it is operating in data mode; it must first be switched to command mode (command 01). Reader message: Done or Error
06 Transmit Buffer Entry Command 06 allows the host to request data (tag IDs and reports) from the reader. This command is supported if ECP is selected (command 611) and buffer control has been enabled (command 6161). If the reader receives command 06 and it has data in its message buffer, it transmits the buffered message of highest priority. Report data is not transmitted until all tag IDs have been transmitted. If the reader’s message buffer is empty, it sends the Done message. The reader returns an Error message if it receives this command when ECP and/or the buffer control have not been enabled. Reader message:
7-6
Done
Buffer empty
Error
Buffer control mode not enabled
Message
IDs or reports in buffer