cancel
Showing results for 
Search instead for 
Did you mean: 

CAN working on when using internal clock source but not externale clock source?

Oli98
Associate II

Hi there,

When setting up my CAN bus using the cube mx generator tool, I found that switching from using an external clock source for my CAN peripheral to the intrenal one (HSI48) to be exact my CAN comms began to work.

Im not sure as to why this is possible as I though th extenal crystal were more accurate than the internal ones?

Any help shedding light on the situation would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions

So why are you setting in the Cube Clock Tree Diagram to 32 MHz?? The HSE source from the ST-LINK/V2-1 MCO pin is 8 MHz

Make sure HSE_VALUE in the stm32xyz_hal_conf.h also reflects the clock source.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

17 REPLIES 17

Not details on the clock itself or the board..

Is this a NUCLEO board, fed via ST-LINK 8 MHz MCO source,or something else.

Crystal source should be more stable and on-frequency. Can you put it on a frequency meter and measure? How much off-frequency?

What settings on bus, prescaler, SJW, BS0, BS1, etc.

Is the CAN source device on-frequency?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Oli98
Associate II

My Apologies!

Heres my CAN configuration settings:

Oli98_0-1701700809812.png

Heres my clock settings:

Oli98_1-1701700849263.png

Any help would be gretaly appreciated as I thought the extrenal clocks should be much more accurate however I can only get my CAN to work using the internal clock sources.

 

You're not showing the external clock settings

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.

Hey Karl,

Is this what you mean?

Oli98_0-1701718658671.png

also fro reference my oscillator pins:

RCC_OSC_IN: PF0

RCC_OSC_OUT: PF1

 

Thanks!

So a custom board?

32 MHz, show the part# and circuit. It can be off-frequency if incorrectly loaded.

Perhaps plumb the HSE out out the PA8 (MCO) and measure the frequency on a meter or scope.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Sorry I should have mention its a NUCLEO-64 development board, STM32072RB to be precise.

No, your post of images is that of HSI settings which does no good when your main issue is with HSE not working. So post the HSE setup.

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.
Tinnagit
Senior II

you should set clock to be HSE which it's 32MHz and it's difference from HSI 48MHz so You should adjust HSE by PLL to be 48MHz and use it as main clock.

It's should work fine.

Oli98_0-1701771832001.png

Is this what you mean?