I am just working on a custom provisioning tool for setup and testing of new devices.
What I would like to do:
Assuming I have no cellular service. I would like to flash a precompiled b5_test.bin to a device. This is running some firmware that will allow us to check some functionality on the device.
Do I need to have activated a sim prior to completing this step?
What happens if I flash the b5_test.bin file to a fresh device, where the .bin file was compiled to 6.1.1, whereas the device could be running an older firmware?
After testing the firmware, we would then add the device to a product, which will cause the device to activate the sim and eventually pull the latest product firmware, which is different to the b5_test.bin file.
What I am currently experiencing is that the devices, after I have pushed the b5_test.bin file, are just stuck trying to connect to the internet (as there is no cell coverage), this is expected, but the device does not seem to be running the b5_test.bin file.
If you flash a .bin that targets a version of Device OS older than what's on the device, the device will always connect to cellular and the Internet to get Device OS, bootloader, and other necessary files OTA.
There are a few solutions to this:
Tools like Web Device Doctor flash all necessary parts by USB from a browser.
You can target an old version of Device OS from your troubleshooting firmware. As long as it's the same or older than the oldest version you expect to find on your device it will work. It will also work if the device has a new version of Device OS.
Flash the necessary dependencies using particle flash --local or flash application and Device OS from Workbench over USB.
Connect via usb and flash our test firmware as follows
particle flash --local b5_test.bin
Now this b5_test.bin is compiled with device OS 6.1.1. I am not sure what device OS the fresh device shipped with but I assume it is an older version than 6.1.1.
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.
After trying lots of things to remedy, it seemed like adding it to a product via particle product device add exxxxxxxf 919xx cause the device to be able to run the firmware.
Questions
Does the device require cloud connection or sim activation, prior to being able to run our test firmware?
When I flash our test code, OS v 6.1.1 to the fresh device using particle flash --local b5_test.bin does that also upgrade the device OS if the BSOM cannot connect to the network?
What system threading and system mode settings are you using in your test firmware? It it's not specified (or non-threaded AUTOMATIC) then you won't see log messages until cloud connected. Your firmware won't run, either. You should always use SYSTEM_THREAD(ENABLED) for this reason.
It should be able to run your test firmware after particle flash --local. After flashing but before connecting, use particle serial inspect or the device inspect web tool to make sure all of the dependencies were set.