ST25RU3993 超高频UHF RFID读写模组通讯协议

2018-07-04 16:16:19 818

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().

Byte01234..56..78..8+txprot-1
ContentTIDpayloadreservedprotocoltxprotrxprotdata
Parameter


protocolrxSizetxSizerxData[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:

Byte0123456..78..8+txprot-1
ContentTIDpayloadstream statusprotocolreservedprot statustxprotdata
Parameter


protocol
statustxSizetxData[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):

Byte01234..56..78
ContentTIDpayloadreservedprotocoltxprotrxprotdata
Value0x0F0x070x000x010x00020x00010xFF

where:

The reader answer with this report:

Byte0123456..78
ContentTIDpayloadstream statusprotocolreservedprot statustxprotdata
Value0xF00x060x000x010x000x000x00010x00
  • 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().

Byte012..345..67..89..9+txprot-1
ContentTIDStatuspayloadprotocoltxprotrxprotdata
Parameter


protocolrxSizetxSizerxData[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:

Byte012..34567..89..9+txprot-1
ContentTIDStatuspayloadprotocolreservedprot statustxprotdata
Parameter


protocol
statustxSizetxData[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):

Byte012..345..67..89..12
ContentTIDStatuspayloadprotocoltxprotrxprotdata
Parameter0x200x000x00 090x040x00 040x00 040x00 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:

Byte012..34567..89..12
ContentTIDStatuspayloadprotocolreservedprot statustxprotdata
Parameter0x010x000x00 090x040x000x000x00 040x00 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:

Byte0123
Contentset_sensitivitysensitivityset_antennaantenna id

The values are only being set if the proper set_X value is set to 1.
The device sends back:

Byte0123
Contentreserved(0)sensitivityreserved (0)antenna id

Values for the different parameters are:

Namevalues
sensitivity-128 .. 127 (dBm)
antenna id1: antenna port 1
2: antenna port 2


Example for the Inventory Gen2 command, handled by callInventoryGen2():

Request from host (Reader Suite):

Byte012..345..67..89..12
ContentTIDStatuspayloadprotocoltxprotrxprotdata
Parameter0x070x000x00 080x850x00 030x00 000x00 01 06

where:

The reader answer with this report:

Byte012..34567..89..12
ContentTIDStatuspayloadprotocolreservedprot statustxprotdata
Parameter0x760x000x00 140x050x000x000x00 0F00 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):

Byte012..345..67..89..17
ContentTIDStatuspayloadprotocoltxprotrxprotdata
Parameter0x3E0x000x00 0e0x080x00 090x00 090x00 00 00 00 00 00 00 00 00

where:

The reader answer with this report:

Byte012..34567..89..16
ContentTIDStatuspayloadprotocolreservedprot statustxprotdata
Parameter0xE70x000x00 0D0x080x000x000x00 0800 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 (#更换为@)