2025-03-28 4:09 AM - last edited on 2025-03-28 4:13 AM by mƎALLEm
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
2025-03-28 4:26 AM - edited 2025-03-28 8:48 AM
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:
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).
2025-03-28 4:26 AM
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
}