Skip to content

Need smarter logic for selecting UART prescaler on STM32 #264

Open
@multiplemonomials

Description

@multiplemonomials

Currently the logic for selecting the UART prescaler is very simple. This should be made a lot smarter -- I believe we want to select the smallest prescaler such that (UART source clock freq) / (prescaler) <= (baudrate) * 4096. As for how to determine the UART clock source frequency, see UART_SetConfig() in the HAL. Also see UARTPrescTable as a way to map prescaler bitfield values to numbers.

Until this is done, using low baudrates on STM32 can cause problems -- e.g. if LPUART is clocked by HSI on STM32H7, and there is no LSE oscillator, the lowest baudrate that can be used is 15625 baud!

Metadata

Metadata

Assignees

No one assigned

    Labels

    STMicroOnly affects STMicro targetsTaskNot a bug per se, just something that needs to be done

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions