8000 Add rounding to Baud Rate Divisor calculation. Permits operation at … by WestfW · Pull Request #55 · arduino/ArduinoCore-sam · GitHub
[go: up one dir, main page]

Skip to content

Add rounding to Baud Rate Divisor calculation. Permits operation at … #55

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add rounding to Baud Rate Divisor calculation. Permits operation at 2…
…30400.

regression tested at standard speeds 9600, 19200, 38400, 57600, 115200...
  • Loading branch information
WestfW committed Aug 2, 2018
commit b2e81ca99e1333c61367e96bcd52fd2399216ab7
4 changes: 2 additions & 2 deletions cores/arduino/UARTClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ void UARTClass::init(const uint32_t dwBaudRate, const uint32_t modeReg)
// Configure mode
_pUart->UART_MR = modeReg;

// Configure baudrate (asynchronous, no oversampling)
_pUart->UART_BRGR = (SystemCoreClock / dwBaudRate) >> 4;
// Configure baudrate (asynchronous, no oversampling, with rounding)
_pUart->UART_BRGR = ((SystemCoreClock / dwBaudRate)+8) >> 4;

// Configure interrupts
_pUart->UART_IDR = 0xFFFFFFFF;
Expand Down
0