Photon flashed code once, cannot replace it with any new code

I used the particle dev desktop app to put code onto my photon. Everything went great.

Now I am trying to put some new code (any new code) on my photon and it does not work. The lights flash like it is loading new code, but it is still running the same initial code I loaded.

I have tried to load code both from the web interface and the desktop pp (for mac) and all appear to flash, just not loading the new code.

Any ideas of what I can try?

@anthonywebb, it is a recurring issue since unboxing or it happened suddenly?

I think this just started happening recently. Pretty sure I have put code on this several times. Just ordered 100 of these little photons for a project, the thought of not being able to program them reliably remotely has me concerned. It must be a bug, hoping for a fix soon.

Do you have particle-cli installed? We can try flashing over DFU to see what happens.

OK, I reset the photon to factory tinker. Uninstalled the spark-cli and installed particle-cli. What would you like me to try? (PS, for fun I tried to install from the mac desktop client. Looked like it worked, but tinker is still on there.

When you compile code using Web IDE or Particle Dev, download the .bin file and flash via particle flash --usb xxx.bin and see what happens.

It us telling me “Error writing firmware… no dfu device found.” but I am indeed in DFU mode (flashing yellow) and plugged in to USB

Which OS are you on? Try: dfu-util -d 2b04:d006 -a 0 -s 0x080A0000:leave -D xxxxx.bin

I am on mac, let me see if I can find dfu-util

ugh, offline: https://isitup.org/dfu-util.gnumonks.org

webb$ brew install dfu-util
==> Downloading http://dfu-util.gnumonks.org/releases/dfu-util-0.7.tar.gz

curl: (6) Could not resolve host: dfu-util.gnumonks.org
Error: Failed to download resource “dfu-util”

Do you have brew installed?

yes

i think brew install dfu-util works or http://dfu-util.sourceforge.net/

Happy to report that I was able to flash my bin to the device with this command, all other methods of getting new code to my photon failed. Is there anything I can do to be of assistance in getting to the bottom of why and preventing it from happening in the future?

I’m not 100% sure what’s the issue though… Can you try an OTA again? I have been using OTA and seems ok for me.

I just tried to post a blinker sketch from the web interface, looked like it flashed, but it did not. It still has the sketch I flash with dfu-util.

I’m guessing the CRC check failed and the Photon rejected the user-firmware.

Can you open a Serial Terminal, place the Photon in Listening mode and hit s and paste the output here?

Thanks for helping :smile:

Another way to test is to place the device in SAFE mode and perform OTA to see what happens

I may need some more specific instructions:

What I did was:

  1. Open the command line prompt and type: particle serial monitor
  2. Place photo in listening mode by pressing the setup button for 3 seconds until it started blinking blue.
  3. Press “s” at the serial monitor (and nothing happened)

particle serial monitor doesn’t take in keyboard inputs.

Do you have something like http://freeware.the-meiers.org ?

Don’t waste too much time on this though… I’m not 100% certain what’s the issue but that output tells us something about the code running on the Photon :wink:

Got it, yea on the mac there is an app called “cool term”, at any rate, here is the dump:

"p":6,"m":[{"s":16384,"l":"m","vc":30,"vv":28,"f":"b","n":"0","v":2,"d":[]},{"s":262144,"l":"m","vc":30,"vv":0,"d":[]},{"s":262144,"l":"m","vc":30,"vv":30,"f":"s","n":"2","v":1,"d":[{"f":"s","n":"1","v":1,"_":""}]},{"s":131072,"l":"m","vc":30,"vv":30,"u":"0102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20","f":"u","n":"1","v":2,"d":[{"f":"s","n":"2","v":1,"_":""}]},{"s":131072,"l":"f","vc":30,"vv":30,"u":"F8BD014B0360704700BFF81E0A0810B5034B04460360FFF794F8204610BDF81E","f":"u","n":"1","v":2,"d":[{"f":"s","n":"2","v":1,"_":""}]}]

Formatting it:

{
    "p": 6,
    "m": [
        {
            "s": 16384,
            "l": "m",
            "vc": 30,
            "vv": 28,
            "f": "b",
            "n": "0",
            "v": 2,
            "d": []
        },
        {
            "s": 262144,
            "l": "m",
            "vc": 30,
            "vv": 0,
            "d": []
        },
        {
            "s": 262144,
            "l": "m",
            "vc": 30,
            "vv": 30,
            "f": "s",
            "n": "2",
            "v": 1,
            "d": [
                {
                    "f": "s",
                    "n": "1",
                    "v": 1,
                    "_": ""
                }
            ]
        },
        {
            "s": 131072,
            "l": "m",
            "vc": 30,
            "vv": 30,
            "u": "0102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20",
            "f": "u",
            "n": "1",
            "v": 2,
            "d": [
                {
                    "f": "s",
                    "n": "2",
                    "v": 1,
                    "_": ""
                }
            ]
        },
        {
            "s": 131072,
            "l": "f",
            "vc": 30,
            "vv": 30,
            "u": "F8BD014B0360704700BFF81E0A0810B5034B04460360FFF794F8204610BDF81E",
            "f": "u",
            "n": "1",
            "v": 2,
            "d": [
                {
                    "f": "s",
                    "n": "2",
                    "v": 1,
                    "_": ""
                }
            ]
        }
    ]
}