cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN configuration on STM32U575

CSou.1
Associate II

I need to use FDCAN to send CAN messages. Since I want to receive each message (without filters) I do this :

sFilterConfig.IdType = FDCAN_STANDARD_ID;
sFilterConfig.FilterIndex = 0;
sFilterConfig.FilterType = FDCAN_FILTER_DUAL;
sFilterConfig.FilterConfig = FDCAN_FILTER_DISABLE;
sFilterConfig.FilterID1 = 0;
sFilterConfig.FilterID2 = 0;
 
if (HAL_FDCAN_ConfigFilter(&hfdcan1, &sFilterConfig) != HAL_OK)
{
     return CO_ERROR_HAL;
}
else
{
    // nothing to do
}
 
if (HAL_FDCAN_ConfigGlobalFilter(&hfdcan1, FDCAN_ACCEPT_IN_RX_FIFO0, FDCAN_ACCEPT_IN_RX_FIFO0, FDCAN_FILTER_REMOTE, FDCAN_FILTER_REMOTE) != HAL_OK)
{
     return CO_ERROR_HAL;
}
else
{
    // nothing to do
}

Next, I want to activate callback for every new messages, so I do this:

HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_RX_FIFO0_NEW_MESSAGE |FDCAN_IT_RX_FIFO1_NEW_MESSAGE,  0)

But when there is a new message neither HAL_FDCAN_RxFifo0Callback nor HAL_FDCAN_RxFifo1Callback is called.

So my answer is: how can I activate callback ?

EDIT : It works, my mistake was elsewhere

1 ACCEPTED SOLUTION

Accepted Solutions

Hello :)

It works, with this configuration I can send and receive CAN messages, with callback.

View solution in original post

2 REPLIES 2
Imen.D
ST Employee

Hello @CSou.1​ and welcome to the Community :)

Please share your solution here, so that more Community members can benefit from this post.

Thanks

Imen

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

Hello :)

It works, with this configuration I can send and receive CAN messages, with callback.