Conversation
097a73f to
6ddc5df
Compare
samuelsadok
left a comment
There was a problem hiding this comment.
This looks generally good, see one comment.
I also added a basic CI compile test, so when you push again it will pick up the new test and might require additional changes.
I'm a bit surprised that the STM32 Arduino core doesn't already come with a standard HardwareCAN implementation. Is pazi88/STM32_CAN.git the go-to CAN library that people use on STM32 Arduinos?
src/ODriveSTM32CAN.hpp
Outdated
|
|
||
| static bool sendMsg(STM32_CAN& can_intf, uint32_t id, uint8_t length, const uint8_t* data) { | ||
| CanMsg msg; | ||
| msg.id = id; |
There was a problem hiding this comment.
The top three bits of id are reserved, with the MSB meaning "extended". Additionally, if data is null, it should send a remote request frame if the CAN lib supports it.
| msg.id = id; | |
| msg.id = id & 0x1ffffff; | |
| msg.flags.extended = id & 0x80000000; | |
| msg.flags.remote = data; |
(not tested)
There is no CAN support in STM32duino, see this issue: stm32duino/Arduino_Core_STM32#259. From the thread it seems like pazi88/STM32_CAN is a decent implementation that works on most STM32 devies. |
`msg.flags.remote = data;` caused the example to stop working. ChatGPT suggested `msg.flags.remote = (data == nullptr);` which seems to work.
|
Ah yes I got the polarity flipped in my suggestion. |
|
Thanks for adding this! |
Hi! Thanks for the project!
I added support for STM32 boards with built-in CAN controller using https://github.com/pazi88/STM32_CAN.
As far as I can see, the example seems to work with my ODrive S1 and Adafruit STM32F405 Feather Express.
Please note that I am not comfortable with C++ programming, please let me know of any improvements I can make.
Thanks!