Unable to Leave Listening Mode on BoronLTE

boron
Tags: #<Tag:0x00007f038fe35488>

#1

Hello,

I’ve been struggling with getting my BoronLTE to exit listening mode when SYSTEM_MODE(MANUAL)
BoronLTE has been flashed with hybrid-0.8.0-rc.27-boron.bin

/***************************************************************************************************************************/
#include <Particle.h>

/ The "manual" mode puts the device's connectivity completely in the user's control
SYSTEM_MODE(MANUAL);
// enabling multi-threaded mode
SYSTEM_THREAD(ENABLED);

void cellular(){
    Cellular.on();
    // starts flashing blue at this point, indicating listening mode 
    Cellular.listen(false);
    Cellular.setActiveSim(INTERNAL_SIM);
    Cellular.connect(); // attempt cellular connection using default particle apn and internal-sim
    while(Cellular.connecting()){
        // connecting
    }
}

void setup(){
cellular();
}

void loop(){
} 
/***************************************************************************************************************************/

BoronLTE stays in listening mode (flashing blue) unless I press mode for 3 seconds.
Any help is appreciated.


#2

There is a setup done flag on mesh devices. Until setup is complete, you won’t leave listening mode. Normally, if you set up your device using the mobile apps the done flag will be set and you’ll leave listening mode.

You can flash this program to your device to clear the flag, after which you can put your normal firmware back on the device.

Also, you do not need to set the active SIM each time; the setting is saved in flash memory.

#include "Particle.h"

#include "dct.h"

SYSTEM_MODE(SEMI_AUTOMATIC);

void setup() {
    // This clears the setup done flag on brand new devices so it won't stay in listening mode
    const uint8_t val = 0x01;
    dct_write_app_data(&val, DCT_SETUP_DONE_OFFSET, 1);

    // This is just so you know the operation is complete
    pinMode(D7, OUTPUT);
    digitalWrite(D7, HIGH);
}

void loop() {
}

#3

Thank you @rickkas7! This helped me.

I had an Argon that was would always default to listening mode after I had re-flashed firmware and tinker. I could get it to connect to the cloud if I held down the Reset button for 3 seconds, but for some reason it wouldn’t auto-reconnect after flashing or powering off/on.

However, in SEMI_AUTOMATIC mode, I found that the device would turn WiFi off and would not attempt to connect to the cloud anymore. (To others who find this thread read here to learn about System Modes.)

I used this:

#include "Particle.h"
#include "dct.h"
SYSTEM_MODE(AUTOMATIC); // <-- Note use of AUTOMATIC mode!

void setup() {
    // This clears the setup done flag on brand new devices so it won't stay in listening mode
    const uint8_t val = 0x01;
    dct_write_app_data(&val, DCT_SETUP_DONE_OFFSET, 1);
}

void loop() {
}

FWIW, rather than using the above as a standalone script, I found I could incorporate your code into my sketches and just comment it out after clearing the setup flag.

HTH!


#4

Can this not be also achieved in the similar way that you can access the DCT of the electron or photon using a dfu-util command? Is there an equivalent for the Argon/Xenon/Boron?