Cannot get 1Mbps baud rate on Arduino Mega 2560 R3?

I'm using the TX0/RX0 pins on an Arduino Mega 2560, and probing both pins with a logic analyzer. I am trying to set the baud rate to 1Mbps.

If I use Serial.begin(1000000); I expect a bit pulse to be 1us long. Instead, I am measuring bit pulses of ~8.6us, which likely corresponds to 115.2kbps.

The serial monitor is also set to 1Mbps.

How can I get 1Mbps baud rate on the TX0/RX0 pins?

Welcome to the forum

What are you outputting to Serial when you take the measurement ? Are you seeing the same pulse on both pins ?

What happens when you try the 3 other hardware UARTs of the Mega ?

Exactly the way you'd expect to.

void setup() {
   Serial.begin(1000000);
}

void loop() {
   // ASCII 'U' is 0x55, 0b01010101
   Serial.print("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU");
}

Horizontal divisions are 1uS.

Bit changes are occuring every 1uS.

1 uS bit width = 1000000 baud.

I see 2 uS period in your scope. it looks as a 500 000 baud rather than 1 Mbps

To get a 1 Mbps you need a 1 uS period (500 nS pulse).

Bit width is 1uSec. A 1 bit is 1uSec wide, a 0 bit is 1uSec wide.

Oops. I understood.
It is a periodic data like 0x01010101

Yes, I am stupid, UART doesn't need a pause between bits...

More caffeine, stat! :slightly_smiling_face: