Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need smarter logic for selecting UART prescaler on STM32 #264

Open
multiplemonomials opened this issue Mar 30, 2024 · 0 comments
Open

Need smarter logic for selecting UART prescaler on STM32 #264

multiplemonomials opened this issue Mar 30, 2024 · 0 comments
Labels
STMicro Only affects STMicro targets Task Not a bug per se, just something that needs to be done

Comments

@multiplemonomials
Copy link
Collaborator

multiplemonomials commented Mar 30, 2024

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!

@multiplemonomials multiplemonomials added STMicro Only affects STMicro targets Task Not a bug per se, just something that needs to be done labels Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STMicro Only affects STMicro targets Task Not a bug per se, just something that needs to be done
Projects
None yet
Development

No branches or pull requests

1 participant