Go Down

Topic: Receive Serial Communication Baudrate 230400 Error (Read 546 times) previous topic - next topic

cepis

Hi Everyone,


This is the interfacing between PC and Arduino Uno 

PC ------serial com-------- Arduino Uno


The code:

String b = "Received Data : ";

String a = "";



void setup(){

   Serial.begin(230400);

  Serial.println("Ready...");

}



void loop() {
  a = Serial.readString();

  Serial.print(b);

  Serial.println(a);

  delay(1000);  

}


When baudrate lower than 230400, communication is ok.
But when using baudrate 230400, arduino get invalid data from PC, but oke when sending data to PC.

example when PC sending string ABCD to Arduino

the result should be:

Ready...
Received Data : ABCD

but the result is invalid:

Ready...
Received Data : A~ *




Why this happened?









Robin2

If you look at the Atmega 328 datasheet you will see that it has substantial timing errors at some baud rates and not at others. 250000 and 500000 baud work without error.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

cepis


Go Up