Code Reverting Issue


I’m working with a Photon, and for some reason whenever I flash new code through it will flash successfully, only to revert to the previous code a few seconds later. The LED will turn magenta on it’s own, appearing as if the Photon is being re-flashed with the old code that was supposed to be overwritten. I’m not sure why that’s happening, especially when the code I’m trying to flash is essentially empty.
Has this ever happened to anyone before?

It’s probably trying to flash new system firmware, causing it to flash magenta. If for some reason the update fails, it’ll still be running the old firmware. Try giving it some more time to finish the update, update using the CLI, or pick a lower version to compile against.

I’ve tried updating via CLI, and several of the lower versions as suggested but the issue still persists.

Could you make sure the CLI is updated to the latest version, and then issue particle update followed by particle flash --usb tinker, both while in DFU mode? Could you post a screenshot of that?
Then, try flashing something simple like ‘blink an LED’.

The CLI seems to be up to date, I used “$ npm update -g particle-cli” just in case.
Here is the screenshot after entering those two lines. I flashed a simple program that blinks an LED every second, the Photon reverted to the original code. It seems to always happen about 3 seconds or so after the code gets flashed.

You haven’t used the product creator features at with this device, have you? Once you make a device part of a product, as soon as the cloud detects that you have flashed different code on the device, it will flash the current version of the product firmware back, by design.

I was actually given the device to help develop it, continuing where others left off. I’m not actually sure whether not that has been done, though that sounds like the most logical explanation. I haven’t personally done anything like that with the board.

Edit: Perhaps the person working on it last set up something like what you described rickkas7. I went into and added the Photon board as a device in a product, and it the problem has been resolved.

Thanks for the insight.

Oh man - I wasted a good 4-5 hours on this.

Thought my code was bad and spent all that time commenting out code to see what was causing a crash…

Thanks - working now