AVOID factory reset - What to do with unexpected LED behavior on a Photon

Hey everyone!

TL;DR - If in doubt use Safe Mode rather than a factory reset to avoid potentially bricking your device.

Just wanted to bring to your attention a problem that has been affecting a small number of users after unboxing their Photon.

If your Photon is behaving erratically or in an unexpected way, DO NOT perform a factory reset. Instead, please update your firmware to the latest 0.4.3 release. If you perform a factory reset before upgrading to that version of firmware, the Photon can become stuck in a never-ending startup/reset loop due to some corrupted data in memory.

A factory reset is seldom required with the Photon, since we now have Safe Mode, which is quicker to perform and has a much nicer colored LED :slight_smile:

10 Likes

Out of curiosity, I’m assuming that the only way to get out of that loop is with JTAG? And does the 0.4.3 firmware fix this issue?

That’s correct. Using JTAG to reset the DCT area will fix the problem. Yes, 0.4.2 and later fixes the issue.

For anyone curious about the technical details of the problem:

  • the device configuration table (DCT) holds WiFi crednetials and system flags. It is stored in a pair of 16Kbyte flash pages at 0x8004000 and 0x8008000

  • we are seeing occasionally bits set to 0 in an area that should otherwise be clear (0xFF)

  • the WICED DCT code only erases a flash page by looking at a small header. If the header is clean then it doesn’t erase the page, even when the page contains some 0 bits that should be reset to 1 with a page erase.

  • When writing to the DCT, data is written in chunks, and the DCT code in WICED reads back the chunk to verify it. Since there were some 0 bits already in the page, the written contents will always have 0 bits there, even if the intended value was a 1. This is due to how flash works. The data read back doesn’t match the data expected so the write function fails and the subsequent blocks of configuration data isn’t saved.

  • In short, the majority of the DCT becomes unmodifiable - frozen in it’s current state.

  • During a factory reset, a flag is set to indicate to the reset of the system to perform a factory reset. If the DCT becomes unmodifiable then, it’s not possible to reset the flag, and the device enters a continual factory reset loop.

The fix present in 0.4.2 and later is to alter the WICED DCT code to inspect the entire flash page to determine if it needs erasing. This ensures the page data is written as intended, and the full DCT page written without error.

3 Likes

Was this causing the issue with my Photon that we discussed here:

If the photon works and connects to the internet will it automatically apply the firmware upgrade ?

Maybe you should tell how to do a “factory reset”, and how to do a “safe mode” - because I read somewhere to push a button for 3 seconds to reset something, but I have no idea if this is a “factory reset” or a “safe mode” or something else.

There is no point telling us not to do something, if none of us know what that “something” is: is this anything we could do by accident? how are we supposed to not to do it, if you don’t tell us what “it” is? I also saw mention of “DFU” mode somewhere - is this another different thing, or are people using different terms to mean the same thing?

2 Likes

http://docs.particle.io/photon/modes/#photon-modes-selecting-various-modes

3 Likes

OK - so I found this out too late. My photon was working fine earlier in the week, and then tonight when I went to try to actually do something with it (BBQ thermometer project) it wouldn’t connect to the iOS tinker app, but I could send code via OTA updates. I tried everything on my phone first and when that didn’t work, I tried all the reset option through factory reset. It was still working with OTA code uploads after that, but then I went to try to do a firmware update. It loads part1 fine, but when part2 finishes, I get:

dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x08060000, size = 151192
Download	[=========================] 100%       151192 bytes
Download done.
File downloaded successfully
dfu-util: Error during download get_status

And then the photon resets and goes into flashing magenta. Now I can’t do OTA code pushes or claim the device via the tinker app.

Is this one bricked? For good? Please give me a three finger salute I can do to bring it back to life.

thanks!

HI @tachijuan! I don’t think your device is bricked. Before the flashing magenta are there any other LED colors, for example does it flash green then cyan?

File downloaded successfully
dfu-util: Error during download get_status

This is a known issue with dfu-util. The last error can be ignored - the file has flashed successfully.

When it reboots, it first lights white, then it flashes green, and finally settles on cyan flashing…

I'm a bit confused since you first mentioned

Flashing magenta is a OTA download happening, so that's ok. Just let the download proceed and eventually the device will reset.

Flashing cyan is the device attempting to connect to the cloud. Barring network connectivity problems, it should connect and eventually breathe cyan (running an application) or magenta (online, in safe-mode, not running an application)

What you describe are correct and expected behavior. Please see Getting Started in the docs which describes these color sequences.

So - color me stupid (and tired - should really do this when I haven’t been up for 20 hours already).

I tried doing a push from the web-ui. Nothing (not sure why - I did wait and make sure it wasn’t a timing thing and tried a couple of times). Then I did it via the particle-cli. Now I’m able to communicate via the web UI and the CLI.

Sorry for the noise…

And thank you for the quick responses. You guys rock.

1 Like

After performing a factory update on my Photon it seems to be stuck in a reset loop

solid white
flashing green
faster flashing green
single cyan (once)
flashing red (about 8 or 9 times)

Not able to setup via Particle CLI or Particle App (iOS)

How can I fix this? Thanks

Hey there,
I just bricked my Photon by performing a factory reset before reading this post. Is there anything I can do about it assuming I had access to a JTAG adaptor? How would I be able to re-download the bootloader to the board?

I could also buy a new Photon, but shipping takes too long to Germany…

Thanks in advance,
Leo Bernard

@leolabs,

can you describe what’s the Photon behavior so that we can assist you further?

After plugging the Photon in, the RGB-LED starts pulsing white slowly. Pressing the setup button for more than 10 seconds leads to the LED stopping to pulse and freezing in its current brightness.

I’m able to get the Photon into DFU mode and I can flash the tinker binaries and firmware updates, however these don’t affect the bootloader so that doesn’t help with the problem.

By the way, I noticed the Photon getting fairly hot after a few minutes if that helps.

Thanks for your help,
Leo Bernard

@leolabs did you resolve your issue?

I have a Photon that is showing the exact same behaviour as you have described (breathing white and setup button for 10 seconds goes to solid white).

Have loaded firmware v0.4.3.rc2 using dfu-util, it seemed to load correctly as the output from dfu-util looked good to the eye.

It could well be that there was physical damage to the module (slight dent to the metal shield), but this was only noticed after it stopped working, i.e. the dent was there when it was working.

@UMD unfortunately, I haven’t managed to get my Photon(s) working again. Will contact the support in the next few days and see if they can help :confused: