CAN-bus

From 'Engineers of Innovation Wiki'
Revision as of 14:50, 21 September 2022 by Quintenlb (talk | contribs) (Created CAN-format page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The communication between the electronics within the solar boat is build upon the CAN-bus protocol, where the datalogger logs the CAN messages. Every CAN-frame holds data that is PCB specific build, these frames are built according the CANOpen protocol.

CANopen format

A CAN-frame consists of an 11-bit identifier, a 1-bit Remote Transmission Request (RTR), 4-bit data length of the message and up to 8 bytes of data.

CANopen frame format
CAN-ID RTR Data length Data
Length 11 bits 1 bit 4 bits 0-8 bytes

The default CAN-ID mapping sorts frames by attributing a function code (NMT, SYNC, EMCY, PDO, SDO) to the first 4 bits, so that critical functions are given priority.

CAN-ID
Function code Node ID
Length 4 bits 7 bits

The data bytes are split into the following components:

Data in CAN-frame
Data[0] Data[1] Data[2] Data[3] Data[4] Data[5] Data[6] Data[7]
Node-ID Index Low Index High Subindex Data Data Data Data

Following the format the specific subsystems within the solar boat are given here below in their respective section.

Battery (MG) CAN-format

As of now the MG electronics battery is used in the solar boat. Although a new battery is being developed, this MG battery is still in use (as of September '22). Therefore the battery format is given here below.

Node-ID Index Subindex Data Type Resolution
0x302 0x2005 0x01 Voltage [V] uint16_t 1 [mV/LSB]
0x02 Current [A] int16_t 10 [mA/LSB]
0x03 Current Discharge [A] int16_t 10 [mA/LSB]
0x04 Current Charge [A] int16_t 10 [mA/LSB]
0x05 State-of-Charge [%] int8_t 1 [%/LSB]
0x06
0x07 Time to Go [min] uint16_t 1 [min/LSB]
0x402 0x2005 0x09 Cell Temperature High [°C] int8_t 1 [°C/LSB]
0x0A
0x0B Cell Temperature Low [°C] int8_t 1 [°C/LSB]
0x0C Cell Voltage High [V] uint16_t 1 [mV/LSB]
0x0D Cell Voltage Low [V] uint16_t 1 [mV/LSB]
0x0E BMS State uint32_t
0x0F Temperature Collection [°C] 4x uint8_t 1 [°C/LSB]
0x482 0x2000 Cell nr Cell [Cell_nr] Voltage [V] uint16_t 1 [mV/LSB]
0x202 Don't Care Don't Care Power Level [%] uint8_t 1 [%/LSB]

MPPT CAN-format

MPPT CAN-ID is set on the PCB with 3 resistors, ID 0-7. In case of the MPPT a formula needs to be used to determine the Node-ID of the respective MPPT.

The following formula needs to be used:

can_base_id = 1254 + (device_id * 8)

The CAN-data is in HEX therefore can_base_id needs to be converted to a hexadecimal value: Node-ID.

Node-ID Index Subindex Data Type Resolution
0x4E6 + (device_id * 8) Don't Care 0x00 Voltage Output [V] int16_t
0x01 Current Output [A] int16_t
0x02 Voltage OUT_SW [V] int16_t
0x03 MPPT State uint8_t
0x04 Safety Enabled bool
0x05 PWM Enabled bool
0x06 Temperature [°C] int8_t 1 [°C/LSB]
0x4E6 + (device_id * 8) Don't Care 0x08 Voltage Panel 1 [V] int16_t
0x09 Current Panel 1 [A] int16_t
0x0A Voltage Panel 2 [V] int16_t
0x0B Current Panel 2 [A] int16_t
0x0C Voltage Panel 3 [V] int16_t
0x0D Current Panel 3 [A] int16_t
0x0E Voltage Panel 4 [V] int16_t
0x0F Current Panel 4 [A] int16_t
0x4E6 + (device_id * 8) Don't Care 0x01 Duty Cycle Panel 1 [%] uint8_t 1 [%/LSB]
0x02 Duty Cycle Panel 2 [%] uint8_t 1 [%/LSB]
0x03 Duty Cycle Panel 3 [%] uint8_t 1 [%/LSB]
0x04 Duty Cycle Panel 4 [%] uint8_t 1 [%/LSB]
0x05 Channel Active map 4x uint8_t