2025-05-18 5:56 AM - last edited on 2025-05-19 1:40 AM by mƎALLEm
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
Solved! Go to Solution.
2025-05-19 2:23 AM - edited 2025-05-19 2:24 AM
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
2025-05-19 1:39 AM
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.
2025-05-19 1:57 AM
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.
I have tested the same with STM32H533RET the CAN protocol, It worked fine without the external crystal oscillator.
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
2025-05-19 2:23 AM - edited 2025-05-19 2:24 AM
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
2025-05-20 12:16 AM - edited 2025-05-20 12:57 AM
Hi,
As you told, I tested the board stm32H533RE Nucleo board with the external crystal of 24MHz. I configured the CAN peripheral to 80 MHz and checked with PCAN view. It worked successfully. I can able to send and receive the data. But when I configured the clock peripheral to 150 MHz, I could not see the data in the PCAN view. (Please Note: Both are configured to 500Kbps with prescalar and Time segments).My question if I configure my clock frequency to 150MHz, Will the classical CAN works. Thank you for your support. May i know where can i find the example project for stm32h533RE or any links might be helpful
2025-05-20 1:19 AM
Hello,
If you succeeded with the transmit and receive I invite you to close the thread by accepting the reply that answered or at least guided you to the solution. For the new question regarding the new clock config I invite you to open a new thread.
Thank you.