I have an Arduino UNO running the following example sketch to test serial communications. I notice when testing that regardless of the baud rate I set within the Arduino IDE the serial monitor will display the message correctly.
void setup() {
Serial.begin(921600); // open the serial port at 9600 bps:
}
void loop() {
Serial.println("Hello World"); // carriage return after the last label
delay(1000);
}
I would have expected the characters to be scrambled if the board rate of the serial monitor did not match that within the sketch. Would someone help me understand why this is not the case?
For USB CDC serial ports (e.g. Serial on the Leonardo), Serial.begin() is irrelevant. You can use any baud rate and configuration for serial communication with these ports.
The R4 Minima is a USB CDC serial port. As such, the baud rate is irrelevant. You can verify this by looking in cores/arduino/usb/SerialUSB.cpp for yourself and seeing:
void _SerialUSB::begin(unsigned long baud) {
(void) baud; //ignored
if (_running) {
return;
}
_running = true;
}