Setting Arduino at 1Mhz cause wrong Serial communication

Hi to all,

I'm working on the CLKPR register to change my Arduino Nano clock speed at run-time, I tested different values, from the standard 16Mhz (CLKPR = 0) to 125Khz (CLKPR = 8), after any speed changing I tested the Serial communication, to adjust the speed difference I started the Serial using the following code:

  Serial.begin(57600 * correctionRate); // "correctionRate" is proportionally inversed to the clock divider

Using this workaround I'm able to continue to use the Serial communication until 4Mhz speed (CLKPR = 0x2), reducing the clock speed (from 2Mhz and less) this fix stop to works, and on the Serial monitor start to appears only strange chars.

But for my project (very Low Power project), I need to can use Serial, and Clock at 1Mhz (CLKPR = 4).

Any help is really appreciated! :wink:

You can't get 57600 baud with 1mhz system clock. Take a look at this tool: WormFood's AVR Baud Rate Calculator Ver. 2.1.1 , it shows you how close to the baud rate you can get with different system clocks. UX2 is used on Arduino - so at 4mhz, notice how 57600 is in orange, meaning it is on the edge of working. At 1mhz, it's out of the question; 14.4 is a maybe, 9600 is safe.

You need to use lower baud rate, or higher system clock.

DrAzzy:
You can't get 57600 baud with 1mhz system clock. Take a look at this tool: WormFood's AVR Baud Rate Calculator Ver. 2.1.1 , it shows you how close to the baud rate you can get with different system clocks. UX2 is used on Arduino - so at 4mhz, notice how 57600 is in orange, meaning it is on the edge of working. At 1mhz, it's out of the question; 14.4 is a maybe, 9600 is safe.

You need to use lower baud rate, or higher system clock.

Thank a lot my friend! :slight_smile:
Solved using "1200 * 16 bauds" (the first that really works) at 1Mhz of clock speed! :slight_smile: