Skip to content

Conversation

oflebbe
Copy link
Contributor

@oflebbe oflebbe commented Oct 6, 2025

Because of integer overflows incorrect factors are calculated for baudrates which are a bit larger than integer multiples of 4194304.
For example for baudrates of 8_400_000 or 58_800_000. Fixed the same way in newer versions of the pico SDK.

…audrate

Incorrect factors are calculated for baudrates which are a bit
larger than integer multiples of 4194304.
For example for baudrates of 8_400_000 or 58_800_000.
Fixed the same way in newer versions of the RPI SDK.
@aykevl aykevl merged commit 3be7100 into tinygo-org:dev Oct 9, 2025
18 of 19 checks passed
@aykevl
Copy link
Member

aykevl commented Oct 9, 2025

Thank you! This looks like a good idea to me.

(There might be more efficient ways of doing this, such as dividing some of these numbers by a power of two to avoid the overflow, but this shouldn't be performance sensitive anyway. Also, 64-bit multiplies are going to be decently fast on the RP2350 with the Cortex-M33).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants