-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32H7: Add new FDCAN driver #2987
base: master
Are you sure you want to change the base?
Conversation
…ely, reorganized FDCAN1 KConfig options
…ore without waiting; ensures non-blocking operations work as intended
Hi @rippetoej there are some Coding Styles that need to be fixed. |
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
based on PR apache#2987
Hi, is there any example code that I can refer to send/receive classic CAN messages on stm32h7? |
Summary
This is a draft PR. Style checks will fail and there is still some code that needs to be cleaned up and reviewed. I want to get this out in the open so others can get eyes on it.
The STM32H7 FDCAN block is a significant departure from the F7 and F4, so a lot has changed here. Fortunately, the SAMv7 series of chips use a nearly identical version of this IP, so that driver served as the starting point. The major difference between this controller and the one present in the F7 and F4 is the presence of the Message RAM. This is a 10 kB block of SRAM dedicated entirely to the FDCAN block and shared by the two independent FDCAN controllers. Each controller instantiates RX/TX FIFOs and buffers here to hold CAN messages. Also instantiated here are separate sets of filters for standard and extended length ID messages. The layout of the message ram is incredibly important to the proper operation of the controllers, so it is imperative that the driver get this right. The layout of the message RAM is fully configurable by the user via menuconfig. To help prevent invalid configurations, each config option has appropriate limits and a compile-time check ensures that the limits of the message RAM are not exceeded.
In its current state, the driver is functioning properly, but there is room for considerable improvement. Things that work:
Impact
Adds a shiny new driver!
Testing
Used the can example app to send a few thousand extended and standard length ID messages per test. I ran several of these tests in both blocking and non-blocking mode. I also tested using the FDCAN controller's built in hardware loopback as well as between two separate boards running the can example app. As as side note, I had to modify the can example app to get this to work properly, so I should probably commit that too.
The driver has also been used to send and receive standard length ID messages to CAN-based device controllers. These were sent alongside extended ID messages passed by UAVCAN without issue.
Important notes and things that need to be worked on