Reading UBRR0 after Serial.begin not complies with Atmel data sheet

I am confused seeing the value of the UBRR0 register after Serial.begin(baudrate). The Serial monitor/plotter works fine but no matter what baudrate I select, the values are twice as much as given in Atmel doc8161, table 19-12 or calculated manually.
Example (UNO 328/MEGA2560) F_CPU = 16,000,000 Hz
baudrate 9600: UBRR0 should be 103, actually is set to 207
baudrate 115200: UBRR0 should be 8, actually is set to 16.
When I replace the SERIAL class (which consumes a huge buffer) by a class I wrote myself using the values calculated by the values/formula listed in the Atmel data sheet, it works fine.
Can somebody explain how and why SERIAL class uses doubled values?

The arduino code also sets the U2X bit, which doubles the bit rate at a given ubrr setting.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.