Hello,
I try to use the bxCAN module on STM32F407. I have a board sending CAN messages and a board receiving CAN messages. All is working fine in bloking mode with call to HAL_CAN_Receive function.
But I have troubles using non bloking mode with HAL_CAN_Receive_IT function.
Here is my main loop:
for (;;) { halRes = HAL_CAN_Receive_IT(&s_hPxbCan, 0); if(HAL_OK == halRes) { halRes = HAL_OK; } else { halRes = HAL_OK; } while(0 == fifo_0); fifo_0= 0; halRes = HAL_OK; }
Here is my callback:
void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan) { HAL_StatusTypeDef halRes; static uint8_t nbRxCplt = 0; nbRxCplt++; if (CAN1->RF0R & CAN_RF0R_FMP0) { fifo_0++; } if (CAN1->RF1R & CAN_RF1R_FMP1) { fifo_1++; } }
My problem is that when the board 1 send a CAN message, the callback HAL_CAN_RxCpltCallback is called in loop instead of only once !
Maybe an interrupt flag is still active? I was expected that the HAL_CAN library was handeling this automatically.
Thank you BR Pierre