ST25RU3993 超高频UHF RFID读写模组通讯协议
ST25RU3993 Protocol description
The following description gives an overview of the ams stream protocol and how the data of stream packets is forwarded to the commands() function. The protocol can be executed over USB or UART. Only the header bytes between USB and UART are different.
For a detailed description of the ams stream protocol have a look in ams_stream.h
Protocol for USB:
A simple USB stream packet (not splitted, only 1 protocol in packet) is shown in the following table, which maps the transmitted data to the function parameters of commands().
Byte | 0 | 1 | 2 | 3 | 4..5 | 6..7 | 8..8+txprot-1 |
---|---|---|---|---|---|---|---|
Content | TID | payload | reserved | protocol | txprot | rxprot | data |
Parameter | protocol | rxSize | txSize | rxData[0..rxSize-1] |
where
TID : transaction ID.
payload: amount of data in report.
protocol: defines which action should be triggered. If commands() is is called it refers to a firmware application command (no generic stream command).
txprot: amount of data which has been received and should be forwarded to command function.
rxprot: This variable contains the expected size of data this command will return and will be set to the size of the actual data to be tx-ed back to host.
data: input data for command
The response will look like this:
Byte | 0 | 1 | 2 | 3 | 4 | 5 | 6..7 | 8..8+txprot-1 |
---|---|---|---|---|---|---|---|---|
Content | TID | payload | stream status | protocol | reserved | prot status | txprot | data |
Parameter | protocol | status | txSize | txData[0..txSize-1] |
where
TID : transaction ID.
payload: amount of data in report.
stream status : a non-zero value indicates that a previous command could not be processed
protocol : defines to which action the transmitted data belongs
prot status : a non-zero value indicates error condition of command (return value of function commands())
txprot: size of data in response
data: response data for command
Example for the antenna power command, handled by callAntennaPower():
Request from host (Reader Suite):
Byte | 0 | 1 | 2 | 3 | 4..5 | 6..7 | 8 |
---|---|---|---|---|---|---|---|
Content | TID | payload | reserved | protocol | txprot | rxprot | data |
Value | 0x0F | 0x07 | 0x00 | 0x01 | 0x0002 | 0x0001 | 0xFF |
where:
0x01: command ID for callAntennaPower(), is also used as index in call_fkt_() table.
0xFF: parameter for callAntennaPower(). 0xFF means turn antenna on.
The reader answer with this report:
Byte | 0 | 1 | 2 | 3 | 4 | 5 | 6..7 | 8 |
---|---|---|---|---|---|---|---|---|
Content | TID | payload | stream status | protocol | reserved | prot status | txprot | data |
Value | 0xF0 | 0x06 | 0x00 | 0x01 | 0x00 | 0x00 | 0x0001 | 0x00 |
0x00 (txData[0]): the data this command produced.
0x00 (status): ERR_NONE
Protocol for UART TTL:
A simple UART stream packet is shown in the following table, which maps the transmitted data to the function parameters of commands().
Byte | 0 | 1 | 2..3 | 4 | 5..6 | 7..8 | 9..9+txprot-1 |
---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | txprot | rxprot | data |
Parameter | protocol | rxSize | txSize | rxData[0..rxSize-1] |
where
TID : transaction ID.
Status : Uart Status
payload: amount of data in report.
protocol: defines which action should be triggered. If commands() is is called it refers to a firmware application command (no generic stream command).
txprot: amount of data which has been received and should be forwarded to command function.
rxprot: This variable contains the expected size of data this command will return and will be set to the size of the actual data to be tx-ed back to host.
data: input data for command
The response will look like this:
Byte | 0 | 1 | 2..3 | 4 | 5 | 6 | 7..8 | 9..9+txprot-1 |
---|---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | reserved | prot status | txprot | data |
Parameter | protocol | status | txSize | txData[0..txSize-1] |
where
TID : transaction ID.
Status : Uart Status
payload: amount of data in report.
protocol : defines to which action the transmitted data belongs
prot status : a non-zero value indicates error condition of command (return value of function commands())
txprot: size of data in response
data: response data for command
UART Settings:
BAUD RATE: 115200
DATA BITS: 8
PARITY: NONE
STOP BITS: 1
FLOW CONTROL: NONE
Example for the config TX RX command, handled by callConfigTxRx():
Request from host (Reader Suite):
Byte | 0 | 1 | 2..3 | 4 | 5..6 | 7..8 | 9..12 |
---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | txprot | rxprot | data |
Parameter | 0x20 | 0x00 | 0x00 09 | 0x04 | 0x00 04 | 0x00 04 | 0x00 00 01 01 |
where:
0x04: command ID for callConfigTxRx(), is also used as index in call_fkt_() table.
0x00 00 01 01 : parameter for callConfigTxRx() (set_sensitivity = false and sensitivity = 0; set_antenna = true and antenna id = 1)
The reader answer with this report:
Byte | 0 | 1 | 2..3 | 4 | 5 | 6 | 7..8 | 9..12 |
---|---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | reserved | prot status | txprot | data |
Parameter | 0x01 | 0x00 | 0x00 09 | 0x04 | 0x00 | 0x00 | 0x00 04 | 0x00 0B 00 01 |
0x00 0B 00 01: reserved bytes are 0x00, sensitivity is 0x0B and antenna id is 0x01
This function sets and reads various RF Tx/Rx related settings and is executed when a stream packet with protocol = CMD_CONFIG_TX_RX is received.
The format of the payload from the host is:
Byte | 0 | 1 | 2 | 3 |
---|---|---|---|---|
Content | set_sensitivity | sensitivity | set_antenna | antenna id |
The values are only being set if the proper set_X value is set to 1.
The device sends back:
Byte | 0 | 1 | 2 | 3 |
---|---|---|---|---|
Content | reserved(0) | sensitivity | reserved (0) | antenna id |
Values for the different parameters are:
Name | values |
---|---|
sensitivity | -128 .. 127 (dBm) |
antenna id | 1: antenna port 1 2: antenna port 2 |
Example for the Inventory Gen2 command, handled by callInventoryGen2():
Request from host (Reader Suite):
Byte | 0 | 1 | 2..3 | 4 | 5..6 | 7..8 | 9..12 |
---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | txprot | rxprot | data |
Parameter | 0x07 | 0x00 | 0x00 08 | 0x85 | 0x00 03 | 0x00 00 | 0x00 01 06 |
where:
0x85: command ID for callInventoryGen2(), is also used as index in call_fkt_() table.
0x00 01 06 : parameter for callInventoryGen2()
The reader answer with this report:
Byte | 0 | 1 | 2..3 | 4 | 5 | 6 | 7..8 | 9..12 |
---|---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | reserved | prot status | txprot | data |
Parameter | 0x76 | 0x00 | 0x00 14 | 0x05 | 0x00 | 0x00 | 0x00 0F | 00 00 01 8f ff ac 3c 0d 06 10 00 ba ba 77 77 |
0xba ba 77 77: epc of tag
Example for the Read from Tag command, handled by callReadFromTag():
Request from host (Reader Suite):
Byte | 0 | 1 | 2..3 | 4 | 5..6 | 7..8 | 9..17 |
---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | txprot | rxprot | data |
Parameter | 0x3E | 0x00 | 0x00 0e | 0x08 | 0x00 09 | 0x00 09 | 0x00 00 00 00 00 00 00 00 00 |
where:
0x08: command ID for callReadFromTag(), is also used as index in call_fkt_() table.
0x00 00 00 00 00 00 00 00 00 : parameter for callReadFromTag()
The reader answer with this report:
Byte | 0 | 1 | 2..3 | 4 | 5 | 6 | 7..8 | 9..16 |
---|---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | reserved | prot status | txprot | data |
Parameter | 0xE7 | 0x00 | 0x00 0D | 0x08 | 0x00 | 0x00 | 0x00 08 | 00 00 00 00 55 55 55 55 |
00 00 00 00 55 55 55 55: reserved memory of the tag
Implemented commands
Functions which handle the commands from the host are located in appl_commands.c
The documentation of the various appl command functions will only discuss the data received/sent back to host and will not include the header information for every transmitted packet.
For more details on the ams stream protocol have a look into ams_stream.h
Definition at line 3324 of file appl_commands.c.
更多通讯协议请参阅:http://flagship.eleckits.com/st25ru3993/firmware/doc/generated/html/index.html
矽控电子®分别获“科技型中小企业”、“江苏省民营科技企业”、“创新型中小企业”认定,核心团队拥有十余年的硬件正向研发,生产制程,测试手法,品质控制经验。尤其擅长嵌入式ARM平台的人工智能与工控物联网产品,以及瑞芯微(Rockchip)、海思、NXP、新唐等平台的机器视觉类AIoT模组开发,为您的产品从创意到落地、批量市场化助力。
公司可提供从硬件设计(原理开发及PCB Layout),Linux驱动开发,PCB制板,SMT及接插件焊接,产品测试,产品老化全流程外包服务,收费合理,品质可靠。
定制开发找矽控,品质可靠省费用
垂询电话:0510-83488567-1 业务邮箱:wxdianzi#foxmail.com (#更换为@)