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

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,
                    "_": ""
                }
            ]
        }
    ]
}

@anthonywebb,

just wondering if by any chance you compiled code locally using the source code and changed the system firmware? Or all you used was Web IDE?

@mdma if you have a second later in the morning…

I have only ever flashed code from the web ide, and from the mac desktop client (particle dev) both of those compile in the cloud…

1 Like

Could you please email me the binary that was produced in the web IDE and I will try to reproduce the problem.

@mdma one other note. I have 3 photons, 2 work perfectly, it is just one of the photons that seems to have this problem. One other symptom that might shed some more light is that when I try to enter new wifi creds via the mobile app I see the following error (the other 2 photons can go through the wifi setup without a hitch):

On the photon that isn’t working, please apply this update - https://github.com/spark/firmware/releases/tag/0.4.2.

That should get you out of the problem.

Cheers,
mat.

1 Like

@mdma you saved the day, after applying the update the photon is working great!

3 Likes

@mdma Same problem over here, but the 0.4.2 update did NOT fix the problem…

1 Like

hi @steelydev Could you start a new thread, and provide as much detail as possible. I don’t advise updating to 0.4.2 beta until we’ve identified that it will help. The code not working could be for other reasons too.

Hi was a new thread ever instantiated? I too was (am) stuck with a Photon that behaved like it was being flashed, both OTA and by USB, but would then restart into the exact same stock firmware it’s always had (blue/cyan RGB pulsing, D7 LED blinking on and off every few seconds).

I applied the above 0.4.2 update which has had no effect except that the D7 LED is now permanently off, and the RGB breathes magenta.

Breathing magenta means safe mode - it means there’s no valid user firmware to run. That’s good. You can now try flashing your code.

As a hint, the code for small applications is just a few kilobytes in size. If it’s much larger, around 70-80K or more then you most likely have a binary for the Core, which won’t work on a photon.

Ok, I’ll give it a shot tomorrow!

Ok, I have reflashed both parts of the latest 0.4.2 firmware release to the Photon as per your suggestion in another thread. I still cannot flash locally compiled code by USB or cloud to the Photon, though.

The .bin’s being generated by executing make inside ../firmware/main are indeed between 70Kb - 80Kb, even for an exceedingly trivial program that just sets the RGB to be one colour.

So I’m given to understand here that local compilation is targeting a Core and not a Photon, which is why it’s being rejected (?)

How should I proceed to compile locally for a Photon then?

OH!!! I’ll just answer my own question here:

By default, the Core is the target platform. To build for the Photon, run

make PLATFORM=photon

All told, the solution for me was to run the “Update the System Firmware” steps found here. As soon as I did that, the Photon rebooted and the code that previously was flashed but not running, immediately started running.

Thanks for pointing me in the right direction!

1 Like