BinghamtonRover / Firmware-Utilities

A shared implementation of the CAN bus protocol for Arduino-based microcontrollers.
https://BinghamtonRover.github.io/burt-can/
2 stars 0 forks source link

Switch to CAN_FD on the Teensy's and Pi #6

Open Levi-Lesches opened 1 year ago

Levi-Lesches commented 1 year ago

A CAN frame can only fit 8 bytes of data, which is extremely limiting. Using a complex function we were able to carefully bring down some floats to 2 bytes. But a much simpler implementation would need 4 bytes for an accuracy of <0.01. With this implementation, we can only fit 2 floats per frame, resulting in many more frames needing to be sent.

A CAN_FD frame can contain 64 bytes of data, raising our data cap from 2 floats to 16, which should solve our issues. We've had compatibility issues getting CAN_FD to work on the Teensy boards and the Pi, so let's take this slow and work on a separate branch:

  1. Convert the CAN library to CAN_FD and test on a Teensy (this issue)
  2. Convert the Pi code to CAN_FD and test https://github.com/BinghamtonRover/Subsystems-Computer/issues/7

When both work, we can switch.

Levi-Lesches commented 1 year ago

Update: