OTA for custom devices with PIC/PIC32 MCUs

I have custom designs using a PIC or PIC32 mcu that uses a notecard. I’d like to know if there’s a way for an OTA firmware upgrade for the mcus to be applied.
TIA

Hi @ehlo! This is a big question, and the eventual answer of whether it’s possible or not comes down to the details of your hardware design and firmware space requirements.

Broadly speaking, there are two main approaches:

  1. In-application programming, where your firmware code interacts with Notecard to fetch the updated firmware and lay that down in a spare region of your MCUs flash memory.

  2. In-system programming, where the Notecard downloads the firmware and uses a hardware communications interface, typically comprising control of the Reset pin and UART, to talk to the bootloader to program the device. We call this Notecard Outboard Firmware Updates.

At present, Outboard Firmware Updates aren’t supported for PIC MCUs, since support for each MCU family has to be implemented in Notecard firmware. The PIC32 bootloader does support firmware updates via UART so it’s technically feasible.

Focusing on the first option, IAP. Your application code would need to include code that performs these steps:

  1. Use the dfu.* Notecard APIs to retrieve the downloaded firmware and store that in a free memory region.

  2. You’ll need to implement a “flash swap” function which swaps the content of the main application flash region and the free memory region. This function should be location independent since it is executed from RAM rather than flash.

  3. Copy the flash swap function to RAM, disable all interrupts and other code running from flash, and call it the function in RAM to swap the flash contents and reboot the MCU.

  4. When the MCU reboots, it will be running the new firmware.

This is just an overview, but I hope it gives you some insight into the process and what is required.

Warm regards,
Mat.

1 Like

Thank you Mat, let me study both options and see whats the best fit for my case right now.