Photon not running code, main LED flashing dimly every 5s

I opened up a new photon yesterday, claimed it, and flashed some code to it. This was known-good code with some added serial debugging. The code didn’t execute and the main LED stayed off. I flashed back to Tinker in DFU mode but the LED still didn’t turn on. The D7 LED was very dimly illuminated. I couldn’t see the device in Particle Console.

I saw in the docs that no status LED means a corrupted bootloader.

I got out my Particle Debugger and re-flashed the bootloader. This seemed to work:

C:\Users\JIKde\.particle\toolchains\openocd\0.11.2-adhoc6ea4372.0>bin\openocd -f interface/cmsis-dap.cfg -f target/stm32f2x.cfg -c "adapter_khz 1000" -c "transport select swd" -c "init" -c "reset halt" -c "flash protect 0 0 0 off" -c "program C:/Users/JIKde/Downloads/bootloader-1.0.1-photon.bin verify 0x08000000" -c "flash protect 0 0 0 on" -c "exit"
Open On-Chip Debugger 0.10.0+dev-00920-g6ea43726 (2019-07-02-23:12)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
adapter speed: 1000 kHz

Warn : Transport "swd" was already selected
swd
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: FW Version = 1.10
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : stm32f2x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003750 msp: 0x20020000
Info : device id = 0x200f6411
Info : flash size = 1024 kbytes
cleared protection for sectors 0 through 0 on flash bank 0

target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003750 msp: 0x20020000
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
set protection for sectors 0 through 0 on flash bank 0

Then I unplugged everything, plugged the Photon back into USB, put it in DFU mode, and re-flashed Tinker. This worked too:

particle flash --usb tinker

Flash success!

However, the main LED still isn’t turning on. The D7 LED is no longer dark, but now the D7 LED and main LED flash once every five seconds before going dark again. The main LED seems to be trying to flash magenta, but it’s hard to tell. I put a scope on the 3V3 pin as suggested in some past forum posts, it’s a solid 3.3V.

Is there something else I need to flash? If so, where can I find instructions?

HI @JonKimbel -

Just a question, have you tried Particle Doctor via the CLI? I have managed to stuff up Photon pretty badly couple of times and some time with Particle Doctor managed to resolve my problems each time :slight_smile:

Does the LED work prior to loading your code?

Regards,
Friedl.

I hadn’t tried it, thanks for the suggestion! I tried it just now, it errored out due to “File too short for DFU suffix”? Here’s the full message:

C:\Users\JIKde>particle doctor
The Device Doctor will put your device back into a healthy state
It will:
  - Upgrade system firmware
  - Flash the default Tinker app
  - Reset the device and server keys
  - Clear the Wi-Fi settings

The Doctor will operate on your Photon connected over USB

PLEASE DISCONNECT ALL OTHER DEVICES BEFORE PROCEEDING

You'll be asked to put your device in DFU mode several times to reset different settings.

Updating system firmware

Put the device in DFU mode
Tap RESET/RST while holding MODE/SETUP until the device blinks yellow.
? Select Continue when ready Continue

> Your device is ready for a system update.
> This process should take about 30 seconds. Here it goes!


! An error occurred while attempting to update the system firmware of your device:

File too short for DFU suffix
A valid DFU suffix will be required in a future dfu-util release!!!
Error during download get_status


> Please visit our community forums for help with this error:
https://community.particle.io/
The Doctor didn't complete successfully. Cannot read property 'code' of undefined
> Please visit our community forums for help with this error:
https://community.particle.io/

The LED worked before I first flashed my own code to the device, and it still flashes magneta/yellow just fine when I’m putting the device in DFU mode. Any pointers on this device doctor error, or what else I might need to do to fix this?

HI @JonKimbel -

I found this post, it might just work as this user seemed to experience similar error when running Particle Doctor

@ScruffR and @Moors7 gave some good advice. I forgot about the Safe Mode option, it might also do the trick. Sorry, running around this morning but will look more as soon as I have a moment.

Best of luck, hope this helps :wink:

Friedl.