Skip to content

kinetis: LPUART: Compute oversampling rate at init#10320

Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom
jnohlgard:kinetis/lpuart-osr-dynamic
Dec 3, 2018
Merged

kinetis: LPUART: Compute oversampling rate at init#10320
aabadie merged 1 commit intoRIOT-OS:masterfrom
jnohlgard:kinetis/lpuart-osr-dynamic

Conversation

@jnohlgard
Copy link
Copy Markdown
Member

Contribution description

By not forcing a fixed oversampling rate we can achieve better baud rate
accuracy than otherwise possible.
For example, when requesting 115200 with a module clock of 4 MHz,
picking an oversampling rate of 17 (instead of hardware
default 16) yields 117647 baud instead of 125000 baud as the best
matching rate. Better matching baud rate between receiver and
transmitter results in a lower probability of transmission errors.

Testing procedure

Flash frdm-kw41z with a shell application
Test that the shell works correctly when using the default BAUD settings (115200)
The expected baud rate is around 117000 with this PR, 125000 without this PR. The USB to UART adapter in the dev board does handle the rate mismatch even for 125000, but there is a smaller margin for error.

Issues/PRs references

split from #7897

@jnohlgard jnohlgard added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Platform: ARM Platform: This PR/issue effects ARM-based platforms CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: cpu Area: CPU/MCU ports labels Nov 2, 2018
@jnohlgard jnohlgard added this to the Release 2019.01 milestone Nov 2, 2018
@jnohlgard jnohlgard force-pushed the kinetis/lpuart-osr-dynamic branch from 9df3f99 to e84d0b9 Compare November 5, 2018 09:36
@jnohlgard jnohlgard mentioned this pull request Nov 5, 2018
5 tasks
jnohlgard pushed a commit to jnohlgard/RIOT that referenced this pull request Nov 5, 2018
@jnohlgard jnohlgard force-pushed the kinetis/lpuart-osr-dynamic branch from e84d0b9 to d037c5e Compare November 9, 2018 07:46
@maribu maribu added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines labels Nov 12, 2018
@maribu
Copy link
Copy Markdown
Member

maribu commented Nov 12, 2018

The code looks good to me, sadly, I don't have the hardware to test it :-(

jnohlgard pushed a commit to jnohlgard/RIOT that referenced this pull request Nov 27, 2018
By not forcing a fixed oversampling rate we can achieve better baud rate
accuracy than otherwise possible.
For example, when requesting 115200 with a module clock of 4 MHz,
picking an oversampling rate of 17 (instead of hardware
default 16) yields 117647 baud instead of 125000 baud as the best
matching rate. Better matching baud rate between receiver and
transmitter results in a lower probability of transmission errors.
@jnohlgard jnohlgard force-pushed the kinetis/lpuart-osr-dynamic branch from d037c5e to 158a830 Compare November 29, 2018 13:24
jnohlgard pushed a commit to jnohlgard/RIOT that referenced this pull request Nov 29, 2018
Copy link
Copy Markdown
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Tested on frdm-kw41z. The examples/default shell works like a charm. I can't do more advanced testing than this one.

The PR was already reviewed codewise and only testing was missing.

ACK and go

@aabadie aabadie merged commit 655fdae into RIOT-OS:master Dec 3, 2018
@jnohlgard jnohlgard deleted the kinetis/lpuart-osr-dynamic branch December 3, 2018 08:20
riot-ci pushed a commit to riot-ci/RIOT that referenced this pull request Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants