I’m trying to flash some of my electron via OTA (system-part1/2, app) but it is a real pain:
- Flashing is only possible within first seconds after electron comes online
- Flashing fails in 9 out of 10 tries (system-part1/2 seems to be really bad, app works every third time)
The devices are connected thru a 3rd party M2M sim and have very good signal (RSSI: -60 and more).
I tried to push an completely empty app (just setting the required credentials) to ensure that my app doesn’t disturb the upgrade. No success.
What es can be wrong with my setup? Is there any way to “debug” the F/W update process?
Are you using the Particle.keepAlive() function with your 3rd party SIM?
I would try setting to a very low value (30 seconds) and see if OTA flashing works. If it does, then try to increase it until it stops working. The value should be between 30 seconds and several minutes for most SIM cards.
The reason is that cloud-to-device transmission works by sending UDP packets from the cloud to the Electron. There is a mapping set up on the carrier’s network to make this possible. Since it uses up the carrier’s resources to keep this mapping active, they turn off the ones they believe to be idle and no longer used. The Particle SIMs have a really long idle timeout, 23 minutes, and that’s the default on the Electron. Most SIM cards are at most several minutes, and can be as low as 30 seconds.
Also, you can try putting the Electron in safe mode (breathing magenta) before flashing. Hold down RESET and MODE, release RESET, and hold down MODE until the main status LED blinks magenta. Release and wait for it to go through the normal startup cycle of and finally breathing magenta before doing the flash. This is useful because it eliminates your code as a source of OTA flashing problems. Using too many system resources or failing to service the cloud fast enough in your code can affect OTA flashing. This is merely a debugging technique; it’s usually fairly easy to make your code compatible with OTA flash; this technique is just to find out if you need to do that.
Note for safe mode on Electrons with 3rd party SIM cards: This will only work if you’re previously run a program that sets the APN, either your code or Tinker with your 3rd party APN and have not powered down the Electron. The APN setting is not stored in configuration flash, but it is stored in the modem, and resetting or going into safe mode does not completely reset the modem, so the APN setting will stick around for a little while.
Particle.keepAlive(30); solved the issue, now updates (and others) go over the air like a charm!
Unfortunately one of my devices is now out there and pretty unresponsive I hope the batter won’t last long and it will reset during the night otherwise I will have a nice travel tomorrow
Thank you again!!
Glad you were able to get the issued solved @joky. Thanks Rick for the help!