wiki:BlueCAN

Communication protocol between CAN and CC2540 chip

List of commands from CC2540 to CAN transiver:

  1. Subscribe to a message
  2. Subscribe to a message with a bitmask
  3. Unsubscribe from messages
  4. Unsubscribe from messages with a bitmask
  5. List of all subscriptions
  6. Reset filter state
  7. Send message
  8. Enable/Disable? Passthrough mode
  9. Setup blocked pgns for passthrough mode (no more than 64 pgns at one time)
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
   08:01:01
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
8D F5 0B 11 07 01 01 08 00 00 00 01
8D F5 0B 00 07 01 C9 08 00 00 00 01
8D F5 0B 00 07 01 F0 0A 00 00 00 01

Temp Message
81 FD 06 00 07 01 17 6B 14 00 32 00
81 FD 06 00 07 01 9B 6E C8 00 F4 01
81 FD 06 00 07 01 C3 91 D0 07 88 13

Speed Message
81 F5 03 00 06 01 03 00 05 00 00
81 F5 03 00 06 01 1E 00 F4 01 00
81 F5 03 00 06 01 2C 01 50 C3 00

Log Message
81 F5 13 00 0E B2 3D AA E5 01 00 78 05 00 00 64 00 00 00
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
--------------------------------------------------

Last modified 4 years ago Last modified on 01/18/15 01:13:43

Attachments (3)

Download all attachments as: .zip