Why can't flash over cloud


#1

I have two identical particle electron boards both using same 3rd party sim card and loaded with device os 1.0.1.
They all work just fine connecting to server however one of them is not able to flash over cloud while the other one has no issue with that.

I tried flash using particle CLI on visual studio code by pressing ctrl+shift+P then chose Particle: Cloud flash

I did change the name of the target for each board by ctrl+shift+P then Particle: Configure Project for Device .

Is there anything I have to look at?


#2

Are both Electrons also running the exact same application firmware?
If not, you should have a look at the currently running code of the misbehaving device - failing OTA updates are often caused be user application code.


#3

Try to add this in setup (only when using 3rd party sim) : Particle.keepAlive(30);

https://docs.particle.io/reference/device-os/firmware/electron/#particle-keepalive-


#4

I added Particle.connect() and Particle.keepAlive(…) at setup() and this seems to get the device into OTA mode (Board led showing magenta on and off)

“EVENT” in Particle console shows “spark/flash/status” as “started” however
my CLI console says
" attempting to flash firmware to your device XXXXX
Flash device failed: Request Timed Out"

Now the board is not finishing the update as the board led keep showing magenta on and off.


#5

If the response is a time out, it could quite literally be it’s taking too long to transmit the packets for an update. This can happen when there’s poor connectivity and a lot of packet re transmissions are going on.

If the Electrons are side by side, I’d see about swapping antennas to see if that makes any difference.

It may not hurt to go as far as attempting to use cloud debug on both units for some side by side comparison of connection quality.


#6

First of all the device can’t get into safe mode by pressing MODE button for certain period of time. It just keep running what is uploaded to the board.
If I upload tinker by “particle flash --usb tinker” by putting it into DFU mode, then I can put the board into safe mode or listening mode i.e. board’s blue led is blinking.
Then I can upload firmware through cloud just fine.

The only problem now is that the board not being able to cloud upload while it is running my application.
Looking at my server logs, the application works as expected.


#7

If you weren’t able to enter any other modes with the buttons before flashing Tinker, it sounds like your application code has some blocking behavior in it.

It sounds like there may be some similar behavior where the device isn’t entering a state that it can accept OTA updates. Something in your application code might be causing blocking behavior. It may be helpful to review your application code on this.


#8

@mstanley
Unfortunately, the code I am working is proprietary and cannot share the entire code here.
FYI, it incorporates with at least 4 serial ports using Serial, Serial1, Serial4 and Serial5
Sounds like many but I don’t believe there is any special code intended to block OTA.
Do you think following lines of code in main introduce this kind of behavior?

STARTUP(cellular_credentials_set("TM", "", "", NULL));
SYSTEM_THREAD(ENABLED);

Some other boards which could not be flashed over cloud with normal build and upload procedure, at least can be flashed directly with compiled bin file.