Hi!
I don’t really know how to explain what is happening to my core because it makes no sense for me. I hope someone can figure out what could be happening
I’ve been developing a Spark Core app and in order to debug the code I connected the core to my PC via Serial Port .
bool DEBUG_SERIAL = true;
if(DEBUG_SERIAL) Serial.print("\r\n\r\nERROR......\r\n\r\n");
And every time I use a Serial instruction I put this initial ‘if’ to disable all Serial communication at once.
In addition, I’ve put the following code in the setup() part to start Serial communication when I press a key.
if(DEBUG_SERIAL) {
Serial.begin(115200);
while (!Serial.available()) {
SPARK_WLAN_Loop();
}
}
Here comes the nonsense: when DEBUG_SERIAL is true , everything works PERFECT, but when is false the core crashes with hard fault (RGB RED flashing one time) and behaves very strangely (sometimes crashes at one point of the code, sometimes at another, with not a clear pattern).
I also tried to set DEBUG_SERIAL to true but change the while (!Serial.available())
with a delay of 4 seconds so that the code executes itself without me having to press a key, then perhaps works better but it also crashes at some point with no sense.
I know I am not giving much information but I have no idea what could it be.
Thank you guys.