cancel
Showing results for 
Search instead for 
Did you mean: 

Problem at STM32L452 with LSE Clock

Martin Blank
Associate II

I am using CubeMX to set up the peripherals in STM32L452. But if I enable the LSE Clock and this is not working, the HAL_RCC_OscConfig is coming back with error timeout and it has not activated other clocks also. So the system is not running and it is not clear what caused the error, even the error can not displayed because other parts of the system are not running due to missing clocks.

The HAL Functions should be corrected, so only the not working clock is reported back and all others are started normally.

5 REPLIES 5

LSE may not start because of hardware error, incorrect crystal/capacitors combination, or simply because it takes surprisingly lots of time for LSE to start up (several seconds) and the timeout used in Cube may be too short.

Output the LSE onto MCO and observe if it starts to oscillate. Note that the LSE circuit is very low power and touching it by oscilloscope probe may influence it or even prevent if from starting/oscillating.

Try to tweak the oscillator drive level, if it's adjustable in your model of STM32 (read the RCC chapter in RM).

Review AN2867.

JW

Martin Blank
Associate II

You are right, I can get into this. I also can get it running with the emulator. But the main problem is when having the system finished and going to mass production, there should be a way to start up the system and then showing the person who does the setup what is wrong so he/she can find easily the error.

And my main issue was to show that there are some hints to be improved in HAL code and CubeMX so the system can be started even if there is a hardware fault. (Of course with errors and I will have to have this errors made visible to the user.

I have seen AN2867.

MB

Can't you simply call HAL_RCC_OscConfig () in a loop, without requiring the offending clocks to be switched on, in subsequent iterations?

I don't use Cube/HAL.

JW

Martin Blank
Associate II

Yes of course I could do, but this will break my CubeMX settings, and if I regenerate Code using CubeMX my changes would be gone. That's why I want to have the responsible persons for CubeMX / HAL to know this issue so they maybe can improve it.

I do not know if I am right for this in the community, but if not, where should I send this thing to?

Regards

MB

> Yes of course I could do, but this will break my CubeMX settings,

Why? Isn't HAL_RCC_OscConfig() something you can call from your code?

> I do not know if I am right for this in the community

This is a primarily user driven forum, with casual ST presence.

This sort of things would probably be ideal to put into the Wishlist thread - but there's no such this year, yet.

JW

@Amel NASRI​ 

@Camilo LEMOS​ 

@brk​