Skip to content

ODRFID-485 (AT Firmware)

The device accepts commands and sends a reply via RS485 interface

An AT command set recognized by the device follows the CDC device firmware as close as possible.

Port settings

Factory defaults are 115200 baudrate, 8N1 (8 bits, 1 stop bit, no parity), device address 0x5F (95). These settings can be changed via the AT+[ command described below. The new settings (both the current RFID-related settings and the new connection-related settings) are immediately saved in the non-volatile memory and applied after the device reset.

General Frame Format

The frame can be divided into two levels (close to L2 and L3 in the OSI model)

L2 (UART-RS485)

The L2 frames format describes how the UART-RS485 data stream is split into frames and how the frames are delivered to the device they are addressed to. This format is common to both the request and the reply frames.

  • The frame starts with a SOF (start of frame) marker 0x7E (dec 126, ascii '~')
  • The next byte is the frame payload length (0..254). Note that the payload maximal length is 254, not 255.
  • The next byte is the address of the target device (0..254). Note that the 255 address is NOT valid, there must not be a device with such an address.
  • The next 0 to 254 bytes are the payload (i.e. the L3 frame)
  • The last byte of the frame is the CRC8 (sum with overflow) of the whole frame (excluding the checksum byte itself).

Note that the total length of a frame is 4+payload length, the CRC8 is calculated over the whole frame, not just the payload. A frame wihout any payload (payload length == 0) is a valid frame.

Example:

B0 B1 B2 B3 B4 B5 B6 B7
0x7E 4 0x5F A T I \r 0xCC

L3 (Commands and data)

The L3 frames follow the ODRFID (CDC) protocol as close as possible:

  • Host-to-Device data must start with an AT keyword and can end with a carriage-return character (ASCII code 13 decimal, 0x0d hexadecimal, "\r" as C string literal) Note: unlike the CDC protocol, the carriage-return character is optional.
  • Device-to-Host frames start and end with a carriage-return character followed by a line-feed character (ASCII codes 13,10 decimal, 0x0d,0x0a hexadecimal, "\r\n" as C string literal).
  • Device-to-Host response to a Host-to-Device request consists of one or more frames, the last one being \r\nOK\r\n or \r\nERROR\r\n, depending on whether the request/command has been completed successfully or failed.
  • Do not add any unnecessary white space characters (space, back-space, tab, line-feed, etc.) to the request data, they will not be removed by the command-line parser leading to the "ERROR" response.

For a complete description of the L3 commands, refer to the CDC documentation. The differences are listed below.

Second LED Control

In addition to the first (green) LED, controlled by the AT+D1... command, this device has the second (red) LED and therefore supports the AT+D2 command.

Syntax:

Request AT+D2=[0|1] Switch the LED
0=off, 1=on
Response OK

Output Pin Control

(extra command, compared to the CDC variant) This command controls the state of the output pin OUT2 (open collector, no pull)

Syntax:

Request AT+Y=[0|1] Set the OUT2 state to
0=off (open circuit), 1=on (connected to ground)
Response OK

Example

Request AT+Y=1\r OUT2 state is connected to ground
Response OK
Request AT+Y=0\r OUT2 state is open circuit
Response OK
Request AT+Y?\r Query the OUT2 state
Response +Y=0
OK
OUT2 state is open circuit

Input Pin

(extra command, compared to the CDC variant) This command reports the state of the input pin (if present)

Syntax:

Request AT+y? Request the IN state
Response +y=0 or +y=1 0 - pulled low, 1 - pulled high
OK

UART/RS485 Control

This command queries and sets the UART-related settings (baudrate, bits, parity etc.). The returned values are the ones, saved in the non-volatile memory. They can differ from the actual ones in case they have been altered without a following reboot. The new settings are saved in the non-volatile memory immediately and applied at the next reboot.

Syntax:

Request AT+[=<a>,<s>,<p>,<b>,<r>,<t>\r write new settings
Response OK

The values passed in the request and returned in the reply:

  • <a> - address (0..254), decimal (ATTENTION: hex is not accepted, 95 will be interpreted as 0x5F, not as 0x95)
  • <s> - stop bits
    • 10 - 1 stop bit
    • 15 - 1.5 stop bits
    • 20 - 2 stop bits
  • <p> - parity
    • 0 - none
    • 1 - odd (implemented since v 2.0)
    • 2 - even (implemented since v 2.0)
  • <b> - data bits (only 8 bits mode is supported, any other value will be accepted, but ignored)
  • <r> - baud rate
  • <t> - inter-char timeout

Example:

Request AT+[?\r
Response +[=95,10,0,8,115200,10
OK
115200 8N1, address 0x5F, timeout 10ms