Hard fault in manual system mode [Solved]

I’m tryout the manual system mode, and whenever I call connect it immediately goes to the blinking red hard fault mode. Any ideas? Here’s the code:

SYSTEM_MODE(MANUAL);

int i;
   
void setup() {
    Serial.begin(9600);
    while (!Serial.available()) ;

}

void loop() {
    if (Spark.connected() == false) {
        Spark.connect();
        Spark.process();
    }
    for (i=0; i<=4; i++) {
        Serial.println(i);
        delay(1000);
    }
    Spark.process();
}

I think I’m having the same problem. I tried semi-auto mode in my project and got flashing red. I ran your code and got flashing red also. Then I tried running the semi-auto example code straight from the blog post and had some really strange things happen. To start with I got breathing green when it connected. It showed up as being online with spark list, but I couldn’t flash anything to it from the web IDE. Then I happened to try clearing the WiFi credentials so it went into listening mode when it tried to connect. After I sent it the credentials again, I got breathing blue and it did the same thing as the breathing green. Even after I reset the Core, it was still breathing blue.

Ok. Found the cause of the SOS issue.
It was the immediate call to Spark.process() after Spark.connect(). Please remove the process() call within the if(){ } and it should work.
I’m going to add a check for the cloud socket in Spark.process() to prevent this bug in future firmware release.
Thanks for pointing out the issue.

Fix over here: https://github.com/spark/core-firmware/commit/cd0a99db152fba7c8ff2ef6d30f6f10e897eecba

1 Like