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
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.
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?
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:
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 email@example.com
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...
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
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
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.
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.
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…