Photon not flashing correctly, or always flashing with tinker

Whenever I flash the photon using build web IDE, it seems that it is always being flashed with tinker. If I flash with the Blinking LED Example, it still allows me to manipulate device via tinker and has no blinking LED. Modifying tinker and adding my own pinMode, analogWrite lines has no effect.

Even flashing with this still allows me to use tinker:

void setup()
{
    pinMode(D0, OUTPUT);

}

void loop()
{
    analogWrite(D0, 225);
}

This code has no effect on pin D0, yet I can still use tinker. And of course, I made sure that it was actually flashing magenta. I even performed a factory reset and a firmware update (v0.4.1).

When doing a factory reset, it doesn’t seem to enter the blinking white state. It looks like it starts to blink white rapidly but then crashes, and then the magenta-green-white color cycle repeats.

Anyone experiencing the same issue? I received my photons around May 22nd.

@nh43de,

how did you performed an update to firmware V0.4.1?

@kennethlimcp,

I updated using the version release binaries on github via the particle cli.

If you have a release photon, it shouldn’t be necessary to perform the update, since this is done automatically when connecting to the cloud. Did you have a pre-release photon?

Could you also please post your photon ID (send in a PM if you prefer) so we can check that it is properly registered in the cloud.

@mdma,

The photon was received 22-May-2015. I believe this is a release photon (not one of the early batches). I ordered around the beginning of the year (end Jan-Feb?)

I am also receiving this error when I try to flash photon system firmware over DFU. The same error appears when I try to flash the app firmware too.

The “Error during download get_status” message is a known issue with dfu-util that is safe to ignore.

1 Like

Hey @nh43de! Can you please download again the system_pad_BM-09.bin file from the releases page. The version that was uploaded yesterday was incorrect, so I have updated with a new version now.

Please flash using the same DFU command to flash as before, namely

dfu-util -d 2b04:d006 -a 0 -s 0x8020000:leave -D system_pad_BM-09.bin

I’m having this same issue. I have a release Photon that I got a few days ago, and I am unable to flash any new code. Everything works exactly like it should with no error messages, but the code does not run. I can still use Tinker. I’ve done multiple factory resets and upgraded the firmware via DFU (using the comand above) multiple times.

When I flash I get the standard magenta, then flashing green and then breathing cyan. The only clue I have is that doing a system reset or wifi reset doesn’t actually erase the wifi settings. It is always able to reconnect to my WIFI immediately after a factory or wifi reset. Any ideas?

Can you put the photon in Setup mode, then connect to serial, and press ‘s’ - please paste the output here. Thanks!

Another thing to try is to download the produced binary from the WebIDE. For a small app on the photon, it should be only a few Kilobytes in size. If it’s around 70-80k then you have a binary for the Core.

The flashing green indicates that the downloaded app was invalid, and that the system did a factory reset to known good firmware. This can happen if the data is not downloaded correctly or if it is an image for the Core.

Here’s the info from the serial interface:

"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":"2BA4E71E840F596B812003882AAE7CA6496F1590CA4A049310AF76EAF11C943A","f":"u","n":"1","v":2,"d":[{"f":"s","n":"2","v":1,"_":""}]},{"s":131072,"l":"f","vc":30,"vv":0,"d":[]}]

I tried downloading the blink an led firmware from the web IDE and it’s 77k. So I guess the Web IDE thinks my Photon is a Core?

If you mean Alpha photon, someone from the Particle team will need to tag it as Photon to target a photon build :wink:

I am having the same issue. My OSX setup is documented [here]
(Photon OSX local build setup notes on 20150531).

I reflashed system_pad_BM-09.bin from the releases page using the command above from mdma@, that did not solve the problem.

I’m able to successfully compile and flash the blink LED example via the Web IDE. I downloaded the blink binary from the Web IDE. I flashed that file using

$ particle flash --usb blink.bin

That succeeded: the led blinked.

What doesn’t work is putting the blink source code file into firmware/main/applications/blink/blink.cpp, then compiling/flashing using

$ make v=1 APP=blink PLATFORM=photon program-dfu

Note that the build/module.mk has Core-specific DFU commands, so I had to change those to:

in bootloader mode before invoking ‘make program-dfu’

program-dfu: $(TARGET_BASE).dfu
        @echo Flashing using dfu:
        $(DFU) -d 2b04:d006 -a 0 -s 0x080A0000:leave -D $<

But it equivalently fails with

$ touch applications/blink/blink.cpp
$ make v=1 APP=blink PLATFORM=photon
$ particle flash --usb ../build/target/main/platform-0/applications/blink/blink.dfu

Complete output here.

Again, the result is that the Photon restarts with Tinker the rather than the expected blinking LED.

BTW, how is the address used in the -s part of the dfu-utils command chosen?

Thanks!

@DrPhoton,

are you trying to work with a Photon or Core?

Be sure to use the develop branch to compile for the Photon

The DFU-address is based on the memory map where each segment is programmed.

Memory map for core is here: http://docs.particle.io/core/hardware/#spark-core-datasheet-memory-mapping

Memory map for photon has not be added to the docs yet.

This won't build the firmware without also adding all

make v=1 APP=blink PLATFORM=photon all program-dfu

So that explains why it didn't flash.

1 Like

Thanks, Kenneth and Matthew. Following your suggestions, I git cloned the develop branch, cd’d to main, put the Photon in yellow blinking mode, then did a

make v=1 APP=tinker PLATFORM=photon all program-dfu

The flash appeared to succeed, but the Photon did not show the tinker commands with ‘particle list’ nor responded to tinker calls.

I can flash the ‘blink led’ code from the Web IDE and see the Photon blink D7. Downloading it from the Web IDE, I can also successfully flash it with

particle flash --usb blink.bin

and see the led blink.

But if I add the code to

firmware/user/applications/blink/blink.cpp

then do

make v=1 APP=blink PLATFORM=photon all program-dfu

It appears to flash correctly, but then doesn’t blink the LED.

I tried it with a second Photon. Same result.

Curious, no? Given that the Web IDE bin files work, whether flashed via the Web IDE or locally with ‘particle --usb’, it seems like a problem with the build chain bin/dfu files…

When you build locally, you should also ensure you build and flash the latest system firmware so that the versions match.

Locally, system firmware is at version 2, so the user app you build will also be at version 2. Yet your photon only has version 1 system firmware, so the user app will not run. (The system version has to be at least that of the user version in order to be sure it is compatible.)

To build system firmware, put your photon in DFU mode and run:

cd modules
make PLATFORM=photon clean all program-dfu

This will build everything and flash it to your device, and ensure system and user firmware versions are consistent.

5 Likes

Success!

I switched to modules and flashed that, then switched to main and flashed my ‘blink’ program. It worked.

Thanks, mdma@, for your help!

@mdma can the ‘system firmware’ be built locally and flashed OTA? or does this have to be done via dfu?

What’s the relationship of the ‘system firmware’ and its versions (1,2) that you’re talking about here and the build components mentioned here? Is there a document somewhere that describes the ‘system firmware’?

Thanks :smile: