Dear ScruffR and Moors7:
I had a bet with myself that you two people would reply. I win the bet. Thank you for being there for the community! I repeat my offer of a dinner and/or a beer if you get to Boston or Phoenix!
- Re ScruffR’s comment that he found ‘nowhere’! Let’s take a look, for example, at the very first lines of the ‘doctor’ reference:
Helps you update your keys, or recover your device when the keys on the server are out of sync with the keys on your device. The particle keys tools requires both dfu-util, and openssl to be installed.
My point is that it does not say what a key is used for. There is no concept of the basis for needing a ‘doctor’. This documentation note is useful only if you realize that keys can get out of sync. And under what conditions might you need to go to the doctor? What are the symptoms of a “bad key”?
So far I have not needed dfu-util although I knew it existed. And what is ‘openssl’? Remember: The particle products, like Photon, are intended for both hobbyist and serious sw development. As a hobbyist I am willing to learn this esoteric stuff but it would be nice to see some paragraphs on what the heck is going on at the big picture level.
- Is the device connected properly?
Yes, it’s connected exactly the same way it’s always been connected. It’s socketed in a small PC board surrounded by a bunch of glue logic for my application. I have six of these boards each with a Photon. They all cannot flash. I could have dropped a few brain cells (it happens) and not used “build” properly but my partner, over in his house with his own copies of the PC board, sees the same failure mode.
- Safe mode: Safe mode connects the Photon to the cloud, but does not run any application firmware.
When I said safe mode did not work, I meant that it did not connect to the cloud. In my mind, that’s it’s purpose: When a user app has a bug or something, you may need safe mode to get the device flashed with new user code so you can debug it.
- My user app. A few words.
The user app that’s currently in memory runs in MANUAL mode. That’s because our project is intended for use far away from civilization where there’s no Internet. Instead, we provide a local wifi net to allow many of our Photon based sensor boards to communicate with a host laptop. This works fine. We have to use MANUAL because, otherwise, the code will immediately hang looking for the real Internet, which ain’t around.
We have two ways to enter debug-like commands to the underlying user app. i) A serial port line. ii) From the laptop (which is running a server program), we can enter commands and they get squirted down to the Photon over a socket and the Photon’s reply appears on the laptop.
So how does one flash new code? If it’s MANUAL, there is no connectivity to the Internet. We have a command, named ‘cloud’, which commands our app to do a Particle.connect. After a one second delay, we check (using Particle.connected) if we have cloud connectivity and print out a message either way. The main loop of the app now knows it’s supposed to be looking for cloud connectivity and prints a message from that loop if it does NOT get connectivity. So that’s how I know that my app is not working. I get a string of “we are not cloud connected” messages. And so does my partner get the same messages.
Once we are ‘cloud connected’, a flash command from the build IDE can break through and stuff new user code into the Photon.
This has been working great for maybe 6 months.
If I know I am going to be doing a lot of edit/compile/flash/debug/curse iterations, I stick the Photon in AUTOMATIC mode to avoid all this rigamarole. Once I am happy, I do a final flash to put it back into MANUAL.
- LED colors
OK, so I plug my PC board in and it gets power. (Over USB cable.) My app starts. It blinks some lights on the PC board and uses the RGB LED to communicate its internal status. Looks good.
I issue one of my debugging commands to my app to tell me it’s detailed internal status. It tells me what wifi SSID it’s connected to and it’s the same as my laptop. It tells me it’s in MANUAL mode, wifi is “ready”, and we are NOT cloud connected. This looks fine
Now I want to flash and so I issue the ‘cloud’ command. As noted above, I get a message stream saying it cannot connect to the Cloud.
Time for “safe mode”!
Press Reset and Setup at same time. (BTW, documentation at one point refers to the Mode button which I assume is old nomenclature for the Setup button. At least, I hope so.)
RGB goes dark with both buttons pressed.
Release Reset.
Once you see magenta on the RGB, then release Setup.
I see maybe a few blinks of magenta (Yeah!) and then it goes to rapid blink cyan - “looking for cloud”. That’s maybe 15 seconds. Then it will flip to rapid blink green for a brief time - “connecting to wifi and looking for Internet”. Sometimes I see three longish red blinks. (I think they are red and not orange.)
Three red blinks from the documentation indicates: 3 red blinks: Connected to the internet, but could not reach the Particle Cloud. That is entirely consistent with my theory that cloud connectivity IS the problem. To say that differently, my app’s behaviour plus safe mode behaviour both point to yonder Cloud.