Difference between revisions of "CAN-bus"

From 'Engineers of Innovation Wiki'
Jump to navigation Jump to search
(Created CAN-format page)
 
(Added CAN-Bus ID overview)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The communication between the electronics within the [[Solar boat (boii)|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 [[wikipedia:CANopen|CANOpen]] protocol.
The communication between the electronics within the [[Solar boat (boii)|solar boat]] is build upon the CAN-bus protocol, where the [[datalogger]] logs the CAN messages. Pinout of our Binder connectors are:  


== CANopen format ==
== CAN-bus ID overview ==
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.
<syntaxhighlight lang="markdown">
0x100 EoI Battery start
0x10F EoI Battery end
 
0x200 EoI GNNS info, u8 fix (bool); u8 sats; u8 sats used
0x201 EoI GNNS f32 speed, kmh; f32 direction, degrees
0x202 EoI GNNS f64 Latitude, degrees
0x203 EoI GNNS f64 Longitude, degrees
0x204 EoI GNNS date time, u16 year, u8 month, u8 day, u8 hour, u8 minute, u8 second
 
0x302 MG Battery
0x402 MG Battery
0x482 MG Battery cell voltage
 
0x700 MPPT start
0x77F MPPT end
 
0x0900 THROTTLE To VESC
0x1337 THROTTLE Status
 
0x0909 VESC Status message 1
0x0E09 VESC Status message 2
0x0F09 VESC Status message 3
0x1009 VESC Status message 4
0x1B09 VESC Status message 5
</syntaxhighlight>
 
== CAN-bus pinout ==
{| class="wikitable"
{| class="wikitable"
|+CANopen frame format
|+ Colours of the Standard Binder CAN Cable and its pinout
!
|-
!CAN-ID
! Binder Connector pin Number !! Wire Colour !! Signal on wire
!RTR
|-
!Data length
| 1 ||style="background: #83603A;"| Brown || 24v Power
!Data
|-
| 2 ||style="background: #FFFFFF;"| White || CAN H
|-
| 3 ||style="background: #0065B2;"| Blue  || CAN L
|-
| 4 ||style="background: #241F21;color:white;"| Black || Ground
|-
|-
!Length
| 5 ||style="background: #B2B3B7;"| Gray  || Safety
|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.  
 
Note that the M12 connectors have a different pinout and thus different colour wires. To make compatibility between systems easier the binder connectors are soldered with the wrong colored wires so that plugging in a M12 device results in the right signals being passed to the Binder connector. This Compatibility pinout is shown below:
 
{| class="wikitable"
{| class="wikitable"
|+CAN-ID
|+ NON-STANDARD!! Colours when connecting an M12 cable to a binder connector NON-STANDARD!!
!
|-
!Function code
! Binder Connector pin Number !! Wire Colour !! Signal on wire
!Node ID
|-
| 1 ||style="background: #FFFFFF;"| White || 24v Power
|-
| 2 ||style="background: #241F21;color:white;"| Black || CAN H
|-
| 3 ||style="background: #B2B3B7;"| Gray  || CAN L
|-
| 4 ||style="background: #0065B2;"| Blue  || Ground
|-
|-
!Length
| 5 ||style="background: #83603A;"| Brown || Safety
|4 bits
|7 bits
|}
The data bytes are split into the following components:
{| class="wikitable"
|+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 (boii)|solar boat]] are given here below in their respective section.


== Battery (MG) CAN-format ==
== Battery (MG) CAN-format (No longer used) ==
As of now the MG electronics [[battery]] is used in the [[Solar boat (boii)|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.
As of now the MG electronics [[battery]] is used in the [[Solar boat (boii)|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.
{| class="wikitable"
{| class="wikitable"
Line 194: Line 210:
|uint8_t
|uint8_t
|1  <code>[%/LSB]</code>
|1  <code>[%/LSB]</code>
|}
== 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:
<code>can_base_id = 1254 + (device_id * 8)</code>
The CAN-data is in HEX therefore <code>can_base_id</code> needs to be converted to a hexadecimal value: <code>Node-ID</code>.
{| class="wikitable"
|+
!Node-ID
!Index
!Subindex
!Data
!Type
!Resolution
|-
|0x4E6 + (device_id * 8)
|Don't Care
|0x00
|Voltage Output <code>[V]</code>
|int16_t
|
|-
|
|
|0x01
|Current Output <code>[A]</code>
|int16_t
|
|-
|
|
|0x02
|Voltage OUT_SW <code>[V]</code>
|int16_t
|
|-
|
|
|0x03
|MPPT State
|uint8_t
|
|-
|
|
|0x04
|Safety Enabled
|bool
|
|-
|
|
|0x05
|PWM Enabled
|bool
|
|-
|
|
|0x06
|Temperature <code>[°C]</code>
|int8_t
|1 <code>[°C/LSB]</code>
|-
|
|
|
|
|
|
|-
|0x4E6 + (device_id * 8)
|Don't Care
|0x08
|Voltage Panel 1 <code>[V]</code>
|int16_t
|
|-
|
|
|0x09
|Current Panel 1 <code>[A]</code>
|int16_t
|
|-
|
|
|0x0A
|Voltage Panel 2 <code>[V]</code>
|int16_t
|
|-
|
|
|0x0B
|Current Panel 2 <code>[A]</code>
|int16_t
|
|-
|
|
|0x0C
|Voltage Panel 3 <code>[V]</code>
|int16_t
|
|-
|
|
|0x0D
|Current Panel 3 <code>[A]</code>
|int16_t
|
|-
|
|
|0x0E
|Voltage Panel 4 <code>[V]</code>
|int16_t
|
|-
|
|
|0x0F
|Current Panel 4 <code>[A]</code>
|int16_t
|
|-
|
|
|
|
|
|
|-
|0x4E6 + (device_id * 8)
|Don't Care
|0x01
|Duty Cycle Panel 1 <code>[%]</code>
|uint8_t
|1 <code>[%/LSB]</code>
|-
|
|
|0x02
|Duty Cycle Panel 2 <code>[%]</code>
|uint8_t
|1 <code>[%/LSB]</code>
|-
|
|
|0x03
|Duty Cycle Panel 3 <code>[%]</code>
|uint8_t
|1 <code>[%/LSB]</code>
|-
|
|
|0x04
|Duty Cycle Panel 4 <code>[%]</code>
|uint8_t
|1 <code>[%/LSB]</code>
|-
|
|
|0x05
|Channel Active map
|4x uint8_t
|
|}
|}

Latest revision as of 08:13, 19 June 2025

The communication between the electronics within the solar boat is build upon the CAN-bus protocol, where the datalogger logs the CAN messages. Pinout of our Binder connectors are:

CAN-bus ID overview

0x100 EoI Battery start
0x10F EoI Battery end

0x200 EoI GNNS info, u8 fix (bool); u8 sats; u8 sats used 
0x201 EoI GNNS f32 speed, kmh; f32 direction, degrees
0x202 EoI GNNS f64 Latitude, degrees
0x203 EoI GNNS f64 Longitude, degrees
0x204 EoI GNNS date time, u16 year, u8 month, u8 day, u8 hour, u8 minute, u8 second

0x302 MG Battery 
0x402 MG Battery
0x482 MG Battery cell voltage

0x700 MPPT start
0x77F MPPT end

0x0900 THROTTLE To VESC
0x1337 THROTTLE Status

0x0909 VESC Status message 1
0x0E09 VESC Status message 2
0x0F09 VESC Status message 3
0x1009 VESC Status message 4
0x1B09 VESC Status message 5

CAN-bus pinout

Colours of the Standard Binder CAN Cable and its pinout
Binder Connector pin Number Wire Colour Signal on wire
1 Brown 24v Power
2 White CAN H
3 Blue CAN L
4 Black Ground
5 Gray Safety

Note that the M12 connectors have a different pinout and thus different colour wires. To make compatibility between systems easier the binder connectors are soldered with the wrong colored wires so that plugging in a M12 device results in the right signals being passed to the Binder connector. This Compatibility pinout is shown below:

NON-STANDARD!! Colours when connecting an M12 cable to a binder connector NON-STANDARD!!
Binder Connector pin Number Wire Colour Signal on wire
1 White 24v Power
2 Black CAN H
3 Gray CAN L
4 Blue Ground
5 Brown Safety

Battery (MG) CAN-format (No longer used)

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]