Uno R3 Serial stuck to 9600

Hello everybody,
i have this basic sketch running on my Arduino Uno R3:

void setup(){
Serial.begin(9600);
Serial.println("== Serial begin ==");
}

void loop() {
Serial.println(millis());
delay(1000);
}

and i receive correctly data through the Serial Monitor. As soon as i change the baud rate for example to 14400 or 115200 i receive only garbled text like "?Óÿôøðÿðôüððò", even if the Serial Monitor baudrate is set accordingly to the sketch. I need to work at 115200 because i am building a tool to monitor FM frequencies with a GPS log, so i need the full speed not to miss bytes from the FM chip or the GPS unit.
I am using Arduino 1.0.1 on OSX Lion 10.7.5, i can't figure out what i'm doing wrong.

Thanks

andrea

I routinely use 115200 on my Uno R3 with a Mac, so I don't know what is happening to you. Did you upload the revised sketch?

Thanks Nick,
what do you mean with "revised sketch": the sketch with other baud rates in Serial.begin()? If it's so, yes, i did but that's when i have the problem. Today i tried also with an Arduino Mega 2560 and the problem persists, so it's probably a problem with the arduino interface more than hardware.
I don't know where to bang my head :~

vjandrea:
so it's probably a problem with the arduino interface more than hardware.

What interface?

I mean the serial interface. I tried both the Uno and the Mega 2560 with a Win7 PC and the problem persists.
When i set the COM port baud rate to 115200 in the hardware preferences, and i broadcast from Arduino at 9600, everything works fine.
As soon as i move from that value in Serial.begin(), i.e. 14400 or 11520, i receive garbled text.

you must select the same baudrate in serial.begin (xxx ) and in the serial monitor

Thanks karlok, probably i was not clear enough: since the problem persisted, i tried using the highest rx baud rate to see if i was missing something.
So, here's my test sketch:

void setup(){
Serial.begin(9600);
Serial.println("== Serial begin ==");
}

void loop() {
Serial.println(millis());
delay(1000);
}

I upload it in my Arduino UNO on Windows 7, COM6. I open the serial monitor at 9600baud, i receive:

== Serial begin ==
0
999
1999
3000
4000
5001

When i change Serial.begin(9600) to Serial.begin(115200), upload the sketch and i change the serial monitor to 115200baud, close and reopen it, i receive
Óýóðððúôûððððððà even after resetting the board.
Thanks for your help.

vjandrea:
change the serial monitor to 115200baud, close and reopen it

This might be a stupid answer, but be sure to close the serial monitor then change the baud rate , that will automatically reboot your arduino.

Well, this happens even if upload the sketch, close completely the IDE and reopen it with the new baud rate.
I did a little progress anyway: using the 1.5beta IDE i receive correctly data at 115200 on Windows 7, i'll try again tonight on MacOSX with the new IDE.

I just tested the following:

  • in the Sketch

Serial.begin(115200);

  • and in the Serial Monitor :
9600 baud

This is how it should not be. These values have to be the same!

And the result was exactly what you posted

�Óüòúôðõøòúðáðàðððúàððäýààäàúåäàðôàðàððýàññáàäúåäÿààðôäôôðôðòýáååâàâåàäôòðôððððâçäñäòòóò

So, make sure the values are the same.

Change it in your sketch, upload it. Wait until upload finished.
Then open the serial monitor, some scrambled data will arrive, change the baud in the serial monitor, then it will purge/flush your arduino and you should see it in the right way. Otherwise it is something wrong with your PC / USB connection.

vjandrea:
I did a little progress anyway: using the 1.5beta IDE i receive correctly data at 115200 on Windows 7, i'll try again tonight on MacOSX with the new IDE.

Ok, that is good. I don't work with Win7, so there might be other issues.

That's definitely what i don't do, thanks, i was close to post a screenshot but i thought that explaining it would be enough.
As i said, i'll try tonight with my Mac 'cause with Windows and IDE 1.5beta it works correctly.

thanks for your answers

ok. good luck :slight_smile:

vjandrea:
I mean the serial interface. I tried both the Uno and the Mega 2560 with a Win7 PC and the problem persists.
When i set the COM port baud rate to 115200 in the hardware preferences, and i broadcast from Arduino at 9600, everything works fine.
As soon as i move from that value in Serial.begin(), i.e. 14400 or 11520, i receive garbled text.

I've tested quite a few Arduino and clones (including homemade ones) with 115200 and they all work in Win7 64-bit.

Are you by chance trying to use the serial port of the Arduino UNO in 2 simultaneous connections (1 to the computer and another to the external device) ? If you are, that is not gonna work.

The best for debugging serial devices is the Arduino Mega, because it has 3 serial ports. Use Serial0 for the USB connection and Serial1 or Serial2 to the other device.

Thanks to everybody who helped, the solution is to use the new IDE 1.5beta on OSX too, everything works as expected.