Skip to content

Enable LSE for LPUART only if LSE is ready #2642

@MaJerle

Description

@MaJerle

In the current configuration, LSE is forced selected when baudrate <= 9600 is selected for HW Serial.
If LSE is not present UART kernel won't work.

A propose is to add a check after enabling the LSE, if the LSE is ready. Use the LL_RCC_LSE_IsReady() before changing the kernel clock of the LPUART.

if (baudrate <= 9600) {
/* Enable the clock if not already set by user */
enableClock(LSE_CLOCK);
if (obj->uart == LPUART1) {
__HAL_RCC_LPUART1_CONFIG(RCC_LPUART1CLKSOURCE_LSE);
}
#if defined(LPUART2_BASE)
if (obj->uart == LPUART2) {
__HAL_RCC_LPUART2_CONFIG(RCC_LPUART2CLKSOURCE_LSE);
}
#endif
#if defined(LPUART3_BASE)
if (obj->uart == LPUART3) {
__HAL_RCC_LPUART3_CONFIG(RCC_LPUART3CLKSOURCE_LSE);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions