Communication protocol, Command to reader, Response from reader – ACS ACR38 SAM Smart Card Reader User Manual
Page 10
![background image](/manuals/248161/10/background.png)
ACR38x – Reference Manual
Version 6.02
www.acs.com.hk
Page 10 of 40
7.0. Communication Protocol
During normal operation, the ACR38x acts as a slave device with regard to the communication
between a computer and the reader. The communication is carried out in the form of success
command-response exchanges. The computer transmits a command to the reader and receives a
response from the reader after the command has been executed. A new command can be transmitted
to the ACR38x only after the response to the previous command has been received.
There are two cases where the reader transmits data without having received a command from the
computer, namely the Reset Message and the Card Status Message.
7.1. Command to Reader
A command consists of six protocol bytes and a variable number of data bytes with the following
structure:
Byte
1
2
3
4
5 ... N+4 (N>0)
Header Instruction Data Length = N
Data
01h
Data Length N
Where:
Header
Always 01h to indicate the start of a command.
Instruction
The instruction code of the command to be carried out by the ACR38x.
Data Length
Number of subsequent data bytes, and is encoded in 2 bytes. The first
byte (MSB) and second byte (LSB) represent data length N.
Data
Data contents of the command.
For a READ command, for example, the data bytes would specify the
start address and the number of bytes to be read.
For a WRITE command, the data bytes would specify the start address
and the data to be written to the card.
The data bytes can represent values to be written to a card and/or
command parameters such as an address, a counter, etc.
Note: Commands are sent from host computer to ACR38x through the BULK OUT endpoint.
7.2. Response from Reader
The response from the ACR38x to any command depends on whether the command has been
received by the ACR38x without error (e.g. checksum error).
The response from the ACR38x to a correctly received command consists of three protocol bytes, two
status bytes and a variable number of data bytes with the following structure:
Byte
1
2
3
4
5 ... N+4 (N>0)
Header Status Data Length = N
Data
01h
Data Length N
Where:
Header
Always 01h to indicate the start of the response.
Status
Indicates the command execution status: