cancel
Showing results for 
Search instead for 
Did you mean: 

Enable FDCAN_IT_ARB_PROTOCOL_ERROR

MFrie.7
Associate II

Hello
I use CAN FD and have a functioning communication with 3 participants. Now I want to activate the interrupt that notifies me when the device has lost the arbitration contest.

I forward each of the four NVIC interrupts in stm32h7xx_hal_fdcan:

void FDCAN2_IT0_IRQHandler(void)
{
HAL_FDCAN_IRQHandler(&hfdcan2);
}
When initializing CAN, I activate the interrupt:
retVal = HAL_FDCAN_ActivateNotification(m_Fdcan2Handle, FDCAN_IT_ARB_PROTOCOL_ERROR, 0);

and set the CallbackHandle beforehand:
retVal = HAL_FDCAN_RegisterTxEventFifoCallback(m_Fdcan2Handle, MyCallback);
SYSM_ASSERT_STOP(retVal == HAL_OK, retVal);
retVal = HAL_FDCAN_RegisterErrorStatusCallback(m_Fdcan2Handle, MyCallback);
SYSM_ASSERT_STOP(retVal == HAL_OK, retVal);
retVal = HAL_FDCAN_RegisterTxBufferAbortCallback(m_Fdcan2Handle, MyCallback);
SYSM_ASSERT_STOP(retVal == HAL_OK, retVal);
retVal = HAL_FDCAN_RegisterTxEventFifoCallback(m_Fdcan2Handle, MyCallback);
SYSM_ASSERT_STOP(retVal == HAL_OK, retVal);

Despite arbitration collisions, I do not end up in my callback “MyCallback”.

What have I overlooked?

Best regards

2 REPLIES 2
mƎALLEm
ST Employee

Hello,

First, please use </> button to share your code. See this link. (I've edited your post).

Second, according to the description of the PEA bit it might be not intended to signal a lost of arbitration but to signal a protocol error that occurred during the arbitration phase:

mALLEm_0-1743160958725.png

I may ask internally and get back to you as soon as I have an answer. Internal ticket 206406 has been submitted (not accessible by the community users).

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om
ST Employee

Hello @MFrie.7 

For better debugging, please ensure that the return value retVal is equal to HAL_OK when calling the HAL functions.

 retVal = HAL_FDCAN_ActivateNotification(m_Fdcan2Handle, FDCAN_IT_ARB_PROTOCOL_ERROR, 0);
 if (retVal != HAL_OK)
 {
 // Error handler
 }

 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar