I’m new to the Particle platform and have an Electron board on loan from a colleague which I am trying to use for some rapid development. I am compiling in the web IDE, running the target in MANUAL mode and then flashing it locally with the downloaded .bin file from a Windows machine. I’m using PuTTY to read my local debug messages from the USB port and I make sure that PuTTY is not running when I’m trying to flash the board. I’m using the short USB cable that came with the Electron board.
All of this is working, except that flashing is unreliable. When the device is in listening state (blue flashing LED), more often than not, when I do the “Press ENTER when your device is blinking BLUE” bit, the blue flashing LED either goes off or stays on and the CLI reports:
! serial:
Error writing firmware...Timed out waiting for initial response from device
undefined
Very rarely (maybe one time in 10) does it go rapid-flashing-magenta and begin the download and often, when it does, the magenta goes solid and the download reports a time-out.
! serial:
Error writing firmware...TimeoutError: timed out after 10000ms
TimeoutError: timed out after 10000ms
at onTimeout (C:\Users\rob\AppData\Roaming\npm\node_modules\particle-cli\node_modules\when\lib\decorators\timed.js:6
9:7)
at null._onTimeout (C:\Users\rob\AppData\Roaming\npm\node_modules\particle-cli\node_modules\when\lib\decorators\time
d.js:13:4)
at Timer.listOnTimeout (timers.js:92:15)
I am running firmware 0.5.1 on the device, Particle CLI version 1.14.2 on the Windows machine and using the Electron USB driver version 5.2.0.0.
We’ll do our best to figure out what’s going on. First, can you confirm that you are building the firmware for the Electron? Make sure in the Web IDE that you’ve selected it from the Devices section.
If you are running in MANUAL mode, are you making sure to run updates
Another option is to write to the Electron directly over USB, instead of OTA. You’d instead put the Electron into DFU mode (yellow blinking) and flash with this command: particle flash --usb firmware.bin
You can also check out this thread that has more info on some of the advice above, but definitely let us know where you are at, and what you’ve tried!
Hi there. Yes, it is built for an Electron. I’m not sure what you mean by “are you making sure to run updates”. I have the latest firmware I could find (0.5.1) and I only installed Particle CLI on Friday so I guess those are the latest. What other updates are there?
I’m not using OTA, everything is done locally with “particle flash --serial blah.bin”, there’s no OTA here. I thought “particle flash --usb blah.bin” was for core firmware updates only, not application software. I may be confused though…
The --serial flash can fail because your code runs at the same time as the update, and it’s easy to accidentally interfere with it. I prefer to use the --usb (DFU) flash mode:
Hold down the RESET and MODE button, release RESET and continue to hold down MODE while the main status LED blinks magenta, until it blinks yellow and then release MODE. This is DFU mode.
Then issue a command such as:
particle flash --usb firmware.bin
If you get an error that dfu-util is not found, then you’ll need to install it. For Windows, the easiest way is to run the Particle CLI installer; a link is at the bottom of the [Particle CLI page] (https://particle.io/cli). That page also has instructions for Mac and Linux.
Don’t worry about this message; it’s not really an error and will always occur:
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Thanks man! I needed to use the --usb and also connect it to the USB port on the rear of my PC and not on the front because it has more power on that USB port.
I detected same behavior when using a blocking loop-application:
void loop(void)
{
while (!Serial.available()) {
Serial.print("I'll never leave this loop!");
delay(100);
}
}
The update worked for me using:
void loop(void)
{
if (!Serial.available()) Serial.print("I'll leave this loop in 100ms!");
delay(100);
}
Can anyone confirm this behavior?
Another fix is to start into rescue mode first ([RESET] + [MODE], release [RESET], wait for green blink and pressing [MODE] for several seconds again). OR, as others already proposed, to use the dfu mode.
That means your ass_1.bin file was built for the Photon, not the Electron. Make sure you have an Electron selected with a gold star to the left of the name in the Devices tab.
I’ve been updating the firmware on my Electron regularly without any trouble. But just today I started getting the same error message when trying to flash via --serial…
! serial:
Error writing firmware…Timed out waiting for initial response from device
undefined
I get this message when trying to flash via --USB…
I’ve tried loading a previous version of the firmware to make sure it’s not a problem with the firmware being compiled for the Photon - but no luck. I’ve tried flashing from the CLI using both --serial and --USB. No luck either way. I tried rebooting my laptop just in case. No luck there either.
KENMBP:Desktop kennethlimcp$ particle --version
1.20.1
KENMBP:Desktop kennethlimcp$ particle flash --usb test.bin
!!! I was unable to detect any devices in DFU mode...
> Your device will blink yellow when in DFU mode.
> If your device is not blinking yellow, please:
1) Press and hold both the RESET/RST and MODE/SETUP buttons simultaneously.
2) Release only the RESET/RST button while continuing to hold the MODE/SETUP button.
3) Release the MODE/SETUP button once the device begins to blink yellow.
Error writing firmware...No DFU device found
With a device:
KENMBP:Desktop kennethlimcp$ particle flash --usb test.bin
Found DFU device 2b04:d006
Error writing firmware...test.bin was empty!
(This is due to using a blank .bin but it still shows it works)
It just worked - for the first time. I was typing “–USB”, and I see you used “–usb”. Perhaps that was my problem flashing in USB mode, but I don’t understand why I’m having trouble flashing in serial mode.
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/
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 = 13972
Download [=========================] 100% 13972 bytes
Download done.
File downloaded successfully
Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release!!!
Unfortunately, although it seems to have flashed successfully, it doesn’t seem to be giving me any of my Serial.println() stuff when I run “particle serial monitor”. It’s as if the serial link is the problem.
I tried flashing my Photon via serial, and it worked fine. So I then tried re-assigning the serial port on the Electron, and that fixed it as well. Curious that the USB mode wasn’t working. Perhaps that’s because I was using --USB in upper-case. I’ll do a test.