DLPU057A March 2018 – April 2022
To aid the Piccolo in finding the start of a transaction, a special START CHARACTER should be sent before the start of Command Byte (Byte 1) in the Command Packet. The hex character 0xA5 is treated as this special START CHARACTER. The START CHARACTER 0xA5 should not be present anywhere else in the byte stream sent by master.
If the master needs to send 0xA5 in the byte stream (not as a START CHARACTER), it should use the help of another special character 0x5A named as the ESCAPE CHARACTER. Sending 0x5A 0x00 consecutively will be treated as a single data byte 0xA5.
The following table illustrates how various combinations of bytes are interpreted.
Bytes | Interpretation |
0xA5 | Start of transaction. Next Byte is Command Byte. |
0x5A 0x00 | Data Byte 0xA5 |
0x5A 0x5A | Data Byte 0x5A |
0x5A | Data Byte 0xYY, when YY is the hex byte immediately following 0x5A and 0xYY is non-zero. |
The ESCAPE CHARACTER (0x5A) can come in as a replacement for any byte in the command packet explained in Figure 1-3.
The START CHARACTER can be used to abort any existing command. Whenever 0xA5 is received by the slave, it clears any unfinished command and starts afresh treating the next byte as Command byte.
The following figures illustrate the complete structure of a write and read commands.
Write | Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | … | Byte n+2 | Byte n+3 | Byte n+4 | Byte n+5 | Byte n+6 |
Host (Master) | 0xA5 | CMD | LEN | D1 | D2 | … | Dn | CKSUM | 0 | 0 | 0 |
Piccolo (Slave) | FF | FF | FF | FF | FF | … | FF | FF | FF | FF | Response |
Read | Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | … | Byte n+2 | Byte n+3 | Byte n+4 | Byte n+5 |
Host (Master) | 0xA5 | CMD | LEN | D1 | D2 | … | Dn | CKSUM | 0 | 0 |
Piccolo (Slave) | FF | FF | FF | FF | FF | … | FF | FF | FF | FF |
Read | Byte n+6 | Byte n+7 | Byte n+8 | Byte n+9 | … | Byte n+m+7 | Byte n+m+8 |
Host (Master) | 0 | 0 | 0 | 0 | … | 0 | 0 |
Piccolo (Slave) | Response | LEN | D1 | D2 | … | Dm | CKSUM |
Please note that the start and escape characters are not applicable to data sent by slave.