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

Lpuart Baud Compute Bug #172

Merged
merged 2 commits into from
Nov 1, 2024
Merged

Conversation

tprice02
Copy link
Contributor

From my understanding of the common::lpaurt::Baud::compute function, it is meant to test every oversampling rate from 8 to 32, and every modulo divisor from 1 to 8191.

The current code does not reset the modulo divisor value after comparing to an oversampling rate, leading to only one oversampling rate being tested. I've added a test that fails on the current code, but passes in the fixed code, highlighting the issue.

On a separate note, the oversampling rate is tested from 8 to 32, yet the minimum possible value is 4. I suspect that the author of the code found that sampling on both edges of the clock was unstable, or unfavorable for some reason, as this applies at oversampling rates <8. However, starting at the value of 8 limits possible baud rates to a maximum of 3MBd, while I've found higher values to be stable in communication between two Teensy 4.0s (albeit not tested with an oscilloscope). I've thus added a rudimentary fix, where the oversampling rate checking starts at a value of 4 instead of 8 when the baud rate is higher than 3MBd, however it seems simpler to always have it start at 4, so consider this and please state any concerns prior to merging.

Copy link
Member

@mciantyre mciantyre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay; I lost track of this PR. Thanks for fixing the SBR update.

[...] it seems simpler to always have it start at 4, so consider this and please state any concerns prior to merging.

I agree, but I won't have time to retest on my setups. If anyone else can show that this change works using any of the in-tree examples, I'm happy to merge it.

@mciantyre mciantyre merged commit cb1132a into imxrt-rs:main Nov 1, 2024
31 checks passed
@mciantyre
Copy link
Member

Released in 0.5.8

@tprice02 tprice02 deleted the lpuart-baud-compute-bug branch November 1, 2024 20:16
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