System firmware update to specific version

Hey guys,

Can we specify the target system firmware when updating using particle update command in DFU mode? I know we could do it using the binaries, but I am wondering if it is possible with a single command, like particle update 1.2.1?
Is it possible to pass the WiFi credentials using a single command through the CLI?

I know both are not related but we are building a desktop application using Electron.js and these commands will help us to set the application easily.

Cheers!

@Rahul_G

You can pass the credentials using particle serial wifi

As for updating using the CLI with a simple command, I don’t think its there yet. You’d have to download the specific system-part binary and load it using DFU mode.

The only thing I can think of that you can do is set the version of your device in workbench. Then instead of compiling and loading locally, do a cloud flash. If the system part doesn’t match, the device should get updated and then the firmware loaded.

1 Like

@jaredwolff Thanks for the response. We are creating an application that could communicate with the CLI and the user. The user could just insert the WiFi credentials in a text-box and our application will communicate to the photon via CLI and set credentials.

Our application might need to communicate 2-3 times to the CLI for setting WiFi. I am looking for a single command to do it, maybe like particle serial wifi SSID Password.

The only thing I can think of that you can do is set the version of your device in workbench. Then instead of compiling and loading locally, do a cloud flash.

Could we flash an empty firmware with system firmware target, like particle flash <deviceName> firmware.bin 1.2.1? We couldn’t communicate with the workbench as our application will be communicating with the CLI.

The problem with this is that this setup scans for SSIDs, etc. So maybe not so ideal in your situation.

Another solution would be to transfer that information manually over the serial terminal associated with the device. Or, alternatively, set up some Bluetooth Characteristics for setting the SSID and Password. (using WiFi.setCredentials(ssid); on the device itself) (Bluetooth is not as secure but definitely more convenient in some cases)

Docs on this is here.

For the system OS, I highly recommend that you cache the system binaries in your application. That way you have tested and support only specific ones. All of the release binaries are located here:

It’s not as easy as having a command line option to do it. I would tend to stay on the cautious side especially updating the system part of the firmware.

I’m not exactly sure what you’re doing with your app so take my advice with a grain of salt as I only have so much context.

Cheers :slight_smile:

Thanks @jaredwolff. This is really helpful, will look into setting WiFi credentials a little more.

Cheers! :beers:

You’re welcome @Rahul_G! :slight_smile:

1 Like

CLI can also take a JSON file that contains the WiFi creds.

This has always been an option for upgrading a system. Whenever you have a firmware targeted at a higher version than what’s installed on your device Safe Mode Healer would kick in and update the device OS too. That would include multiple cycles of magenta flashing with a reset between the individual modules.
But SMH is only ever going up but will never downgrade the device OS since and firmware targeted at previous versions will still be working on higher versions.

2 Likes

Thanks for the info @ScruffR. The system firmware update command will definitely come in handy.
Sending the WiFi creds with the JSON file might take a lot of effort in our case. We might go with the CLI even if it takes 2-3 steps.

How’s that? Creating a simple text file, storing it in a temporary location and passing that file path to the CLI doesn’t seem that complicated.
I’d imagine the back and forth with parsing the CLI responses in your app more complicated.

Hey @ScruffR, Thanks for pointing it out! Could you please provide the link for the documentation?

Just type particle serial wifi --help and see :wink:

Got it. Tried it using the command particle serial wifi --file wifiCred.json

The JSON file content is

{
 "network":"SSIDXX",
 "security":"WPA2_PSK",
 "password":"password123"
}

but while executing the command, nothing happens in the CLI.

For one, I cannot see a WPA2_PSK option for security

Thanks @ScruffR. The security option fixed it. :+1: