Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Gabriele Bellini
#56212 Been working for a while with Arduino and ESP8266, I'm going crazy with a portion of code which is giving me the Exception (3) at runtime. Checked the code different times, without finding where the problem could be. Portion of the code is this (I don't want to annoy with all the code, only portion that I think could be useful):

Code: Select allString getMessage(String toHost, JsonObject& body) {
  StaticJsonBuffer<1024> jsonBuffer1;
  ...
  ...
  ...
  String httpBody;
  root2.printTo(httpBody);
  Serial.print(F("[DEBUG] Message: "));
  Serial.println(httpBody);
  return httpBody;
}


The problem is that
Code: Select allSerial.println(httpBody);
is printing the expected string generated by the function, but if I write, from main program:
Code: Select allSerial.println(getMessage(host, body)

the Exception(3) error is occurring after returning back from getMessage function. The
Code: Select allSerial.println(httpBody);
is returning on serial port the right string, so I can't imagine why the error is occurring only when returning the String to the main program. Any hints on this problem? Maybe the solution is simpler than I could imagine... please, help me!
User avatar
By mrburnette
#56242
Code: Select allTable 4–64. Exception Causes
...
3 LoadStoreErrorCause Processor internal physical address or data error
during load or store [Exception Option]
<...>


My guess is an boundary condition, likely an array index.
Just for grins, try reordering your code. Maybe a few diagnostic prints prior to the offending function to show the true string length ...