Clone working where Genuine Arduino doesn't

I have had an application working for over a year now using an arduino to monitor some inputs and send the readings back to a PC over the serial port.

I am running at a board rate of 115200, but tried slowing down to 9600 with a genuine arduino and not got it working.

PC every 5 ms is sending a signal to the Arduino, which then truncates the digital inputs to a string and sends back a seriaes of 1s and 0s.

The clone is coping just fine and the PC is getting the signals back.

The genuine Arduino sends the first signal, then they start getting truncated and slow down until I am only getting a reply to around 1 request in 100.

I'f refitted the clone and got it working again, but stumped as to why a cheap Chinese clone was working and the genuine Arduino isn't. Guessing it is something to do with the CH340 and FTDI chips but I'm at a loss as to the actual cause.

PS, I know my code is flawed, I am still new to Arduinos and to programming in C, but it was and is working on a clone.

String incoming = "";
String inputs = "";
int I1 = 13;
int I2 = 14;
int I3 = 15;
int I4 = 16;
int I5 = 17;
int I6 = 18;
int I7 = 19;
int I8 = 20;
int I9 = 21;
int I10 = 2;
int I11 = 3;
int I12 = 4;
int I13 = 5;
int I14 = 6;

int In8 = 0;
int In9 = 0;

void setup() {
// put your setup code here, to run once:
pinMode(I1, INPUT_PULLUP);
pinMode(I2, INPUT_PULLUP);
pinMode(I3, INPUT_PULLUP);
pinMode(I4, INPUT_PULLUP);
pinMode(I5, INPUT_PULLUP);
pinMode(I6, INPUT_PULLUP);
pinMode(I7, INPUT_PULLUP);
pinMode(I8, INPUT_PULLUP);
pinMode(I9, INPUT_PULLUP);
pinMode(I10, INPUT_PULLUP);
pinMode(I11, INPUT_PULLUP);
pinMode(I12, INPUT_PULLUP);
pinMode(I13, INPUT_PULLUP);
pinMode(I14, INPUT_PULLUP);

Serial.setTimeout(1);
Serial.begin(115200);

}

void loop() {

delay(1);
if (Serial.available() > 0) {
incoming = Serial.readString();
incoming.toUpperCase();
incoming.trim();
}

if (incoming == "READ" ) {

if (analogRead(I8) > 200) {
In8 = 1 ;
}
else {
In8 = 0 ;
}

if (analogRead(I9) > 200) {
In9 = 1 ;
}
else {
In9 = 0 ;
}

inputs = digitalRead(I1);

inputs = inputs + digitalRead(I2) + digitalRead(I3) + digitalRead(I4) + digitalRead(I5) + digitalRead(I6) + digitalRead(I7) + In8 + In9;

inputs = inputs + digitalRead(I10) + digitalRead(I11) + digitalRead(I12) + digitalRead(I13) + digitalRead(I14);

inputs.trim();

//Serial.begin(115200);
Serial.print("IN:");
Serial.println(inputs);

}

incoming = "";

Serial.flush();

}

What board is it? Uno? Nano? Something else?

Uno uses a 16u2 programmed to act as serial adapter, while the clones use a CH340G USB-serial adapter.

Is the application closing and reopening the serial port between sends?

I'm using a nano. Both the genuine and clone have the 328p processor (Not tried with a 168p)

The VB program keeps the port open.

The Arduino sketch opens the port at startup and keeps it open. However, I have tried closing it and reopening it in the sketch between receiving data and sending data but that made no difference.

No one got any suggestions?

I can't explain why you have a problem with the Uno and not with tge Nano @9600. It might be variation in 'crystal'.

The 1 millisecond timeout is at the edge of the time that it takes to transfer a single character @ 9600. So it might be that a character is still being transferred and the timeout kicks in.

Try with a longer timeout. Next look for Robin2's "updated serial input basics" thread and get some ideas.for proper implementation of serial communication.

Lastly read the "how to use this forum" threads and learn to post code properly using code tags, not quote tags.