Quote Originally Posted by larry_berlin View Post
I don't expect PJRC to invest time in research here, but another forum participant may want to question it.
I am another forum participant who has done some work on these areas.

But again hard to know what to go on here. So can really only throw a few darts and hope one may hit the target.

Things like:
a) Are you running out of RAM and your Heap and stack collide. So in some places like this I do some quick and dirty tests like check where the heap has been allocated to:
Example in SDFat: return reinterpret_cast<char*>(sbrk(0));
Plus maybe in function I suspect I grab address of a stack variable in function and print out both and see how close are we... Other times I may fill in all of the area that can be used for stack with known values and then someplace have code that walks the stack back from where the heap is down to first place that does not have our known value, to get idea of how far the stack has expanded...

b) What happens if you don't use the string objects, but instead use a character array? Personally I always avoid the string objects

c) On one processor maybe a few years ago, I had issue where SerialX.avaialable() did not appear to work... So I changed the code to something like:

void loop() {
  // put your main code here, to run repeatedly:
  Serial1.clear();                               // UART-Eingangspuffer sicher leeren
  Serial1.print(F("start\r"));                   // start

  digitalWrite(LED_BUILTIN, HIGH);                // show we expect input
  delay(6000);                                    // time to type on terminal max. 20 char
  digitalWrite(LED_BUILTIN, LOW);                 // input window ends

  inputbuffer = "";                              // Eingabestring auf init
    while ((incommingbyte  = Serial1.read()) != -1) {      // UART-Eingangspuffer auslesen bis <CR>
      if (incommingbyte != '\r')  {
        inputbuffer += incommingbyte;     // Puffer aufbauen
        if (inputbuffer.length() > 20) { break; }  // Endlosschleife und Überlauf abfangen
      else { break; }                              // aufhören wenn wenn <CR> erreicht ist

  if (inputbuffer.length() > 0) {
    Serial.println(inputbuffer);              // give recieved string to serial monitor

  delay(6000);                             // wait for next try
I don't remember ch circumstances I ran into back then and on what... But just in case you might try something like this.