User Tools

Site Tools


iol-hat:sw:3_binary-protocol

3 Binary protocol

The sequence for communication over TCP is as follows:

The commands and responses are exchanged in the send() and receive() part of the sequence. The first octet in the command structure always defines the command ID.

If two IOL HAT are stacked, they share the same SPI data lines but different CS and IRQ lines. Which lines are used is set by jumpers on the hardware. The Master Application uses different TCP ports for adressing the port 1+3 setup and the port 2+4 setup (i.e. it controls different CS and IRQ lines).

Many commands use a port index (either 0 or 1). Port index 0 refers to the IOL HAT X1 connector, Port index 1 to IOL HAT X2 connector. Which IOL HAT module is addressed is determined through the TCP port as described above.

The commands have a common structure in the first two octets:

Octet # Usage
0 Command ID
1 Length

In case of a command success, the return message as described in the commands is returned by the TCP server.

Error handling

In case of an error, the error message is returned:

Octet # Usage
0 Error message ID = 0xFF
1 Error code

The following error codes are defined:

Error code Usage
0x01 Message Length Error
0x02 Function ID unknown
0x03 Port power error, e.g. read while port disabled
0x04 Port ID error, i.e. port ID >1 called
0x05 Internal error, in this case octets 2..3 define the specific error code from the I-Link stack
0x06 Wrong status, e.g. data exchange when power off or no connection to the device

The error codes are listed in Appendix-A.

iol-hat/sw/3_binary-protocol.txt · Last modified: 2025/04/16 17:26 by 127.0.0.1