CAN FD
What is CAN FD?
CAN FD (CAN Flexible Data Rate) is an advanced version of CAN with features as shown below.
The main features that would be beneficial are the increased length and increased speed. The increased length of data would be helpful to send more data in a single CAN message. The structure of the normal CAN message versus a CAN FD message is shown below.
For more details see CAN FD Explained - A Simple Intro [2023]
Microcontroller for CAN FD
https://www.digikey.ca/en/products/detail/stmicroelectronics/STM32G431KBT6/10231564
The STM32F series does not support CAN FD, however, this is available on the STM32G series as stated here:
We will need to implement libraries for this new microcontroller to get CAN FD support.
We will also need to replace the MCP2515 with the MCP2518FD
Setting up CAN FD
To set up Virtual CAN to work with CAN FD we can run
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set vcan0 mtu 72 # For CAN-FD
sudo ip link set up vcan0
The format of the DBC file should be as such. This will need to be updated for our next car, though many similar messages can be ported over.
BO_ 1 canFdStandard1: 24 Vector__XXX
SG_ signal3 : 128|64@1- (1,0) [0|0] "" Vector__XXX
SG_ signal2 : 64|64@1- (1,0) [0|0] "" Vector__XXX
SG_ signal1 : 0|64@1- (1,0) [0|0] "" Vector__XXX
Using CAN FD
https://buildmedia.readthedocs.org/media/pdf/python-can/3.0.0/python-can.pdf
According to the documentation, we can simply add the flag when are packing CAN messages or when creating the CAN interface
is_fd = True