I am trying to implement an Over the air update on the Portenta Machine Control. I am using the Arduino_Portenta_OTA library to achieve this as it is compatible with the Portenta H7. My end goal is to secure the bootloader and do a secure OTA update with MCUboot, but for now I would settle with a standard insecure bootloader as I am having problems with securing the bootloader.
I have updated my bootloader to the latest v24 using Arduino IDE > Examples > STM32H747_System > STM32H747_manageBootloader.
I then formatted the QSPI flash to accommodate large OTA files as follows from the Arduino IDE > Examples > STM32H747_System > QSPIFormat
Partition scheme 1
Partition 1: WiFi firmware and certificates 1MB
Partition 2: OTA and user data 13MB
The code I am trying is simply a modified version of the OTA_Qspi_Flash_Ethernet sketch off the aforementioned github library. I have just changed the OTA_FILE_LOCATION[]
to a local firmware.ota file I have generated.
After flashing the sketch I get the following serial output:
Initializing OTA storage
Error while opening the certificate file.
Arduino_Portenta_OTA::begin() failed with error code -9
Has anyone got OTA working on the PMC? I know Arduino Cloud have an offering but I really need local updates on this project.
Any help would be greatly appreciated!
So unless someone can tell me otherwise it seems that an OTA is not possible at the moment.
If anyone is interested in a workaround, please read on...
I have an ARMv8 SBC with 2x Ethernet ports which acts as an IoT gateway to the PMC. If I want to remotely update the PMC, I compile my project on my machine then send the binaries to the SBC and flash it from there. You may need to modify the following code and it is far from ideal but it has saved my bacon!
firmware-flash.sh
#!/bin/bash
echo "> Downloading Arduino CLI"
curl -L https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_ARM64.tar.gz -o arduino-cli.tar.gz
tar -xvzf arduino-cli.tar.gz --directory=. arduino-cli
rm arduino-cli.tar.gz
echo "> Updating tools ..."
sudo ./arduino-cli core update-index
sudo ./arduino-cli lib update-index
sudo ./arduino-cli core upgrade
sudo ./arduino-cli lib upgrade
sudo ./arduino-cli core install arduino:mbed_portenta || exit 1
echo "> Flashing Firmware ..."
sudo ./arduino-cli upload -b arduino:mbed_portenta:envie_m7 --port /dev/ttyACM0 --input-dir . || exit 1
echo "> Flash Complete"
Execute locally:
arduino-cli compile -b arduino:mbed_portenta:envie_m7 --output-dir Firmware
rsync -avp --delete Firmware firmware-flash.sh mysbc:~/Firmware
Execute remotely:
cd ~/Firmware
sudo ./firmware-flash.sh
There is a WiFiFirmwareUpdater.ino example sketch by STM32H747_System. I think you need to run that once, so certificates will be available. I have no issues with OTA.
Maybe that was not available back then which I have no idea.
1 Like