2023-12-03 09:15 AM
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!
Solved! Go to Solution.
2023-12-05 09:17 AM
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.
2023-12-03 10:30 AM
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?
2023-12-04 06:41 AM
My Apologies!
Heres my CAN configuration settings:
Heres my clock settings:
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.
2023-12-04 08:36 AM
You're not showing the external clock settings
2023-12-04 11:39 AM
Hey Karl,
Is this what you mean?
also fro reference my oscillator pins:
RCC_OSC_IN: PF0
RCC_OSC_OUT: PF1
Thanks!
2023-12-04 11:46 AM - edited 2023-12-05 09:17 AM
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.
2023-12-04 11:53 AM
Sorry I should have mention its a NUCLEO-64 development board, STM32072RB to be precise.
2023-12-04 05:13 PM
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.
2023-12-04 08:20 PM
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.
2023-12-05 02:24 AM
Is this what you mean?