wiki:KyoshoICserialcom

Kyosho IC lap counter communication overview

The Kyosho IC lap counter is based on the Melexis 90121 RFID chip with an Atmel microcontroller. Hardware specific information can be found here.

Though this hardware uses the same ISO15693 standard the commands used to execute the protocol are different. The Kyosho IC lap counter also supports an automatic polling mode that the TI reader does not support.

Automatic Polling Mode

The Kyosho IC lap counter hardware is capable of automatically polling for RFID's and returning the results without sending repeated inventory commands. Unfortunately this mode does not return the UID, instead it returns the data written to block 1 (data begins at block 0) of the RFID. Block 0 and block 2 must also be populated with information for this mode to work. Each tag must have unique data in block 1 for this mode to work correctly. When initializing the tag you can ensure that it has unique data in block 1 by using the last 4 bytes of the UID as the data. The following is an example of data that could be stored to the first 3 blocks for this mode to work:

Block  00  ACAE53E0
Block  01  AABBCCDD
Block  02  01160908

The automatic polling mode is enabled by sending the following command as hex codes:

31 04 01 34

While this mode is enabled anytime an RFID is detected a packet of information will be sent. The packet will be in the following format:

Byte 1 is the start of the frame, always A3 for the polling method
Byte 2 is the length of the frame INCLUDING checksum
Bytes 3-6 are the data from block 2 of the tag in reverse byte order
Byte 7 is the number of times the tag was detected
Bytes 8-10 are unknown
Byte 11 is the checksum

An example response packet for a RFID tag that uses the example data listed above for blocks 1-3 would look like this:

A3 0B DD CC BB AA E1 01 00 00 48

In this case the data from block 2 is in reverse byte order, showing up as DD CC BB AA.

To stop the automatic polling mode you need to send the following command:

32 03 31

Checksum

The checksum for the Kyosho IC lap counter is just a simple XOR operation on all the bytes of the packet.

Collisions

The Kyosho IC lap counter does not appear to be using any collision detection. When using the automatic polling mode the reader would only return at most 1 tag if multiple tags were in the field at the same time. Sometimes it would not return any results.

Tag Initialization

If a generic ISO 15693 RFID tag is being used with the automatic polling mode it must first be initialized. Data must be written to the first 3 blocks for it be detected by the Kysho IC lap counter. The automatic polling mode will return whatever data is written in block 1. The format of the data blocks must be the following:

Block  00  ACAE53E0
Block  01  Set to 4 unique bytes
Block  02  01160908

The best approach would be to write the last 4 bytes of the UID to block 1. To determine the UID you can use the read command.

Inventory 1 Slot

If you need to determine the UID of a tag in the field you can issue a command to inventory 1 time slot. As long as only 1 tag is in the field at the time this command will return that tags UID. This command will have a fast response time but can not handle collisions. The following command will inventory 1 slot:

35 03 36

If a tag is in the field you will receive a response in the following format:

Byte 1 will be 5F for the start of the frame
Byte 2 will be A1 for the protocol
Byte 3 will be the length of the packet EXCLUDING checksum, typically 0B in this case
Bytes 4-11 will be the UID in reverse byte order
Byte 12 will be the checksum, calculated using XOR operation

An example of a response packet with a tag in the field with the UID of E0 04 01 00 11 53 F8 2E would look like this:

5F A1 0B 2E F8 53 11 00 01 04 E0 DB

If no tag is in the field the reader will return solely a 5F as the response.

Read Data Blocks

If you want to read back data blocks from an RFID tag directly the command will be in the following format:'

Byte 1 is 36 for the start of the frame
Byte 2 is 0D for the length of the packet INCLUDING the checksum
Byte 3 is the starting block to read
Byte 4 is the number of blocks to read, 0 based so 0 = 1 block, 9 = 10 blocks
Byte 5-12 is the UID to be read in reverse byte order
Byte 13 is the checksum calculated using a XOR operation

An example of this command sent to UID E0 04 01 00 1C E3 BD 06 to read 10 blocks starting at block 3 would look like this:

36 0D 03 09 06 BD E3 1C 00 01 04 E0 90

The response to this command would be in the following format:

Byte 1 is A6 for the start of the frame
Byte 2 is 2B for the length INCLUDING the checksum
Byte 3 to (length-1) is the data
Byte (length) is the checksum calculated using a XOR operation

Using the command example above the data returned as a response could look like this:

A6 2B 54 65 73 74 20 43 61 72 20 4E 61 6D 65 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 CC

Write Data Blocks

When using the Kyosho IC lap counter to write to data blocks data must be written one block at a time. The command format to write data is the following:

Byte 1 is 37 for the start of the frame
Byte 2 is 10 for the length of the packet INCLUDING the checksum
Byte 3 is the data block number being written to but is based on 0 being the first block
Bytes 4-7 are the data to be written
Bytes 8-15 are the UID to be written to in reverse byte order
Byte 16 is the checksum calculated using a XOR operation

An example of this command being used to write the word Test to block 3 on the RFID would look like this:

37 10 03 54 65 73 74 06 BD E3 1C 00 01 04 E0 B3

The reader will respond to this command with a

5F A7 04 00 A3