2023-10-31 09:09 AM
Hello. I've a problem regarding LSE On stm32l562xx mcu. Sometimes it boots, sometimes it doesn't "90 % of time it generates timeout Error" . and it takes too much time to boot up to 4 seconds. I've tried all your sdk initializations, also tried setting lse drive to all 4 modes but nothing changes. Same behaviour and same time. Below is my initialization code and attached how we connect LSE on our board. Regards
2023-10-31 09:23 AM
Hi @as0 ,
Your configuration seems good, 110 MHz with the PLL_ON based on the MSI clock at 4 MHz.
Can you tell me where is the issue and which function fails?
Thank you
Aime
2023-10-31 09:24 AM
>>I've tried all your sdk initializations..
Perhaps it's the hardware?
Component choices, circuit topology, etc.
2023-11-01 09:24 AM
This part fails on timeout : "stm32l5xx_hal_rcc.c" line 724
2023-11-01 09:25 AM
I've attached an image of how i connect it. It doesn't seem that big deal
2023-11-02 01:51 AM
Hi @as0 ,
The failing section that you shared comes from the HAL_RCC_OscConfig() function and it seems not related to the LSE anymore.
I think that there is a miss part that you forget to mention in the code, because based on how the HAL is written you can not access to this section unless you wanted to active the LSI clock somewhere.
The line 699 check that you ask to change the LSI configuration.
/*------------------------------ LSI Configuration -------------------------*/
if (((RCC_OscInitStruct->OscillatorType) & RCC_OSCILLATORTYPE_LSI) == RCC_OSCILLATORTYPE_LSI)
{
At the line 705 the HAL check that you want to activate the LSI
/* Check the LSI State */
if (RCC_OscInitStruct->LSIState != RCC_LSI_OFF)
{
Can you confirm it?
Thanks
Aime
2023-11-03 12:20 PM
ah sorry i copied a wrong section i made a new debug session and here is the right section: Line 823
2023-11-03 01:38 PM
Yet it fails to start consistently. The component values are overlaid and unreadable. The trace lengths and load capacitance of the crystal will impact this.
What type of 32.768 KHz crystal? 6, 9 or 12pF ? What value of the capacitors?
2023-11-06 06:33 AM
it's 16 pf
2023-11-08 01:52 AM
Hi @as0 ,
The 16pF value seems a bit higher, to choose a load capacitance value you have to take into account the trace lengths which will increase the capacitance value. There is an application note which register by Microcontroller series all the recommended crystals and load capacitance values, at the table 7. Recommended crystal / MEMS resonators for the LSE oscillator in STM32 products
Please make sure that you are inline with the PCB design guidelines for improving oscillator stability.
Thanks
Aime