In one of the library examples of the MPU-6050 RAW sketch, i'm quoting part of the code which is confusing to me. I'm wondering how the 8 MHz or 16 MHz was obtained from 38400 serial baud rate.
// initialize serial communication // 38400 chosen because it works as well at 8MHz as it does at 16MHz Serial.begin(38400);
From my understanding, the 38400 means that data is transmitted over serial port at a rate of 38400 bps.
And i assume that the reason that the developer mentioned 8 MHz and 16 MHz, is due to the different Arduino boards featuring the ATmega168/ATmega328P working at those 2 different frequencies. I am using an Arduino UNO R3.
What's the calculation or method to obtain or relate it to a working frequency of 8 MHz or 16 MHz from 38400 bps?
I know that, frequency = 1 / Time period or the number of cycles per second. So, 38400 bps would mean a frequency of 38400 Hz?
When Serial.begin is set to 38400, is that a constant rate of 38400 bps or is that a maximum rate of 38400 bps?
How is the ideal serial speed chosen? Should it be relative to the MCU speed?