cancel
Showing results for 
Search instead for 
Did you mean: 

CAN normal mode is not working in STM32H563

Keerthi
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
mƎALLEm
ST Employee

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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

 

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

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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

 

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.