wiki:S6350serialcom

Version 10 (modified by pinwc4, 16 years ago) (diff)

--

TI S6350 communication overview

In order to use the TI reader within RealBasic we had to implement some of the serial protocol ourselves. In order to use the TI Reader with the ISO15693 protocol you must first generate a command encapsulated in the TI protocol and have the payload of the command be the ISO15693 command. Only 3 of the ISO15693 commands are necessary, Inventory All Slots, Inventory 1 Slot and Silence.

Collisions

The ISO15693 protocol allows for 16 time slots for communicating with an RFID reader. A collision occurs when 2 or more tags use the same time slot. By default each tag will use the 1st time slot unless a collision occurs. In the event of a collision the tags will randomly move to a different time slot.

The Inventory All Slots command can handle this as it checks each of the 16 slots for a RFID. Unfortunately doing this operation is slow, it takes about .3 seconds, far too long for a lap counter to get accurate lap times.

The solution is to use the Inventory 1 slot command during races. This command will just check the 1st time slot for a tag. To prevent collisions you must silence the tag immediately after it is detected. If a tag is silences it will not transmit again until it leaves and reenters the antenna loop.

Inventory All Slots

This sends an ISO15693 inventory command for the TI S6350 reader. Does an inventory of all time slots, this supports anti-collision but is too slow to use during a race as it takes about .3 seconds to return results. This command is used to scan in racers before a race starts. By using the inventory all slots command everyone can line up on the finish line and one inventory done to add them to the race.

The breakdown of the command is as follows: Byte 1 is the Start of Frame, always 01 Byte 2 and 3 is the length of the command including the 2 byte check sum that is added to the end, Least Significant Byte first Byte 4 and 5 is the node address, leave at 00 as we do not reference nodes Byte 6 is the command flags, no flags present Byte 7 is the command, &h60 means it is an ISO15693 command which will be in the data portion of the packet Byte 8 is the config byte for the reader, &h11 means 100% modulation and 1/4 data mode Byte 9 is the ISO15693 command flags, &h07 means 2 sub carriers, high data rate, inventory_flag set, nb_slots_flag set to all 16 slots Byte 10 is the ISO15693 command, &h01 means inventory Byte 11 is the optional mask that is not set Bytes 12 and 13 are the checksum

The resulting command could look like this: chrB(&h01) + chrB(&h0D) + chrB(&h00) + chrB(&h00) + chrB(&h00) + chrB(&h00) + chrB(&h60) + chrB(&h11) + chrB(&h07) + chrB(&h01) + chrB(&h00) + chrB(&h7B) + chrB(&h84)

Inventory 1 slot

This sends an ISO15693 inventory command for the TI S6350 reader. This does an inventory of just the first time slot, which allows for a faster inventory responses but can not handle collisions. A collision is when two tags or more tags are in the field at the same time. To minimize collisions silence the tag after it is detected. Byte 1 is the Start of Frame, always 01 Byte 2 and 3 is the length of the command including the 2 byte check sum that is added to the end, Least Significant Byte first Byte 4 and 5 is the node address, leave at 00 as we do not reference nodes Byte 6 is the command flags, no flags present Byte 7 is the command, &h60 means it is an ISO15693 command which will be in the data portion of the packet Byte 8 is the config byte for the reader, &h11 means 100% modulation and 1/4 data mode Byte 9 is the ISO15693 command flags, &h27 means 2 sub carriers, high data rate, inventory_flag set, nb_slots_flag set to 1 slot Byte 10 is the ISO15693 command, &h01 means inventory Byte 11 is the optional mask that is not set Bytes 12 and 13 are the checksum

The resulting command could look like this: ChrB(&h01) + ChrB(&h0D) + ChrB(&h00) + ChrB(&h00) + ChrB(&h00) + ChrB(&h00) + ChrB(&h60) + ChrB(&h11) + ChrB(&h27) + ChrB(&h01) + ChrB(&h00) + ChrB(&h5B) + ChrB(&hA4)

Silence Tag

The UID passed must be a string in the reverse byte order that it is recieved in the string assemled by this can be sent directly to the serial port to silence the given RFID tag

dim silencecommand as string Everything but checksum, portion before UID is the ISO15693 silence command for a TI S6350 Byte 1 is the Start of Frame, always 01 Byte 2 and 3 is the length of the command including the 2 byte check sum that is added to the end, Least Significant Byte first Byte 4 and 5 is the node address, leave at 00 as we do not reference nodes Byte 6 is the command flags, no flags present Byte 7 is the command, &h60 means it is an ISO15693 command which will be in the data portion of the packet Byte 8 is the config byte for the reader, &h11 means 100% modulation and 1/4 data mode Byte 9 is the ISO15693 command flags, &h23 means 2 sub carriers, high data rate, and address flag is set Byte 10 is the ISO15693 command, &h02 means be quiet Byte 11-18 are the UID that needs to shut up Byte 19 and 20 are the checksum that is added later

An example would be:

ChrB(&h01) + ChrB(&h14) + ChrB(&h00) + ChrB(&h00) + ChrB(&h00) + ChrB(&h00) + ChrB(&h60) + ChrB(&h11) + ChrB(&h23) + ChrB(&h02) + UID + Checksum

Checksum

The checksum used by the TI S6350 is very basic. It is a 2 byte checksum. The first byte is the XOR of the string. The second byte is teh XOR of &hFF and the first byte.

Here is an example of the code to do this: {{{dim checksum as string

dim xornumber1 as integer dim xornumber2 as integer 'Do a XOR of all the bytes of the string for byte 1 of the checksum 'Do not worry about xornumber having a zero initially, this does not impact the XOR operation for i as Integer=1 to len(data)

xornumber1 = xornumber1 xor ascB(mid(data,i,1))

next

'calculates byte 2 of the checksum xornumber2 = &hFF xor xornumber1 'put the two together for the complete checksum checksum = chrB(xornumber1) + chrB(xornumber2)}}}