Skip to content

Conversation

@JohnieBraaf
Copy link
Contributor

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.

@JohnieBraaf JohnieBraaf marked this pull request as draft January 24, 2022 16:01
@JohnieBraaf JohnieBraaf marked this pull request as ready for review January 24, 2022 16:01
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.

Signed-off-by: Jan Staal <[email protected]>
@JohnieBraaf
Copy link
Contributor Author

This PR appears to be a dupplicate of work done here #8057

The same runaway interrupt behaviour was encountered there and resovled by clearing of the interrupt flags.
It seems a better choice to do this in the fdcan.c irq handler as opposed to in the recv method of pyb_can.c.

I'm proposing to close this PR in favor of #8057

@JohnieBraaf JohnieBraaf deleted the fdcan_rxcallback branch January 27, 2022 12:43
tannewt added a commit to tannewt/circuitpython that referenced this pull request Aug 24, 2023
…-getenv-notimplemented

8.2.x backport: throw an exception if os.getenv is used on a board without settings.t…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants