You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stm32: Stores FEB_CAN_ID.h file. This branch is a shared submodule for all STM32 projects.
STM32 Files:
FEB_CAN_ID.h: A header file that stores all CAN Message IDs.
FEB_CAN.c: A file that handles CAN library initialization and received message handling. Additional CAN files will build of this one. File contains template code for writing additional CAN files.
FEB_CAN.h: Header file for FEB_CAN.c.
Other files:
FEB_CAN_ID.csv: A CSV file that stores names of CAN messages without assigned CAN IDs. This file is used to generate dynamic CAN IDs.
FEB_CAN_Static_ID.csv: A CSV file that sores names of CAN messages and their assigned CAN ID.
generate.py: This file uses data from FEB_CAN_ID.csv and FEB_CAN_Static_ID.csv to generate FEB_CAN_ID.h.
feb_can_id.py: A Python file that stores all CAN Message IDs.
README.md: Documentation for the CAN Library.
2 Usage
2.1 Git Submodule
Add: Install submodule into STM32 project, in Core/Inc/FEB_CAN_Library. Example command for BMS project is provided below.
Update: Run this command periodically to update the CAN library for STM32 projects.
git submodule update --init --remote --recursive
2.2 Update Library
Updating the library is a 2 step process, across branches main and stm32.
Git Branch: main
Add CAN Message: To add a CAN message with a static CAN ID, update FEB_CAN_Static_ID.csv file. To add a CAN message without a static CAN ID, update the FEB_CAN_ID.csv file.
Generate: Run generate.py script. This will update the FEB_CAN_ID.h header file.
Documentation: Document the new CAN message in this readme file.
GitHub: Commit and push changes to GitHub.
Git Branch: stm32
Update: Fetch changes from main branch.
git checkout main -- FEB_CAN_ID.h
GitHub: Commit and push changes to GitHub.
3 CAN Message Documentation
Note: Bytes and bits are 0-indexed. Multi-byte data is stored in Big-Endian format.
3.1 BMS
3.1.1 State
Byte
Value
Datatype
0
BMS State
uint8_t
1
Relay State
-
2
GPIO Sense
-
BMS State Value
BMS State
0
Startup
1
Standby
2
Balance
3
Charge
4
Precharge
5
Drive-Standby
6
Drive
7
Drive-Regen
8
Fault
Relay State Bit
Value
0
BMS Shutdown
1
AIR+
2
Precharge
GPIO Sense Bit
Value
0
AIR- Sense
1
AIR+ Sense
2
BMS Shutdown Sense
3
IMD Shutdown Sense
4
Charge Sense
3.1.2 Cell Data
Byte
Bit
Value
Unit
Datatype
0
7-5
Bank
-
uint8_t
0
4-0
Cell
-
uint8_t
1-2
-
Voltage
mV
uint16_t
3-4
-
Temperature
dC
int16_t
5
-
Flags
-
-
Bit
Flags
0
Under/Over Voltage
1
Under/Over Temperature
2
Balance
3
Disabled Temperature
3.1.3 Accumulator Voltage
Byte
Value
Unit
Datatype
0-1
Total Pack Voltage
mV
uint16_t
2-3
Min Cell Voltage
mV
uint16_t
4-5
Max Cell Voltage
mV
uint16_t
3.1.4 Accumulator Temperature
Byte
Value
Unit
Datatype
0-1
Average Cell Temperature
dC
int16_t
2-3
Min Cell Temperature
dC
int16_t
4-5
Max Cell Temperature
dC
int16_t
3.2 APPS
3.2.1 Normalized Brake
Byte
Value
Datatype
0-4
Normalized Brake
float
3.2.2 RMS Param Msg
Byte
Value
Datatype
0
addr
uint8_t
2
r/w command
boolean
3
NA
-
4-5
data
uint8_t
6-7
NA
-
R/W Command Value
State
0
Read
1
Write
Addr Value
State
20
Fault Clear
148
CAN Active Messages Lo Wor
3.2.3 RMS Command Msg
Byte
Value
Datatype
0-1
Torque Command
Torque
2-3
Speed Command
Angular Velocity
4
Direction
boolean
5.0
Inverter Enable
boolean
5.1
Inverter Discharge
boolean
5.2
Speedmode Enabled
boolean
6-7
Command Torque Limited
Torque
3.2.4 BSPD
Byte
Value
Datatype
0
BSPD State
uint8_t
BSPD State Value
BSPD State
0
False / Not Triggered
1
True / Triggered
3.2.5 Current
Byte
Value
Datatype
0-4
TPS Current
float
3.3 LVPDB
The LVPDB transmits 1 byte messages that correspond to the voltage and currents on the main bus, coolant pump, accumulator fans, or radiator fans.
3.3.1 Bus Current
Bus current should be measured to the second decimal place. Intended to be measured in mA
</tr>
Byte
Value
Datatype
1-2
Bus Current
int16_t
3.4 DCU
3.5 ICS
3.5.1 Buttons & Swtiches
The DASH_Breakout Board transmits a 1 byte message corresponding to status of the I/O on the I/O expander, the bits in the message are broken down in the table below:
Bit
Value
Datatype
0
Buzzer State
bool
1
Button 1 (Ready-To-Drive)
bool
2
Button 2
bool
3
Button 3
bool
4
Button 4
bool
5
Switch 1 (Coolant Pump)
bool
6
Switch 2 (Radiator Fans)
bool
7
Switch 3 (Accumulator Fans)
bool
3.6 DART
3.6.1 Measured Fan Speeds (Both DART1 and DART2)
Byte
Value
Datatype
0
Measured fan speed for fan 1, with 0 being fan off and 255 being fan at full speed