cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to receive CAN interrupt on STM32F0 when send data from STM32f4 to STM32f0 hardware.

schou
Associate II

Greetings to all,

I want to send and receive the data via CAN between STM32F4 and STM32f0. But when I send the data from STM32F4 to STM32F0 I cannot get the interrupt at F0 end. I have tried to communicate between F0 and F0 that works fine I can receive the interrupt and send the data. Also when communicating between F4 and F4 that also works. But when communicating between F4 and F0 I cannnot get the receive interrupt at F0 end. Below are the configurations of F0.

schou_0-1719207081227.pngschou_1-1719207127138.png

I am unable to understand why do I cannot get the interrupt.

 

 

12 REPLIES 12
SofLit
ST Employee

Hello @schou ,

You need to provide more than that as information.

Need to share the two projects of F4 and F0 including their ioc files.

Are you sure about the bitrate i.e. the two MCUs having the same CAN bitrate?

What is the system clock source of F4 and F0? 

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.

Kindly check the shared ioc files.

As you said I have checked the bitrate it seems to be right.

Hello,

Cheking your ioc files, I noticed that from F0 side you selected HSI48 as a clock source for the system clock which is not recommended for CAN communication. You need to use HSE with an external precise clock source such as a crystal (like you did for F4).

Which board you are using for STM32F042? NUCLEO-F042K6?

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.

The STM32F042/STM32F072 were designed to work with the HSI 48MHz oscillator. Looking at an old CAN analyzer project of mine for the CANable device using an STM32F042, change your clock settings to 48MHz instead of 42MHz. 

 

KarlYamashita_0-1719269687206.png

 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

The STM32F042/STM32F072 were designed to work with the HSI 48MHz oscillator. Looking at an old CAN analyzer project of mine for the CANable device using an STM32F042

 

Yes they are designed to work with HSI but it doesn't imply it's the correct source of the CAN peripheral. If it's working for some reasons this doesn't imply we can generalize it. ST doesn't recommend this configuration as the frequency of the RC sources maybe impacted by temperature/voltage/reflow effects/ mechanical effects etc.. therefore impacts the performance of the 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.

I am using "F042K6T6" MCU. 

As you told I have added a crystal for precise clock source. But still I am unable to communicate. 

I have checked that both the ioc have same baudrate.

But both have different "Time Quantum".

 

Now I don't seen any issue in the ioc file.

Could you please hare your schematics of both F4 and F0? and how you did connect both nodes on the bus?

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.

Remains one point to check, from F0 side could you please set PA11 (CAN_RX) in No pull-up/pull-down?

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.

Have changed the clock settings to 48 MHz. But still the same.

CAN_HSE.JPG