Running firmware without claiming the device

I have a situation in wich I need to be able to run firmware on the Argon without going through the out of box claiming and network registration process… Is there a method to force the firmware to run without set up?

JJ

While it’s not a good idea to have an unclaimed device for the pick of anybody passing, you can do that.

You’d just need to set the “SETUP_DONE” bit (see code below) and provide the WiFi credentials.

#include "Particle.h"
#include "dct.h"

SYSTEM_MODE(SEMI_AUTOMATIC);
void setup() {
    const uint8_t val = 0x01;
    dct_write_app_data(&val, DCT_SETUP_DONE_OFFSET, 1);
    pinMode(D7, OUTPUT);
    digitalWrite(D7, HIGH);
    Particle.connect();
}

Once that’s done you can flash whatever code you want.

4 Likes

We’ve tried that. The Argon still comes up in listening mode.

What we’re trying to do is perform a simple self test of the peripherals we’ve attached to our Argon - the Argon is not connected to WiFi at this time. I missed that part in my initial question. So, the test environment is:
Argon has not gone through set up process
Argon is not claimed
No WiFi connection is present
What I’ve found is that setting the setup done bit on a ‘fresh’ Argon does not take the Argon out of listening mode.
If I use the Particle App to set up the Argon and pair it to my phone but don’t connect to WiFi I can run my test, but I can’t get the Argon back into listening mode, unless I do a factory reset and flash Tinker onto the Argon.
I’m guessing that thee’s more data in the DCT structure that needs to be changes. Any ideas?

Judging by what you said above I guess you have not done that then, right?

If you intend to not ever use WiFi you won't need to either, but you mustnot call Particle.connect() at the end of the code I provided.

As said, that's probably due to the fact that Listening Mode is also forced by the WiFi module when there are no credentials stored but a connection attempt is made.

How have you tried?

I’m not calling particle connect in the test code. Our plan is to run the self test, and then perform the claiming and WiFi configuration at our final configuration step… At that point the Argon will replace the selftest code with the production code via OTA (The selftest will try to connect to Paricle if there are credential, and if WiFi is connected.

I’ve tried factory reset - if the self test code is on the Argon (even with the DCT write removed) it stubbornly runs, instead of going in to setup. I’m in semi_automatic mode - would manual be a better choice?

Edit: The mode button will also put the device back into listening mode