comments about Fractional parts in the baudrate generator

This commit is contained in:
iceman1001 2019-05-18 17:57:30 +02:00
parent fb7ac7b0ea
commit d3d98282ac

View file

@ -222,9 +222,20 @@ void usart_init(uint32_t baudrate, uint8_t parity) {
// all interrupts disabled // all interrupts disabled
pUS1->US_IDR = 0xFFFF; pUS1->US_IDR = 0xFFFF;
// http://ww1.microchip.com/downloads/en/DeviceDoc/doc6175.pdf
// note that for very large baudrates, error is not neglectible: // note that for very large baudrates, error is not neglectible:
// b921600 => 8.6% // b921600 => 8.6%
// b1382400 => 8.6% // b1382400 => 8.6%
// FP, Fractional Part (Datasheet p402, Supported in AT91SAM512 / 256) (31.6.1.3)
// FP = 0 disabled;
// FP = 1-7 Baudrate resolution,
// CD, Clock divider,
// sync == 0 , (async?)
// OVER = 0, -no
// baudrate == selected clock/16/CD
// OVER = 1, -yes we are oversampling
// baudrate == selected clock/8/CD --> this is ours
//
pUS1->US_BRGR = 48000000 / (usart_baudrate << 3); pUS1->US_BRGR = 48000000 / (usart_baudrate << 3);
// Write the Timeguard Register // Write the Timeguard Register