Skip to main content
NDorn.1
Associate II
June 21, 2021
Question

Clock configuration using CubeIDE

  • June 21, 2021
  • 5 replies
  • 1760 views

Hi,

i have a simple question: how do i have to configurate the clock of my STM32F072RB to send or receive CAN-Messages with 500kBit/s. With 8MHz it seems to work only until 250kBit/s.

Best regards

This topic has been closed for replies.

5 replies

Javier1
Principal
June 21, 2021

Show us some pictures.

>With 8MHz it seems to work

You meant youre using an external HSE Xtal of 8Mhz as your clock source?

hit me up in https://www.linkedin.com/in/javiermuñoz/
NDorn.1
NDorn.1Author
Associate II
June 21, 2021

Hi,

thx for the fast answer. Im using the internal clock (HSI). I want to receive a CAN-signal simulated by a PCAN. Im changing the Parameters as i have (prescaler, Timesegments etc.). The same in the PCAN-configuration. It is working until a Baudrate of 250kBits/s. With 500kBits/s im not getting a signal. 0693W00000BbWCHQA3.png0693W00000BbW93QAF.png0693W00000BbWBiQAN.png

Javier1
Principal
June 21, 2021

@NDorn.1​ The internal 8Mhz clock is not accurate enough for fast comms (fast canbus or usb), try the HSI48 as source clock, it would work better if accuracy is the problem.

How long is your canbus wire?

DO you have an external XTAL available?

hit me up in https://www.linkedin.com/in/javiermuñoz/
NDorn.1
NDorn.1Author
Associate II
June 21, 2021

ah ok good to know. Im new to setting up a CAN-communikation. I tried the HSI48 now but its still not working. Which output is for the CAN-Bus of them you can see in the clockconfig? I can see I2C, USART or USB for example.

my wire is not even 1m long. That shouldnt be a problem with higher frequencys in my mind.

Because im using a STM32f072RB-Nucleo board i have 2 external oscillators available. That should be the HSE and LSE.

Javier1
Principal
June 21, 2021

Try to use the HSE, if still doesnt work i would try to modify the Time quanta bits to a more even values like 8 and 7

hit me up in https://www.linkedin.com/in/javiermuñoz/