Local monolithic build and OTA not working = Flash requires modules not present on device [SOLVED]

Hello,
I cloned the spark repository and checked out the branch develop-0.5.x. I put the photon in dfu-util mode and then in firmware/main executed this command.

make clean all -s PLATFORM=photon COMPILE_LTO=n APP=tinker program-dfu MODULAR=n

which is monolithic build. It took a while to flash the code. To confirm my actions I kept the device in listening mode and run particle serial identify.

The firmware version changed to 0.5.3 as expected but the firmware version listed under my device in the particle IDE is still 0.6.1. Maybe it takes time so I checked after a few minutes and it’s still 0.6.1.

Now I wrote a blink LED app and tried:

particle flash --target 0.5.3 myDevice blink.ino

It says,
Flash device OK: Flash requires modules not present on device.

What modules am I missing?

Thanks
Dheeraj

The over-the-air (OTA) flash code requires a modular build, since it only updates the user portion of the firmware. With monolithic build, you can’t do OTA since you would have to OTA the entire image including the part currently reading the firmware. As things are now, if you want monolithic I think you cannot do OTA and must do local build and flash.

3 Likes

Does this mean that after I downgrade the particle firmware to V0.5.3 I can’t flash my application anymore using OTA?

The version and monolithic-ness are completely separate. It just means that if you want monolithic builds, you must build on your own computer and flash over USB, not over-the-air. The version number has nothing to do with it.

1 Like

@dheerajdake, you can only update a monolithic image with another monolithic image as far as I know. So local compile and then flash the resulting image using CLI. This is what happens with the older Core. However, I would ping @mdma, @jvanier to confirm.

2 Likes

Monolithic builds are mostly useful for JTAG debugging these days since you get one file with all symbols in it. The modular build has 2 large files with the system code and 1 usually smaller file with user code so it’s good if you’re trying to save data while flashing over the air.

OTA flash is only supported for modular firmware on the Photon.

Get back to a modular build on your Photon with make clean all program-dfu PLATFORM=photon from the firmware/modules

3 Likes

Correct me if I am wrong. My assumption is that the version number points to the firmware release which contains the code for system-part1 and system-part2. Monolithic builds flash system-part1 and system-part2 along with user application code as opposed to modular builds which flash only the application code.

My goal is to use a previous firmware release say V0.5.3 in this case which is production ready release and then use OTA using particle cli to flash my application code. As of now I was not successful in doing this. I get the following error:

Flash device OK: Flash required modules not present on the device

Is this something which the user can do?

OK, I am going to try one more time:

  • You cannot use OTA flash with monolithic software.
  • The version of software you use is independent of monolithic or modular.

If you want to put V0.5.3 on a device and use OTA, you must use modular builds. If the device is currently running monolithic or you need to downgrade from a later version, follow the downgrading instructions to use DFU over USB to update the device in the specific order given on the releases page here https://github.com/spark/firmware/releases

2 Likes

Okay. Here are the things I have tried.

My particle cli version is v1.20.1 and the system firmware version is 0.5.3. I downloaded the system-part1.bin and system-part2.bin for 0.6.1. I kept the device in blinking yellow mode and ran the following commands:

particle flash --usb system-part1-0.6.1-photon.bin
particle flash --usb system-part2-0.6.1-photon.bin

After downloading, I kept the device in listening mode and ran particle serial identify and then the system version got changed to 0.6.1 as desired. OTA is working too :smile: So far so good.

Now I wanted to get back to 0.5.3. So I downloaded the system part 1 and part 2 binaries and ran the following commands

particle flash myDevice system-part1-0.5.3-photon.bin
particle flash myDevice system-part2-0.5.3-photon.bin

The device acted like it was downloading something and after a while it rebooted and it acted like it was downloading something again. After a while I put the device in listening mode and ran

particle serial identify

The firmware version is V0.6.1 !.

I think the photon automatically reverted back to 0.6.1. I tried flashing 0.5.3 system binaries by keeping the photon in dfu-util mode over USB using

particle flash --usb system-part1-0.5.3-photon.bin
particle flash --usb system-part2-0.5.3-photon.bin

This showed similar behaviour and the firmware is still 0.6.1.

The downgrade didn’t happen. What am I doing wrong?

You may have missed the memo, but 0.6.0 and 0.6.1 are production ready releases too.

And if you want to downgrade, you already got the hint

This link should have told you to flash part2 before part1 (reverse order for downgrading).

2 Likes

Thanks a lot @ScruffR. Flashing part 2 before part 1 did it. I missed that.

@ScruffR This worked using

particle flash --usb part2.bin
particle flash --usb part1.bin

by keeping photon in dfu-util mode.

However,

particle flash mydevice part2.bin
particle flash mydevice part1.bin

didn’t work.

Yep. See above. You cannot downgrade over the air, only over USB as I said above.

2 Likes

Oh okay. Thank you so much on this. That solves all my questions.