stm32/pyb_can: Add support for FD CAN rxcallbacks. #8206
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The rxcallback functionality was not yet working for FD CAN interfaces.
This commit enables the support for rxcallback on CAN FD interfaces.
For FD CAN it is necessary to call HAL_FDCAN_ActivateNotification.
This sets the ILS and ILE bits to enable the interrupt lines.
For FD CAN, we clear the RX pending en RX overflow flags explicitly.
At the core of this fix is calling the HAL_FDCAN_ActivateNotification method.
This in turn configures the ILS and ILE registers, see below.
__IO uint32_t ILS; /*!< FDCAN Interrupt Line Select register, Address offset: 0x058 */__IO uint32_t ILE; /*!< FDCAN Interrupt Line Enable register, Address offset: 0x05C */For the pending and overflow interrups it is needed to clear the flags explicitly.
This was not needed for the buffer full interrupt. I could not figure out why that is.
Code reviews are welcome, I have tested this code on H7 (FD CAN) and F4 (CAN) mcu's.