Skip to main content
isca-dim
Associate II
December 6, 2022
Solved

CAN BUS INTERRUPTS - HAL_CAN_RxFifo0MsgPendingCallback never triggers / I never get the Rx Interrupt.

  • December 6, 2022
  • 1 reply
  • 7370 views

Hello,

My setup is as follows: I have an STM32F469I MCU connected (via SN65HVD230 CAN Board) to the CAN bus of an STM32MP157c-EV1 MPU board which is running Debian.

My goal is to make the MCU send CAN frames periodically to the MPU, and with the CAN Utils on the MPU to receive and transmit to the MCU (candump and cansend).

With the code I am attaching, I am able to transmit from the MCU and receive (candump) in the MPU, but when I transmit (cansend) from MPU to MCU the Rx Interrupt never seems to trigger (I have enabled CAN RX0 and CAN RX1 interrupts in the .ioc, as well as activated notifications in the code).

Is something wrong with the code or is my logic flawed? Why does the interrupt never trigger?

This topic has been closed for replies.
Best answer by TManiac

Sometimes are little things with big issue. ;)

sFilterConfig.FilterActivation = DISABLE;

If you want to enable the Filter you must do it. You don't want to DISABLE it.

Other question:

Why do you call the Error_Handler() function on successful reception?

Toggle a LED will be better. Or use breakpoints.

The 300ms Delay is also a bad idea.

1 reply

TManiac
Associate II
December 6, 2022

The filter configuration on the bxCAN slave (aka CAN2) is a little bit tricky.

The filter banks are for both controller bxCAN Master and Slave. So the handle on function HAL_CAN_ConfigFilter() will be ignored.

You must select a "FilterBank" higher than the "SlaveStartFilterBank"

This means:

sFilterConfig.SlaveStartFilterBank = 14; 
/* all filter banks above this number will be trigger the slave Rx interrupt */
 
sFilterConfig.FilterBank = 14; /* or higher */

isca-dim
isca-dimAuthor
Associate II
December 7, 2022

Thanks for the reply but i still get the same behavior :\

Also tried with an identical board and nothing. It's definitely something in the code or maybe in can-utils of linux?

TManiac
TManiacBest answer
Associate II
December 8, 2022

Sometimes are little things with big issue. ;)

sFilterConfig.FilterActivation = DISABLE;

If you want to enable the Filter you must do it. You don't want to DISABLE it.

Other question:

Why do you call the Error_Handler() function on successful reception?

Toggle a LED will be better. Or use breakpoints.

The 300ms Delay is also a bad idea.