Issue with 921600 baud rate on MacOS

Hi All,

I have the following example sketch running on my Arduino Nano connected to my M1 MacBook Air.

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

void loop() {

  Serial.println("Hello World");        // carriage return after the last label
  delay(1000);
}

When opening the Serial Monitor within the Arduino IDE, and setting the baud rate to match the sketch (921600) I get random characters appear.

However if I use a lower baud rate to say 115200, everything works as expected. Is this potentially bug in the IDE?

Try baud rates of 250k, 500k and 1000k.

I can confirm that the top baud rate of 2000000 works. Potentially it just the 921600 baud?

Unfortunately In my specific project this specific baud rate is important as was are interfacing with a device where this is the rate and it can't be changed.

It's not only on a Mac; running Windows shows the same symptoms

  1. It works properly with 912600 on an original Uno with 16U2.
  2. It does not work on a SparkFun RedBoard with FT232 (similar ot original Nano).
  3. It does not work properly with a clone Nano with CH340.

All three boards work properly at 1000000 baud.

I suspect that the generated baudrate deviates too much from the 921600 for the receiving serial-to-usb converter (CH340 or FT232) to be able to synchronise on the incoming signal.

Have you tried "trial & error"ing around the "theoretical" baud rate?

Simple test program; it sets the baudrate to 921600 first and saves the UBRR register.
Next it sets the baudrate to 1000000 (so you can see prints) and prints some results

void setup()
{
  // start serial at 921000
  Serial.begin(921600);
  // and get the UBRR value
  uint32_t ubrr = UBRR0;

  // restart serial at 1000000
  Serial.begin(1000000);

  // print UBRR for 921600
  Serial.print(F("921600 UBRR = "));
  Serial.println(ubrr);

  // print UBRR for 1000000
  Serial.print(F("1000000 UBRR = "));
  Serial.println(UBRR0);
}

void loop()
{
}

You will find that the UBBR value is the same for both baud rates and hence the 328P is transmitting on 1 Mbaud when 921600 is selected.

From the 328P datasheet the baud rate calculation

There is a little more to it (U2X) but for these baud rates it will be 1.

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