Can Control RS485 Communication Protocol

From OpenMotics
Jump to navigation Jump to search

Introduction

For the Core/Core+, additional messages are created to perform the CAN and DALI tunnels between the Core platform and the CAN Control devices. This means that the CAN Control firmware is different when applied for Core/Core+ platforms.

A different protocol is used for the tradition Master (18F67J11) and the Core/Core+:

  • Protocol V1: Traditional Master
  • Protocol V2: Core/Core+

Below, you can find the message structure for the general communication between the Core platform and the Can Control.

Message Structure

Request M->S
' 0 1 2 3 4 5 6 7 8 9 .. 9+n 10+n 11+n 12+n 13+n 14+n
ST ID0 ID1 ID2 ID3 Instr_type Length Queue_Size SIDH SIDL Data_1 ... Data_n C CSUM.MSB CSUM.LSB 13 10
  • The variable type of instructions are only used in combination with the Core/Core+
  • These instructions are only available in the Can Control Firmware V6.x.y which is a dedicated version for the Core/Core+
  • Since these instructions are used to check a Can Control module, ID0 must be equal to "C"
  • Instr_type:
    • 0: Nothing to report
    • 1: CAN message
    • 2: DALI message
  • Length: This byte represents the length of the data payload, min 1 and max 11.
  • SIDH: CAN SDH, only used for CAN messages, in DALI Message = 0
  • SIDL: CAN SDL, only used for CAN messages, in DALI Message = 0
  • n:
    • Between 2 and 8
    • If Length>3 then n=Length-3
  • Queue_Size: If a message is sent from one side to the other, the receiving entity must understand if more then 1 message will be send. So when Queue_Size>0, another message will follow.
  • Data_1..Data_n: The number of bytes the data payload will have depends on the length byte (between 1 and 11 bytes in total as data payload size)
  • CSUM=SUM(Byte0..Byte9+n)
Response S->M
' 0 1 2 3 4 5 6 7 8 9 .. 9+n 10+n 11+n 12+n 13+n 14+n
RC ID0 ID1 ID2 ID3 Instr_type Length Queue_Size SIDH SIDL Data_1 ... Data_n C CSUM.MSB CSUM.LSB 13 10
  • CSUM=SUM(Byte0..Byte9+n)

Message from Master to Can Control Module (V2)

Nothing to report from Master, request if something in the Queue of Can Control Module

Request M->S
' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
ST ID0 ID1 ID2 ID3 0 2 0 health_status BRGCON1 BRGCON2 BRGCON3 BRGCON_CRC8 C CSUM.MSB CSUM.LSB 13 10
  • health_status: Received from Brain(+)
    • health_status.BIT1=1: At least 1 Micro CAN is responding
    • health_status.BIT0=1: At least 1 Micro CAN is NOT responding
  • CAN speed settings are communicated over RS485:
    • BRGCON1-3: BRGCON settings of the 18F46K80
    • BRGCON_CRC8: CRC8 calculation result of BRGCON1-3

CAN Message from the Master to the CAN Control Module, request if something in the Queue of the Can Control Module

Request M->S
' 0 1 2 3 4 5 6 7 8 9 ... 8+n 9+n 10+n 11+n 12+n 13+n
ST ID0 ID1 ID2 ID3 1 3+Nr_of_CAN_Bytes Queue_Size SIDH SIDL CAN_Byte_1 ... CAN_Byte_n C CSUM.MSB CSUM.LSB 13 10
  • CAN message is embedded in RS485 message that is send from the Master to the CAN Control Slave
  • Nr_of_CAN_Bytes: Nr of CAN bytes (CAN_Byte_1 .. CAN_Byte_n), from 2 to 8
  • Queue_Size: If Queue_Size>0, request slave to stay in receive mode since more messages will be send immediately. If Queue_Size=0, no additional messages will follow.
  • CAN_Byte_n: n=Nr_of_CAN_Bytes
  • SIDH and SIDL: registers from CAN bus

DALI Message from the Master to the CAN Control Module, request if something in the Queue of the Can Control Module

Request M->S
' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
ST ID0 ID1 ID2 ID3 2 6 Queue_Size DALI_Byte_1 DALI_Byte_2 DALI_Byte_3 DALI_Byte_4 DALI_Byte_5 C CSUM.MSB CSUM.LSB 13 10
  • DALI message is embedded in RS485 message that is send from the Master to the CAN Control Slave
  • Nr_of_CAN_Bytes: 6, since always 5 DALI bytes are sent including the Queue_size byte
  • Queue_Size: If Queue_Size>0, request slave to stay in receive mode since more messages will be send immediately. If Queue_Size=0, no additional messages will follow.

Response from Can Control Module to Master (V2)

Nothing to report from Can Control Module, queue is empty

Request S->M
' 0 1 2 3 4 5 6 7 8 9 10 11 12
RC ID0 ID1 ID2 ID3 0 2 0 CAN Power state C CSUM.MSB CSUM.LSB 13 10
  • CAN Power state: =0 -> CAN power out is OFF, =1 -> CAN power out is ON

CAN Message from the CAN Control Module to the Master

Request S->M
' 0 1 2 3 4 5 6 7 8 9 ... 8+n 9+n 10+n 11+n 12+n 13+n
RC ID0 ID1 ID2 ID3 1 3+Nr_of_CAN_Bytes Queue_Size SIDH SIDL CAN_Byte_1 ... CAN_Byte_n C CSUM.MSB CSUM.LSB 13 10
  • CAN message is embedded in RS485 message that is send from CAN Control Slave to the Master
  • Nr_of_CAN_Bytes: Nr of CAN bytes (CAN_Byte_1 .. CAN_Byte_n), from 2 to 8
  • Queue_Size: If Queue_Size>0, request Master to stay in receive mode since more messages will be send immediately. If Queue_Size=0, no additional messages will follow.
  • CAN_Byte_n: n=Nr_of_CAN_Bytes

DALI Message from the CAN Control Module to the Master

Request S->M
' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
RC ID0 ID1 ID2 ID3 2 6 Queue_Size DALI_Byte_1 DALI_Byte_2 DALI_Byte_3 DALI_Byte_4 DALI_Byte_5 C CSUM.MSB CSUM.LSB 13 10
  • DALI message is embedded in RS485 message that is send from the Slave to Master
  • Nr_of_CAN_Bytes: 6, since always 5 DALI bytes are sent including the Queue_size byte
  • Queue_Size: If Queue_Size>0, request slave to stay in receive mode since more messages will be send immediately. If Queue_Size=0, no additional messages will follow.