Sams4s RS232 command format

Command format

The protocol is a PC host initiated one. The PC sends a command and the ECR either replies with an ACK/NAK (or possibly other error) or an ACK followed by data. The data is stored as “files” on the ECR and the commands to read and write are very similar with the exception of the W/R direction byte and the program command which states which program files to read/write.

When data is received it receives multiple “files” in one go. For example reading the PLUs will return 20 PLUs at a time. After each block an ACK should be sent back and more data will follow.

Request a transfer from the ECR to the PC

If you want to receive data from the ECR then you need to send a 25 byte command. All commands start with a Start of packet and end with a end of packet and checksum. In the middle of the packet are the commands for the required function, eg upload/download and the required file.

Description Size Details
Start Of Packet 2 Bytes 10 02
Unknown 8 Bytes 01 00 00 00 00 00 00 00
Command 1 Byte Upload = 03
Unknown 3 Bytes 00 00 00
Program 1 Byte See Program List
Unknown 6 Bytes 01 00 00 00 01 00
End of Packet 3 Bytes 00 10 03
Checksum 1 Bytes

Request transfer from PC to ECR

If you want to send data to ECR then you need to send a 24 byte command. All commands start with a Start of packet and end with a end of packet and checksum. In the middle of the packet are the commands for the required function, eg upload/download and the required file. With the Sending data to the ECR you also need to specify the total number of data blocks you are sending, which data block this is and how many items in this block there are.

Description Size Details
Start Of Packet 2 Bytes 10 02
Unknown 8 Bytes 01 00 00 00 00 00 00 00
Command 1 Byte Download = 02
Unknown 3 Bytes 00 00 00
Program 1 Byte See Program List
Blocks Remaining 2 Bytes
This Block 2 Bytes
Items this block 1 Bytes
End of Packet 3 Bytes 00 10 03
Checksum 1 Byte

Check status

The check status command looks similar to the receive data command except it uses 09 for the command and the next 4 bytes are also 09, including the 3 unknown bytes that are usually 00 and the program byte which makes no sense on the program table, but it must mean something else for command 09.

Start Of Packet 2 Bytes 10 02
Unknown 8 Bytes 01 00 00 00 00 00 00 00
Command 1 Byte 09
Unknown 3 Bytes 09 09 09
Program 1 Byte 09
Unknown 6 Bytes 01 00 00 00 01 00
End of Packet 3 Bytes 00 10 03
Checksum 1 Bytes

Replies

The basic reply is as follows :-

The ECR will reply with 10 06 if it is happy or 10 15 if it is not

If you are requesting a data transfer to the PC then you will get a more complex response, firstly you will get a 20 byte header followed by the data. The header says how many blocks are needed to transfer all the data and how many files are in this block.

Description Size Details
SOP 2 10 02
Unknown 8 01 00 00 00 00 00 00 00
Direction confirmation 1 03
Unknown 3 00 00 00
Number blocks remaining 2 00 02 (2 blocks remain)
This block 2 00 01 (This is block #1)
Files in this block 2 00 14 (20 files in this block)

If the header said there are blocks remaining, then after receiving the header and the payload, send the ECR a ACK 0x10 0x06 then the ECR will repeat with the next block. Continue this until all blocks are received

 

Leave a Reply