Skip to main content
CSou.1
Associate II
November 3, 2021
Solved

FDCAN configuration on STM32U575

  • November 3, 2021
  • 1 reply
  • 2052 views

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

This topic has been closed for replies.
Best answer by CSou.1

Hello :)

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

1 reply

Technical Moderator
November 5, 2021

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"".ThanksImen"
CSou.1
CSou.1AuthorBest answer
Associate II
November 8, 2021

Hello :)

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