Version 25 (modified by 12 years ago) ( diff ) | ,
---|
Communication protocol between CAN and CC2540 chip
http://en.wikipedia.org/wiki/CAN_bus
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
- byte - subsribe command
- byte - payload size 8 byte = 2 CAN message IDs * 4 byte each
- - 10. bytes 0076h & 0155h
------------------------------------------------- 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, 01h,02h,03h,04h,05h,06h,07h std.ID example 2 (ID=5DFh) 07h, 05h,DFh, 01h,02h,03h,04h,05h,06h,07h ------------------------------------------------- ------------------------------------------------- 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, 01h,02h,03h,04h,05h,06h,07h ext.ID example 2 (ID=12345678h ( b00010010001101000101011001111000 )) 07h, 92h,34h,56h,78h, 01h,02h,03h,04h,05h,06h,07h ext.ID example 3 (ID=1FFFFFFFh ( b00011111111111111111111111111111 29 bits, max value of ext.ID)) 07h, 9Fh,FFh,FFh,FFh, 01h,02h,03h,04h,05h,06h,07h --------------------------------------------------
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
Note:
See TracWiki
for help on using the wiki.