Txbridge binary protocol
txbridge Protocol Documentation
The txbridge uses a binary protocol to communicate with the host over a TCP/IP connection.
Binary protocol format
Command (1 byte) | Size (1 byte) | Payload (n bytes) | Checksum (1 byte) |
---|---|---|---|
0xXX | 0xYY | 0xZZ, … | 0xAA |
cmd
: The command byte that specifies the action to be performed.command size
: The size of the payload in bytes.payload
: The data to be sent with the command, which can vary in size.checksum
: A single byte checksum that is the sum of all bytes in the payload, modulo 256.
Checksum
The checksum is a single byte that is the sum of all bytes in the payload, modulo 256.
var checksum byte for _, b := range payload { checksum += b }
Commands
Single byte commands
The adapter accepts certain commands as a single byte command, no checksum, payload or crc. The characters are case sensitive!
Command | Description | ECU |
---|---|---|
c (0x63) | Close canbus | |
x (0x78) | Start session | Only T7 |
z (0x7A) | Stop session | Only T7 |
r (0x72) | Start logging | |
s (0x73) | Stop logging | |
u (0x75) | Start OTA | |
A (0x41) | Cancel OTA | |
F (0x46) | Finish OTA | |
5 (0x35) | Set Trionic 5 | |
7 (0x37) | Set Trionic 7 | |
8 (0x38) | Set Trionic 8 | |
+ (0x2B) | Increase delay | |
- (0x2D) | Decrease delay | |
p (0x70) | Print stats to serial output | |
q (0x71) | Reboot dongle |
Close CANbus (0x63)
The command c
(0x63) closes the CANbus connection.
Start session (0x78)
Start a diagnostic session with the command x
(0x78). This command is only available for T7 devices.
Stop session (0x7A)
Stop a diagnostic session with the command z
(0x7A). This command is only available for T7 devices.
Start logging (0x72)
Start logging data with the command r
(0x72).
The device will continiously stream data to the host until the command s
(0x73) is sent to stop logging.
Data is sent in the following format:
Command | Size | Payload | Checksum |
---|---|---|---|
0x72 | 0xNN | <timestamp, 4 bytes uint32> <data, n bytes> | 0xAA |
Stop logging (0x73)
Stop logging data with the command s
(0x73). This will stop the continuous data stream initiated by the r
command.
Start OTA (0x75)
Start an Over-The-Air (OTA) update with the command u
(0x75). This command initiates the OTA process.
Cancel OTA (0x41)
Cancel an ongoing OTA update with the command A
(0x41). This will stop the OTA process.
Finish OTA (0x46)
Finish an OTA update with the command F
(0x46). This command finalizes the OTA process.
Set Trionic version (0x35, 0x37, 0x38)
Set the Trionic version with the commands 5
(0x35) for Trionic 5, 7
(0x37) for Trionic 7, and 8
(0x38) for Trionic 8. This command configures the adapter to work with the specified Trionic version.
Binary commands
Command | Description | Notes |
---|---|---|
d (0x64) | Define symbols to log | Only T5 |
o (0x6F) | Open canbus | |
R (0x52) | Read data by address | |
t (0x74) | Transmit CAN frame | |
T (0x54) | Transmit extended CAN frame | |
U (0x55) | OTA update package | |
v (0x76) | Version | |
w (0x77) | Set WBL | |
W (0x57) | Write data by address |
Define symbols to log (0x64)
The command d
(0x64) is used to define a symbols to log.
The payload should be repeated <symbol address, 4 bytes uint32> <symbol size, 2 byte uint16>
for example to log symbol at adress 0x10 and 0x20 with 2 bytes each the symbol list would look like this:
0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00
Open CANbus (0x6F)
The command o
(0x6F) is used to open the CANbus connection.
The payload should be a uint16 with the CANbus rate in kbit per second, for example 500 kbit/s would be 0x01F4
(500 in hex).
Command | Size | Payload | Checksum |
---|---|---|---|
0x6F | 0x02 | 0xF4, 0x01 | 0xF5 |
Read data by address (0x52)
The command R
(0x52) is used to read data from a specific address.
The address is in Little Endian format.
byte(address),byte(address >> 8),byte(address >> 16),byte(address >> 24)
Read 4 bytes from address 0x1234
Command | Size | Payload | Checksum |
---|---|---|---|
0x52 | 0x05 | 0x34, 0x12, 0x00, 0x00, 0x04 | 0x04A |
Request version (0x76)
The command v
(0x76) is used to request the version of the adapter firmware.
Command | Size | Payload | Checksum |
---|---|---|---|
0x76 | 0x01 | 0x10 | 0x10 |
Generate Wiki markdown
pandoc -r markdown ..MD -t mediawiki -o PROTOCOL.wiki