cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] I have problems sending CAN (Controller area network) messages with my STM32F7 DISCO board when HCLK is higher than 140 MHz (the break point migh be above 144 MHz). What could be wrong?

YObre.1
Associate

What am I trying to do?

I'm trying to send CAN messages on a 500 kbit/s bus with a STMF769I-DISCO. At the same time I'm trying to have a screen running LVGL (v8.0.0) on which is dependent on having the HCLK higher than 200 MHz. Lower clock speeds causes "tearing issues " on the screen(see picture). When the HCLK is too high for some reason I can only read ERROR FRAMES on the CAN bus with a KVASER USB (CAN monitoring device). When the HCLK is lower than around 140 MHz I'm able to send CAN messages.

What have I tried?

  • I have tried different HCLK settings and it seems like when the HCLK speed is above about 140 MHz I'm not able to send messages.

  • I have also tried different APB1 peripheral clock speeds and that does not seem to do any difference for me.

  • I have tried having the SYSCLK at 200 MHz and having the HCLK at 100 MHz but that causes "tearing issues" on the display.

  • The CAN transciever used is MCP2551 and is fed by the F7 with 5V. I have tried powering the F7 from my laptop aswell as a 1A typical phone charger.

  • I have only tried CAN1 on the disco-board. I don't think it is possible to use CAN2 or CAN3 on the disco-board. Correct me if I'm wrong.

Other

It's the first time I work with MCUs and the porting of LVGL has been done by another person so I don't really know how it works in detail.

Question

Does anybody have tips on what I can do or read? The best would be that I can keep HCLK above 200MHz and get CAN working at the same time.

I'm happy to provide additional information.

0693W00000KdkDiQAJ.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
YObre.1
Associate

Thanks!

I've already done all of the above. Not really in that order though.

I've solved the problem now.

The clock I was using for the system clock was the internal high speed clock, HSI. The problem seems to be that the internal high speed clock becomes unprecise at higher frequencies which I think causes the CAN message to have the wrong format / corrupted.

SOLUTION: I changed the system clock source to the external crystal clock (HSE) and with a bit of fiddeling with settings to get desired settings, it is now working correctly.

View solution in original post

2 REPLIES 2
Piranha
Chief II

Don't do everything at the same time. Get and MCU with a blinky working reliably at desired frequencies. Then the CAN. Then the display.

Wrong core voltage levels and FLASH latency, missing or wrong memory barriers and cache management and just overall broken code are the most probable reasons.

YObre.1
Associate

Thanks!

I've already done all of the above. Not really in that order though.

I've solved the problem now.

The clock I was using for the system clock was the internal high speed clock, HSI. The problem seems to be that the internal high speed clock becomes unprecise at higher frequencies which I think causes the CAN message to have the wrong format / corrupted.

SOLUTION: I changed the system clock source to the external crystal clock (HSE) and with a bit of fiddeling with settings to get desired settings, it is now working correctly.