So we sell some boards which we flash with firmware prior to shipping. I use the Particle CLI to to setup the module for my network associate it with my account for testing, etc. This is quite a bit faster than using the GUI apps. I would also like to use the CLI to OTA flash my firmware to the Photon/Electrons. However recently I have not been able to accomplish that. Format I am using is as follows:
particle flash deviceID firmware.bin
From the Terminal everything looks like it went through fine but when I check available functions on the module I can see Tinker is still running so the firmware flash did not go through. Is anyone else using this? Am I doing something wrong?
For reference I get the binary file by downloading it from the build IDE. I can flash it from there and it works perfectly just does not work from CLI.
@IOTrav, did you log in to your account on CLI using
Just out of curiosity, why do you not flash via --usb?
That would not require to claim the device either - although you still can.
For quick dev cycles I’d even build via CLI.
Hi @peekay123 and @ScruffR
Yes, I am logged in through the CLI.
I generally test everything just like I were an actual user so I like to get it connected to the WiFi network(verify WiFi on module is good, have seen a couple bad ones), then monitor events published by the device and call cloud functions on the device. This ensures that everything works.
I could flash over USB I suppose, but shouldn’t I be able to flash OTA using the CLI? It seems like I did it that way in the past and it works. Although I believe I was doing a build from the modules directory and flashing OTA rather than submitting a binary.
And yes, you should still be able to flash OTA via CLI.
No idea why it wouldn’t work.
Does the device’s LED turn magenta?
Does it reboot after that?
Do you get a app-hash event in https://console.particle.io/logs ?
I should have mentioned all of that.
Yes, the LED on the module does flash magenta like it’s flashing, then it reboots. However console.particle.io shows a flash status of failed.
I wonder if there is something wrong with the binary I downloaded from Build.
That’s a possibility - may have a wrong target.
You can check with
particle binary inspect
Says it is compiled for Core:
Traviss-MacBook-Pro:NCD_Particle_Binaries travis$ particle binary inspect NCD1Relay.bin
CRC is ok (80e11f94)
Compiled for core
This is a monolithic firmware number 0 at version 0
Should that say Photon?
So how would I download a Binary from Build and ensure it has Photon set as the Target? I do not see any options for setting the compile Target when downloading the Binary on Build.
I think there is an option for what device you want to use in build and it will compile for it.
I’m not seeing anything on build for that. The only option similar to that is System Firmware Target version but that is device specific and not code specific, it does nothing for the download compiled binary button in the code view.
You should a Photon under the devices tab before downloading a firmware bin file. This will ensure that the app is compiled for Photon.
For CLI, make sure to compile using
particle compile photon . to target for photon.
It appears that when I origionally downloaded these binaries from Build I must not have had a module stared. By doing so it defaulted to Core(makes perfect cents?).
Anyway I stared a Photon module, then downloaded binary from Build. Now Particle Binary inspect is showing the binary is targeted for Photon. I then flashed OTA using the CLI just as before and it succeed.
So long story short when you download a binary from Build by default that binary is targeted for Core.