4
0
Fork
You've already forked libopencm3
3

Fix: STM32 common USART: extend usart_get_baudrate() working range for LPUART #6

Merged
ALTracer merged 1 commit from fix/lpuart-get-baudrate into main 2024年08月24日 03:20:46 +02:00
ALTracer commented 2024年08月22日 06:34:26 +02:00 (Migrated from github.com)
Copy link

This is a follow-up to blackmagic-debug/libopencm3#5.

The existing implementation would work for LSE-clocked LPUART at e.g. 9600 baud, but would overflow the calculation for lpuart_ker_ck above 2**24 Hz (16.7 MHz).
Use a smarter div-mod approach, like in set_baudrate, recommended by @zyp (asking review).

Please test correctness on hardware. Now it should work for e.g. 64MHz G071 (or G4, or H7). I don't have a unit test or a firmware test project, but I have some boards.

This is a follow-up to blackmagic-debug/libopencm3#5. The existing implementation would work for LSE-clocked LPUART at e.g. 9600 baud, but would overflow the calculation for `lpuart_ker_ck` above 2**24 Hz (16.7 MHz). Use a smarter div-mod approach, like in set_baudrate, recommended by @zyp (asking review). Please test correctness on hardware. Now it should work for e.g. 64MHz G071 (or G4, or H7). I don't have a unit test or a firmware test project, but I have some boards.
dragonmux left a comment
Copy link

Pending having it tested as correct and working, this LGTM. Thank you for the contribution!

Pending having it tested as correct and working, this LGTM. Thank you for the contribution!

Show working on Discord. Proceeding.

Show working on Discord. Proceeding.
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
blackmagic-debug/libopencm3!6
Reference in a new issue
blackmagic-debug/libopencm3
No description provided.
Delete branch "fix/lpuart-get-baudrate"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?