Best way to factory flash via CLI with 1.0.0 bootloader


#1

Hi,

Using P1 in production. Many happy years of flashing via dfu-util.

What is the neat way to flash without pressing keys the bootloader. I could write an expect script, but honestly, I’d expect that --force and --yes would actually be listened to as options rather than prompting ‘Press ENTER when your device is blinking BLUE’.

I took a wander through https://github.com/particle-iot/particle-cli/blob/master/src/cmd/serial.js and it doesn’t listen to --yes, it calls _promptForListeningMode regardless.

So, can someone help me out or should I just hack serial.js like I used to have to do?

Thanks in advance!


#2

I think there is a way to send the bootloader with YMODEM directly.

The sz command should be able to do it.


#3

Thanks, I ended up fixing the particle-cli code so particle flash serial works like particle flash usb in regards to ‘yes’


#4

Created a pull request.


#5

USB control requests are implemented. Amongst others there are requests to put the device into DFU or Listening Mode. Documentation will follow soon.
But for ages now you can use the magic baudrates (14400 DFU, 28800 LM) to do the same thing.


#6

yeah understood, and have been using those baudrates.

the trick is currently the particle-cli tools don’t have a neat way of skipping the prompt to put the device in blue setup mode. my pull request fixes that situation, letting the ‘yes’ parameter flow through to particle flash logic.

if there was a documented location to flash the bootloader I could have used dfu-util to flash it directly, but after a fair bit of google I couldn’t find that info.


#7

You could try Y-Modem (Listening Mode + “f”) as @nrobinson2000 mentioned above.

However, to propose the --yes switch you can always file a request here


#8

Normally find requests gather dust :wink:

I wrote the code for --yes, the pull request link is above.

Second time I’ve contributed to particle-cli, last time was the --file param for particle serial wifi so you could use a json file with configuration parameters for unattended installs. You can see it via particle serial wifi help

I’m frequently surprised that this type of thing preventing uninterrupted installs isn’t causing more dramas for more folk. Maybe they have a line of cheap foreign workers actually tapping their way through particle setup?


#9

When a CLI PR or issue gathers dust you can also ping @jvanier here.


#10

I merged the PR. It will go out with the next release of the CLI. Thanks again @mterrill!


#11

Cheers!