On my worksheet, with baudRate=9600, CELLGET fails (returns 0 or 2) after some time (100-400seconds after start), goes back to sending the right values, but eventually Excel crashes (can occur at 300-600 seconds after start).
I already added delay(200) before CELLGET, dind't solved, and other delay(200) before CELLSET, it keeps senging wrong values and eventually crashing (before 200s).
Thenk I tried to ""force"" reading the right values.
delay(200); //supposed to, but didn't solve the wrong values
Serial.println("CELL,GET,FROMSHEET,Control,AV,20"); //read AV20
valAD20 = Serial.readStringUntil(10).toFloat(); //(yes, valAD20 was declared as double before setup())
//verify if it was correctly read
while (setpoint == 0 || setpoint == 2) { //because 0 and 2 are wrong values that appear for me
Serial.println("Wrong read, read again until get it right!");
delay(300); //even bigger delay
Serial.println("CELL,GET,FROMSHEET,PainelControle,AV,20");
valAD20= Serial.readStringUntil(10).toFloat();
Serial.println("PAUSELOGGING");
Serial.println("SAVEWORKBOOKAS,ReadWrongValAD20");
Serial.println("RESUMELOGGING");
}
This generates a CORRUPTED .xlsm (ReadWrongValAD20.xlsm), so I deleted the lines to create a new .xlsm. So the code is:
delay(200); //supposed to, but didn't solve the wrong values
Serial.println("CELL,GET,FROMSHEET,Control,AV,20"); //read AV20
valAD20 = Serial.readStringUntil(10).toFloat(); //(yes, valAD20 was declared as double before setup())
//verify if it was correctly read
while (setpoint == 0 || setpoint == 2) { //because 0 and 2 are wrong values that appear for me
Serial.println("Wrong read, read again until get it right!");
delay(300); //even bigger delay
Serial.println("CELL,GET,FROMSHEET,PainelControle,AV,20");
valAD20= Serial.readStringUntil(10).toFloat();
}
========
WEIRD=> I disconnected PLX-DAQ and Excel crashed while it was disconnected. Maybe it isn't PLX-DAQ?
But it keeps crashing after ~150s.
Sometimes, after long running, this error occurs: it """"forgets""" to jump to row above and inserted the values on the next cells on the same row.
It also crashes somewhere 100-600s, like in this video.
===========
CORRECTION - Decreasing baudRate to 2400 really improved stability (26min running with no Excel crashes). However, mistakes still occured eventually on sending values to Excel.
And decreasing baudRate made the rows sent go from 1s period to 4-6 period.... Wish I could have stability + fast frequency :S. Where to change buffer size? Here? (Picture sent)

"DirectDebugWindow it would imply and issue within Excel - most likely due to too many cells being used. That would be a pity but I guess hard to solve :-/"
The error was present in DirectDebugWindow. It was a PID() library value (ATune_RunTim(), which is 0 if running autotune and 1 if completed). So it wasn't from CELLGET....
26min running
=====UPDATE
@SASv
I saw you got sucess on running at baudRate 115200.
SASv:
........
6. 10 trials at 115200 baud with 100 msec delays before the CELL,GET and CELL,GET,FROMSHEET commands: 0 complete successes!
Update: If tdelay is changed from byte to integer
Result: 10/10 complete successes
.....
Sorry, what? "tdelay changed from byte to integer", what do you mean?
SASv:
........
Finally, another clue to the puzzle might be what I observed in a program I am developing. The code involves 9600 baud communication and has several GETs and SETs in the infinite loop. After several iterations there is a final GET and SET (the infinite loop "ends" with a very long delay). The last SET failed until I increased the delay before it to 500 msec. At that time some of the loop GETs and SETs had 100 msec delays. However, when I decreased them to 3 msec, the final SET again failed. To return to success I had to increase its delay to 800 msec. So there seems to be a cummulative effect from prior GETs and SETs.
FURTHER UPDATE: Increasing the stop bits to 2 (Serial.begin(baudRate,SERIAL_8N2); ) might help a bit. It is no solution, but it seems to increase the frequency of correct results.
.....
I missed this answer on the long post! I'll try it and update here about my results!