Version 43 (modified by 12 years ago) ( diff ) | ,
---|
Communication protocol between CAN and CC2540 chip
List of commands from CC2540 to CAN transiver:
- Subscribe to a message
- Subscribe to a message with a bitmask
- Unsubscribe from messages
- Unsubscribe from messages with a bitmask
- List of all subscriptions
- Reset filter state
- Passthrough message
enum { CMD_SUBSCRIBE = 1, CMD_SUBSCRIBE_BITMASK, CMD_UNSUBSCRIBE, CMD_UNSUBSCRIBE_BITMASK, CMD_LIST, CMD_RESET, CMD_MSG } cmd_type;
List of responces from CAN transiver:
enum { ACK_SUBSCRIBE = 1, ACK_SUBSCRIBE_BITMASK, ACK_UNSUBSCRIBE, ACK_UNSUBSCRIBE_BITMASK, ACK_LIST, ACK_RESET, ACK_MSG } cmd_type;
Command message structure
Byte | Bitmask | Description | Values |
---|---|---|---|
0 | Command code | 1 - 7 | |
1 | Payload size | 0 - 254 | |
2 - 255 | Payload |
Examples
01:08:00:76:01:55:02:44:00:01 04:02:00:76 05:00 06:00 07:07:FF:05:01:02:03:04:05 07:01:67:02:00:05
Command | Length | Payload |
---|---|---|
1 byte | 1 | n |
01 | 08 | 76:01:55:02:44:00:01 |
Subscribe | 2 CAN message IDs, 4 byte each |
Depth Message
81 F5 0B 11 07 01 01 08 00 00 00 01
81 F5 0B 00 07 01 C9 08 00 00 00 01
81 F5 0B 00 07 01 F0 0A 00 00 00 01
Temp Message
81 FD 06 00 07 01 1B 01 16 01 84 03
81 FD 06 00 07 01 25 01 20 01 84 03
81 FD 06 00 07 01 2A 01 25 01 84 03
81 FD 06 00 07 01 1E 00 00 00 84 03
Speed Message
81 F5 03 00 06 01 01 00 05 00 00
81 F5 03 00 06 01 64 00 F4 01 00
81 F5 03 00 06 01 10 27 50 C3 00
Log Message
81 F5 13 00 11 01 B0 3D 81 09 00 00 B0 04 00 00 64 00 00 00 00 00
81 F5 13 00 11 01 B0 3D 91 30 00 00 78 05 00 00 2C 01 00 00 00 00
81 F5 13 00 11 01 B0 3D 99 35 00 00 78 07 00 00 2D 02 00 00 00 00
------------------------------------------------- Standard CAN message example: ID=76h byte0 - 07h (incoming CAN MESSAGE) byte1 - 00h (00h=b00000000 bit.7=0 standard message) (this is byte.1 of std.ID excluding high 5 bits in this byte) //if byte1 bit7=0 expect 1 more byte for ID byte2 - 76h (this is byte.0 of std.ID) byte3 - DLC (message data length code. also the payload. 8 in this example) byte4 - 01h (byte.0 of data) byte5 - 02h (byte.1 of data) byte6 - 03h (byte.2 of data) byte7 - 04h (byte.3 of data) byte8 - 05h (byte.4 of data) byte9 - 06h (byte.5 of data) byte10 - 07h (byte.6 of data) byte11 - 08h (byte.7 of data) std.ID example 1 (ID=76h) 07h, 00h,76h, 08h, 01h,02h,03h,04h,05h,06h,07h,08h std.ID example 2 (ID=5DFh) 07h, 05h,DFh, 08h, 01h,02h,03h,04h,05h,06h,07h,08h ------------------------------------------------- ------------------------------------------------- Extended CAN message example: ID=76h byte0 - 07h (incoming CAN MESSAGE) byte1 - 80h (80h=b10000000 bit.7=1 extended message ) (this is byte.3 of ext.ID excluding high 3 bits in this byte) //if byte1 bit7=1 expect 3 more bytes for ID byte2 - 00h (this is byte.2 of ext.ID) byte3 - 00h (this is byte.1 of ext.ID) byte4 - 76h (this is byte.0 of ext.ID) byte5 - DLC (message data length code. also the payload. 8 in this example) byte6 - 01h (byte.0 of data) byte7 - 02h (byte.1 of data) byte8 - 03h (byte.2 of data) byte9 - 04h (byte.3 of data) byte10 - 05h (byte.4 of data) byte11 - 06h (byte.5 of data) byte12 - 07h (byte.6 of data) byte13 - 08h (byte.7 of data) ext.ID example 1 (ID=76h ( b00000000000000000000000001110110 )) 07h, 80h,00h,00h,76h, 08h, 01h,02h,03h,04h,05h,06h,07h,08h ext.ID example 2 (ID=12345678h ( b00010010001101000101011001111000 )) 07h, 92h,34h,56h,78h, 08h, 01h,02h,03h,04h,05h,06h,07h,08h ext.ID example 3 (ID=1FFFFFFFh ( b00011111111111111111111111111111 29 bits, max value of ext.ID)) 07h, 9Fh,FFh,FFh,FFh, 08h, 01h,02h,03h,04h,05h,06h,07h,08h --------------------------------------------------
Attachments (3)
- Capture1.PNG (141.4 KB ) - added by 12 years ago.
- Capture3.PNG (20.9 KB ) - added by 12 years ago.
- Boris_Trace.trc (8.3 KB ) - added by 12 years ago.
Download all attachments as: .zip