[riot-notifications] [RIOT-OS/RIOT] kinetis: LPUART: Compute oversampling rate at init (#10320)

Joakim NohlgÄrd notifications at github.com
Fri Nov 2 16:23:15 CET 2018

The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.

### 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 
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * kinetis: LPUART: Compute oversampling rate at init

-- File Changes --

    M cpu/kinetis/periph/uart.c (31)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20181102/3bdc7524/attachment.html>

More information about the notifications mailing list