KurtE
Senior Member+
I am another forum participant who has done some work on these areas.I don't expect PJRC to invest time in research here, but another forum participant may want to question it.
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:
Code:
void loop() {
// put your main code here, to run repeatedly:
[COLOR="#FF0000"]int[/COLOR]incommingbyte;
delay(1000);
Serial1.clear(); // UART-Eingangspuffer sicher leeren
Serial1.print(F("start\r")); // start
Serial1.flush();
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
[COLOR="#FF0000"] while ((incommingbyte = Serial1.read()) != -1) { // UART-Eingangspuffer auslesen bis <CR>
[/COLOR] 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
}