[SOLVED] Photon Always returns to Listen Mode

Everything was working well until one time after flashing the Photon using the Web UI it got flashed (magenta flashing) and then when it was re starting, it went into Listen Mode instead of running the application code.

I tried putting it into Safe Mode, but as soon as I release the Setup Button (after I see the Magenta start to Flash) it goes back into Listen Mode

I’ve tried putting into WiFi Reset mode (using both methods) but the same thing happens. As soon as I leave the Setup button, it goes back into Listen mode.

I can flash the device locally using CLI but once again, when it restarts it goes into listen mode.

So now I’m stuck. What can I do to fix this?

Could you put it in DFU mode and then issue particle update followed by another DFU with particle flash --usb tinker?

You’ll need to provide WiFi credentials to the device.

1 Like

When I use the CLI to set up the wifi credentials, the Photon restarts and works as expected all by itself. But that’s the only way I can get it to work. That is flash, then set up Wifi credentials and let it restart.

I’ve downloaded the dfu util, but I’m not sure how to “install” it. It does go into DFU model (took a few tried but it stayed blinking yellow), but I’m at loss WRT the dfu util.

If you have a WiFi.clearCredentials() call in your code then that will case existing credentials to be cleared, causing this affect.

1 Like

Hmm, Ok, I suspected that using clearCredentials() could have caused this, which it why I tried setting the credentials using the CLI.

The code I’ve flashed doesn’t have that method call anymore. Besides:

  1. It’s that the point of Safe Mode? To not run any user code?
  2. After setting the credentials one using the CLI and can’t flash the Photon such that it restarts without going directly into listen mode.

I’ve flashed using the Web IDE as well as CLI, in both cases, when the Photon restarts it goes directly into listen mode.

Ok, I “saved” the code in the IDE and recompiled
I setup the wifi using CLI
Then Flashed it using the Web IDE and it worked this time.

So it looks like the Web IDE doesn’t save the code and then Compile and Flash (like most IDEs I’m used to). So when you mentioned the clearCrdentials() method causes this (for me that was confirmation of a hunch I had), I figured the only thing that could explain why the behavior is not changing even after I changed my code, was that the IDE doesn’t save the code in the editor prior to compiling and flashing.

Thank you! I’ve got my Photon back :joy:

Yes, although if you don't have any credentials safe mode will still blink blue as it tries to connect to the cloud but doesn't have any credentials. This is nothing to do with running user code.

So try this:

  • enter DFU mode
  • run particle flash --usb tinker
  • setup credentials vial the CLI
  • verify the device connects to the cloud
  • flash tinker a few more times - try safe mode, and satisfy yourself the device is working normally.
  • now flash your code. If the photon starts misbehaving you know it's a problem in your code. You mentioned WiFI.clearCredentails() isn't present any more - could you have made a mistake there and flashed the wrong version?

could you have made a mistake there and flashed the wrong version?

Yes, I think the Save, Compile/Flash step it required. I wasn't saving the code prior to flashing. So effectively, the "new" code was not being flashed.

The Web IDE does save the code before building and flashing. If it can't save due to network troubles, it will not proceede with the building/flashing steps.

Only Particle Dev does not, since it's more an editor than and IDE.