2024-09-28
11:50 PM
- last edited on
2024-09-30
12:18 AM
by
Maxime_MARCHETT
I am using a STM32H562RG and my project involves timing, for which I am using an external LSE crystal. I know that the STM32H562RG can adjust the LSE drive level. I used STM32CubeMX to generate the code. I noticed this code comment.
/** Configure LSE drive capability
* WARNING: Only applicable if LSE is disabled.
*/
I don't understand. What should I do? When I used STM32L431 before, there was no such code comment.
Because when I set the level to HIGH, the LSE crystal of the STM32H562RG still does not oscillate. I don't know what I am doing wrong.
This post has been translated from Chinese to comply with the ST Community guidelines.
2024-09-30 02:23 AM
I'm sorry, I sent it in Chinese by mistake. It might have been due to automatic translation on the web page. I will add two more pictures.
2024-10-08 07:01 AM - edited 2024-10-08 07:01 AM
Hello @liszt ,
This warring is displayed because in STM32H5 the driving capability must be set before enabling the LSE oscillator as mentioned in RM0481 that the.
For that, LSEDRV bit used to select the driving capability of the LSE can be written only if LSE oscillator is disabled (LSEON = 0 and LSERDY = 0)
So, this warning means that you should take care, the LSE must be disabled before select the driving capability.
This condition is not available for STM32L431 as shown in RM0394
>the LSE crystal of the STM32H562RG still does not oscillate. I don't know what I am doing wrong.
Are you update its code generation on LSE drive level without powering down/up the HW (ie. disconnect/reconnect the board)? If yes, the backup domain which control the LSE is not reset and LSE remains ON between the two tries. Please update your code as shown in below and let me know if the issue is solved or not?
HAL_PWR_EnableBkUpAccess();
CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON);
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH);
SET_BIT(RCC->BDCR, RCC_BDCR_LSEON);
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.