cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with the RCC LSE STM32L496RET6 MCU.

RAkma
Associate II

Hello! I use CubeMX to generate the init code for rcc whith LSE Crystal NX3215SA-32.768KHZ-EXS00A-MU00525 (32.768K,6PF), two 2.7pF capacitors and rtc module. Program goes to error handler after "if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)"-stroke. And if configure it with LSI, all works perfectly. And it works with LSE on STM32L496ZGT6U MCU(NUCLEO-L496ZG) with the same CubeMX configurations. I'm using Atollic Truestudio and there is no stm32l4re mcu. So i use stm32l4rg and configure .ld file for flash size. Am I right? What problem is here? I attached 2 projects here. LSE_NucleoL4 is working project for NUCLEO-L496ZG, RET6_1 is not-working project for STM32L496RET6.

6 REPLIES 6

Try to use a longer timeout for the LSE startup.

You can also try to change the LSE drive strength.

I don't Cube.

JW

But is your external clock actually starting and oscillating? Pipe it to the MCO pin (if supported) and probe it there.

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

I tried a longer startup time, but it i'snt work still. I cannot use pipe to MCO pin because it stops in the rcc initialization.

Your options would be to make sure it doesn't dump into an Error_Handler() or while(1) loop. Or work directly on the RCC_BDCR to enable the LSE and test it's readiness there.

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

> it stops in the rcc initialization.

Then don't use the pre-chewed "library" functions. You don't need to change any other clock to try to run the LSE.

> I tried a longer startup time, but it i'snt work still.

Quantify. Or, even better, wait infinitely for the experiment. The 32kHz oscillators may take a surprisingly long time to start up, especially on well-designed boards (this may sound surprising, but the fact is that crystal oscillators start up by picking up noise). Tens of seconds are not abnormal.

And, as I've said above, try to play with the LSE drive (see RCC_BDCR.LSEDRV, if there is such in your STM32 model).

And, of course, double-check your connections, both for correctness and also for bad solder joints.

JW

AlaaM
Associate III

I had the exact same problem. The solution is to configure RCC_LSEDRIVE to be high.

If you use cubemx:

Configuration > RCC > LSE Drive Capability > LSE oscillator high drive capability

If you don't use cubemx, add these lines in main.c in SystemClock_Config() just after the variables declarations:

/**Configure LSE Drive Capability*/
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH);