[SOLVED] Flashing via Particle Dev & CLI fails

I’m having trouble getting Particle Dev and CLI to flash to my Photon. The application is basically unchanged. However, I did upgrade both MacOS to 10.11.4 as well as Xcode earlier this week. I’m wondering if it’s a side effect of those changes. In addition, the Photon seems to be in the breathing green mode much of the time.

What’s interesting is that I can apparently compile and flash via Build

[Toms-MacBook-Pro:Backups/Particle/YSI] tom% particle flash 28003e000847343232363230
photon_firmware_1458743990368.bin Including:
photon_firmware_1458743990368.bin
attempting to flash firmware to your device 28003e000847343232363230
Flash device failed
[object Object]

If your device is breathing green a lot OTA flashing won’t work - no matter what tool.
You need your device breathing cyan or magenta (Safe Mode) in order to OTA flash.
Or put it into DFU Mode and use

particle flash --usb firmware.bin

or in Listening Mode

particle flash --serial firmware.bin

Usually when your device is breathing green then it has been told by your code to do so - e.g. via WiFi.connect() without Particle.connect() in non-AUTOMATIC SYSTEM_MODE.

I put it into safe mode to flash Tinker via USB for some testing.

When I power the device up, it flashes green for about 25-30 seconds. It then rapidly flashes green for a few seconds before breathing cyan. After a while, it breathes green and then will later breath cyan.

Even when it’s breathing cyan, I can’t seem to flash new firmware except via USB.

Where can I find instructions for refreshing the operating system for the Photon?

If you mean the system firmware, then particle update would do that for you.
But even in breathing cyan you can starve the cloud task of processing time. As long as you service the cloud once every 10sec the device stays in breathing cyan but it won’t respond to OTA flashes correctly.

For reliable OTA flashing you’d need to service the cloud task as often as possible but at least more than once per second, either by dropping out of loop() or calling Particle.process().
On the other hand, using SYSTEM_THREAD(ENABLED) might reduce the risk of being unresponsive, but with “bad” user code you can still interfere with OTAing.

Another odd thing is that when I do flash, the LED turns magenta for about 5 seconds, then goes off for about 5 seconds and repeats this process about 4 times before finally booting up (with the extended blinking green – 30 seconds) before breathing cyan.

I did add some calls to Particle.process() which seems to have helped. Based upon your feedback, I did find what might have been a long running loop that could have been causing the problems. Thanks!

1 Like

This might be indicating that your device was still running old system firmware and the OTA flash cured this by auto-updating your device.

  1. magenta recognized wrong version
  2. & 3. magenta system part1 & 2
  3. magenta actual flash of your app

Thank you for your insight … and patience! This forum is extremely helpful due to folks like you!

2 Likes