M524 Provisioning Behaviour

Hi,

I have built a custom commissioning tool for loading firmware onto devices, doing a simple hardware check, and then registering the device to products.

Here is the workflow

Connect via usb and device our test firmware as follows

particle flash --local m524_test.bin

The device has not yet been registered to a product. The device also does not have access to network connection as there is no service in this area, and there is also no antenna attached at this time.

The device accepts the firmware, but after rebooting, it just stays in the trying to connect mode, flashing green. But it seems like it is not yet running our firmware, as there is no output on the serial line.

The device refuses to run my application when the following is setup.

SYSTEM_MODE(AUTOMATIC);
SYSTEM_THREAD(ENABLED);

The device will run my firmware if SEMI_AUTOMATIC is used as long as I don't call Particle.connect() in the setup.

As soon as I call Particle.connect() in the setup. The MSOM stays flashing green and will not run my firmware. I assumed SYSTEM_THREAD(ENABLED); would mean that my firmware would run regardless of connection attempts.

Does anyone have any ideas here?

Thanks,
Ivan

Which DeviceOS version does your firmware target? If there is a mismatch the device will attempt to connect to Download the correct version. You can use particle update to ensure it’s running the latest, or --target to select a specific version.

Your firmware should run in that scenario. I'd enable USB serial logging in trace mode to see if there's any indication of what it's doing.

SerialLogHandler logHandler(LOG_LEVEL_TRACE);

The most common reason user firmware does not appear to run is because a blocking operation is done. For example, if you Particle.publish while trying to connect (blinking green), it will block for about 10 minutes.

The other reason use firmware really does not run is that not all Device OS dependencies were updated; this can be found using particle serial inspect.