Skip to main content
Explorer
May 18, 2025
Solved

CAN normal mode is not working in STM32H563

  • May 18, 2025
  • 1 reply
  • 701 views

Hi,

 

I first worked with CAN with STM32H563 with normal mode. It worked. Later Again I tried it is not working with same code. Loop back mode is working fine. I would like to use other pins for CAN since I am using PD0 and PD1. May I know which pins are good for working with CAN. Please find the attached code and let me know if there any issues in the code.

 

Thanks & Regards,

Keerthi

    This topic has been closed for replies.
    Best answer by mƎALLEm

    How do you know that the transmit is not working? did you probe the CAN Tx pin? 

    "I have tested the same with STM32H533RET the CAN protocol, It worked fine without the external crystal oscillator."

    -> it can work but it's not recommended for Normal mode. So you need to change the source with a crystal.

    Also according to your shared code, you set the filter number to 0:

     hfdcan1.Init.StdFiltersNbr = 0;
     hfdcan1.Init.ExtFiltersNbr = 0;

    So you never receive any CAN message with the value 0.

    If you are using only Standard ID, StdFiltersNbr needs to be > 0

    If you are using only Extended ID, ExtFiltersNbr needs to be > 0

     

    1 reply

    Technical Moderator
    May 19, 2025

    Hello,

    What part of the communication "is not working"? Transmit or receive?

    What hardware are you using? a NUCLEO-H563ZI? you can use any pin supporting FDCAN function except the ones connected to something else on the hardware.

    For normal mode you need a second node connected to the CAN bus, what is the second node? does it have the same bitrate?

    What clock source are you using for the FDCAN? you need a crystal for CAN communication.

    KeerthiAuthor
    Explorer
    May 19, 2025

    Hi,

     

    Thanks for the response. 

    What part of the communication "is not working"? Transmit or receive?

    ----------I am testing both transmit and receive. But none of them is working.

    What hardware are you using? a NUCLEO-H563ZI? you can use any pin supporting FDCAN function except the ones connected to something else on the hardware

    ----------Yes, NUCLEO-H563ZI. I am using the pins supporting PB8 and PB9.

    For normal mode you need a second node connected to the CAN bus, what is the second node? does it have the same bitrate?

    -----------I have connected to PCAN view with the same bit rate and frequency.

    What clock source are you using for the FDCAN? you need a crystal for CAN communication.

    Keerthi_0-1747644700310.png

    Keerthi_1-1747644730356.png

    I have tested the same with STM32H533RET the CAN protocol, It worked fine without the external crystal oscillator.

    Keerthi_2-1747644871277.pngKeerthi_3-1747644908755.png

    I made the PLL1Q to 80MHz which is the input for the CAN protocol. 

     

    Please let me know if i have made any issues with the clock settings.

     

    Thanks,

    Keerthi

     

    mƎALLEmAnswer
    Technical Moderator
    May 19, 2025

    How do you know that the transmit is not working? did you probe the CAN Tx pin? 

    "I have tested the same with STM32H533RET the CAN protocol, It worked fine without the external crystal oscillator."

    -> it can work but it's not recommended for Normal mode. So you need to change the source with a crystal.

    Also according to your shared code, you set the filter number to 0:

     hfdcan1.Init.StdFiltersNbr = 0;
     hfdcan1.Init.ExtFiltersNbr = 0;

    So you never receive any CAN message with the value 0.

    If you are using only Standard ID, StdFiltersNbr needs to be > 0

    If you are using only Extended ID, ExtFiltersNbr needs to be > 0