Locally compiled and flashed code ends up in safe Mode. Why?

I've run the online examples for my electron and now (being old school) want to compile and flash files locally on my Mac via USB.

I'm sure this is a rookie error, but, in short, it's always going into Safe Mode after I flash the code. What am I missing?

Details:

Here my blinko.ino file in its entirety:

#define PIN D7
int state = 0;

void setup() {
    pinMode(PIN, OUTPUT);
}
void loop() {
    digitalWrite(PIN, (state) ? HIGH : LOW);
    state = !state;
    delay(500);
}

Workflow

After installing node, particle and dfu on my Mac, I did the following:

Compile

$ particle compile e ./blinko.ino
Compiling code for e
Including:
./blinko.ino
attempting to compile firmware
downloading binary from: /v1/binaries/5976b38e1138187355b03883
saving to: e_firmware_1500951434587.bin
Memory use:
text data bss dec hex filename
5228 8 1532 6768 1a70 /workspace/target/workspace.elf

Compile succeeded.
Saved firmware to: /Users/r/Projects/ParticleZen/src/e_firmware_1500951434587.bin

Flashing

I put the electron into DFU mode, and then:

$ particle flash --usb e_firmware_1500951434587.bin
Found DFU device 2b04:d00a
spawning dfu-util -d 2b04:d00a -a 0 -i 0 -s 0x08080000:leave -D e_firmware_1500951434587.bin
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 2b04:d00a
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash "
Downloading to address = 0x08080000, size = 5236
Download [=========================] 100% 5236 bytes
Download done.
File downloaded successfully
Flash success!

... and then...

The Electron goes through the following sequence:

  1. Flash Green (fast)
  2. Flash Cyan (really fast)
  3. Breathe Magenta (Safe Mode)

Not sure, but maybe your device wasn’t already updated to 0.6.2 system.
For Electrons this would just cause Safe Mode to tell you to upgrade first - Photons would perform an auto-upgrade.

BTW, particle compile also builds in the cloud

1 Like

Yassir! particle update did the trick. Thanks very much.

Thanks for the help!