I am using Arduino Due to have serial communication with a device which takes command in Hex format and immediately sends response.But i encountered a problem where the loop enters serial2.available() even when there were no data available.So i wrote a small test program for Serial2 to test.Below is my code.
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial2.begin(115200);
}
void loop(){
if (Serial2.available()){
Serial.write("test");
}
}
So when i run my above program i see "test" is printed again and again even when there is no data available in serial2 port.Am i missing something?