Electron won't go into listening mode

I am using the SEMI-AUTOMATIC mode to delay connecting to the cellular network unless something has changed. In so doing, I managed to prevent my Electron from entering the listening mode so I can upload new software. When I reset it and hold down the listening mode button, it flashes white and then goes to sleep. It won’t go into listening mode unless it is triggered to start the cellular connection which makes if difficult to program.

I can get it into DFU mode but not sure how that would help me. How to I get it into listening mode?

Here is some of my code.

void setup() {
Serial.begin(9600);
Serial.printf("%s (%s)\n", PROG_NAME, REVISION);

Time.zone(-7);

// hardware setup
pinMode(G_LED_PIN, OUTPUT); digitalWrite(G_LED_PIN, LOW);
pinMode(R_LED_PIN, OUTPUT); digitalWrite(R_LED_PIN, LOW);
flashLED(RED, true);
pinMode(DS18_DATA, OUTPUT); digitalWrite(DS18_DATA, LOW);

// read historic data
EEPROM.get(lastPubTimeAddr, lastPubTime);
EEPROM.get(lastTempAddr, lastTemp);
EEPROM.get(setTempAddr, setTemp);

// read temperature and publish results
if (readTemp()) {
    Serial.printf("Temp: %0.2f\n", temp);
    // timestamp
    ts = Time.now();
    
    // check if this is a new dataset or already checking data every 4 minutes
    if (ts >= (lastPubTime + NEW_DATASET_TIME)) {
        initState = 1;
        setTemp = MIN_REPORT_TEMP;
    }
    
    // check if the temperature is above the minimum and above the current report level
    if ((temp >= MIN_REPORT_TEMP) && (temp >= setTemp)) {
        risingTemp = 1;
        reportNow = true;
    } else if ((temp >= MIN_REPORT_TEMP) && (temp < setTemp - SET_TEMP_STEP)) {
        risingTemp = 0;
        reportNow = true;
    }
    
    // set a new set temperature level
    if (reportNow) {
        setTemp = ((int)(temp/SET_TEMP_STEP) + 1) * SET_TEMP_STEP;
        Serial.printf("New setTemp: %d\n", setTemp);

        // start cellular and cloud connection
        Particle.connect();
        if (!(waitFor(Particle.connected, CONNECT_TIME*60))) {
            // no connection available
            Serial.println("No cellular connection available");
            goToSleep();    
        }
        
        // successful cellular connection
        flashLED(RED, false);
        ledOn(GREEN);
    
        //Particle.keepAlive(PARTICLE_KEEPALIVE);
        Blynk.begin(blynkAuth, BLYNK_IP);

        // report data
        formatResults();
        particlePublishData();
        blynkPublishData();
    }
    
    saveData();
}

goToSleep();
}

void loop() {
}

You can trigger Listening and DFU Mode via USB too.
Just by setting the host baudrate to 14400 or 28800 will activate these modes.

With Windows you’d do something like

mode COM3 14400

Another way to get into Listening Mode is to first put the device into Safe Mode which does activate the radio module and then enter LM the usual way.

  1. so I can update using “particle flash” while in DFU mode if the baud rate is 14400 or 28800?

  2. how do I put the electron into safe mode. I don’t see that mode in the documentation.

Which documentation did you look for it?

https://docs.particle.io/guide/getting-started/modes/electron/#safe-mode

Nope, I said

This means when you set these baudrates from the host side, the device will enter the respective mode and from there you can do whatever that mode is meant for.
For DFU Mode this includes particle flash --usb <binary>.

1 Like

Thanks. I got the electron into safe mode and could then get it into listening mode. I must have missed that mode in the documentation the first time.

2 Likes