I am working on a prototype to be sent to New Zealand. I have created the sketch below which should not attempt to connect to the cellular network. I then use the “device restore” app to update the deviceOS to 4.0.2 and flash this firmware onto the device. This completes successfully but the device goes straight to flashing green and is not running my firmware.
#include "Particle.h"
SYSTEM_MODE(MANUAL); // This will enable user code to start executing automatically.
SYSTEM_THREAD(ENABLED); // Means my code will not be held up by Particle processes.
SerialLogHandler LogHandler(LOG_LEVEL_INFO);
const pin_t BLUE_LED = D7;
unsigned long lastBlink = 0;
void setup() {
waitFor(Serial.isConnected, 10000); // Wait for serial connection
pinMode(BLUE_LED,OUTPUT);
}
void loop() {
if (millis() - lastBlink > 1000) {
lastBlink = millis();
Log.info("Change LED state");
digitalWrite(BLUE_LED, !digitalRead(BLUE_LED));
}
}
The only thing I can suggest is to stuff a delay of some length in your code, below, so you might be able to see more of what is happening in setup() before it finishes executing.
waitFor(Serial.isConnected, 10000); // Wait for serial connection
delay(2000); // new
That is a great suggestion, I tried that and no luck.
I also put a digitalWrite in setup to turn on the LED which I could see even if the serial logging was not working. I don’t believe that my code and that is is trying to connect to cellular to complete the process initiated in device restore.
Perhaps I need to manually update the OS instead of using the device restore app.
It looks like the bootloader did not get updated when you flashed the device. The bootloader on the device is from 3.2.0, but Device OS is 4.0.2. This should have been upgraded by the Device Restore, it’s not clear why it didn’t. But that’s why the device is blinking green, it’s attempting to connect to cellular and cloud to get the bootloader update OTA.
First, thanks for showing how to diagnose this issue. I can see why the device would be trying to get the missing components and not running my user code.
I have tried re-running the device restore again (this time selecting “Tinker”, 4.0.2 and “overwrite”) but no success. I also have a second device and had the same result there.
Is there another approach such as flashing the boot loader using the CLI?
After the parts are flashed in DFU mode and it exits DFU, does it go through a sequence of blinking white, then magenta, for several seconds, before going into blinking green? That’s where the bootloader should be upgraded.
You can flash the bootloader, but it must be done using particle flash --serial with the device in listening mode.
I didn’t have a B5SoM handy, but I was able to roll back to 3.2.0, and then another Device Restore DFU to 4.0.2 did update the bootloader on the B404.
Thank you for your help on this. By downloading the binaries and flashing the deviceOS and the boot loader tor deviceOS@4.0.2 , I was able to validate that the system has all “PASS” on the particle serial inspect.
Platform: 25 - B5 SoM
Modules
Bootloader module #0 - version 1101, main location, 49152 bytes max size
Integrity: PASS
Address Range: PASS
Platform: PASS
Dependencies: PASS
System module #1 - version 4006, main location, 671744 bytes max size
Integrity: PASS
Address Range: PASS
Platform: PASS
Dependencies: PASS
Bootloader module #0 - version 1101
Radio stack module #0 - version 202
User module #2 - version 6, main location, 262144 bytes max size
UUID: D5A6C3FF6C32179FF7E577B7BE046C68EEDB5D4CAA962CDF3FD0942997432B55
Integrity: PASS
Address Range: PASS
Platform: PASS
Dependencies: PASS
System module #1 - version 3201
Radio stack module #0 - version 202, main location, 192512 bytes max size
Integrity: PASS
Address Range: PASS
Platform: PASS
Dependencies: PASS
I was then able to flash my firmware and it is running without connecting to cellular.