Crashing with Code 11

I cant figure out why when my round times out, the core keeps crashing with 11 red blinks. Theres no compiler error and Im not sure whats causing it.

void loop() {
  //wait for race to end
  if(!raceEnded) {
    //wait for all lanes to have times (this includes any empty lanes, which will timeout at 20 seconds)
    if((timeEnd1 != timeStart1 && timeEnd2 != timeStart2 && timeEnd3 != timeStart3 && timeEnd4 != timeStart4) || (millis() - startTime) > DISQUALIFIED_TIME) {

        if(timeEnd1 <= timeStart1) {
            Spark.publish("round/target1","MISS");
            
        }
        delay(50);
        if(timeEnd2 <= timeStart2) {
            Spark.publish("round/target2","MISS");
            
        }
        delay(50);
        if(timeEnd3 <= timeStart3) {
            Spark.publish("round/target3","MISS");
            
        }
        delay(50);
        if(timeEnd4 <= timeStart4) {
            Spark.publish("round/target4","MISS");
            
        }
        Serial.println("Round Finished!");

        //cleanup
        raceEnded = true; // prevents results from being displayed over and over  
        EXTI_ClearITPendingBit(EXTI_Line5); // D2 "startRace"
        NVIC_EnableIRQ(EXTI9_5_IRQn); // D2
        digitalWrite(TRIGGER_GAME_PIN, LOW); //lower trigger led
        // Enter waiting state, waiting for D2 to go low.
        Serial.println("================================");
        Serial.println("Waiting for round to start.");
    }
}

I don’t know the answer, but could you explain why you need to dive down to low-level interrupts like this? Ideally the wiring API should take care of everyone’s needs without requiring access to the hardware interface.

EDIT: some more details, SOS 11 is InvalidCase - it’s used by the low level hardware when none of the options in a case statement match. Both instances are in the cc3000 code, so it looks like the interrupt toggling is causing the system to get into an unexpected state.

If you remove those two lines I excepted above, does the problem stop?

1 Like

I think @scsc_tech started from @BDub Pinewood Derby code which used interrupts extensively. Maybe he can chime in here and give some clarity.

2 Likes

I think I am running into a strange interrupt problem. If I let the timeout occur with none of the interrupts being triggered, the “MISS” publish comes through just fine. If at least one of the interrupts is triggered and a time is published, then the others “timeout” I get the core crash with code 11. Also, I have 4 interrupts and only 3 out of the 4 will fire. I can trigger them in any sequence, but it will not register the 4th at any time.

@BDub