External flash usage

Hi.

We’re in the early stages of redesigning an existing product to add IoT by replacing our main MCU with a P1.

I’ve read through the P1 data sheet and a fair amount of the firmware repository and I just want to confirm my interpretation of flash usage.

From my reading, the P1 has all of its program flash storage on the 1MB internal memory-mapped flash (at least that’s what the P1 memory map seems to indicate) on the STM32 part and none on the external 1MB SPI-connected MX25L8006E part.

So my questions are then:

  1. Am I wrong about this?
  2. If I’m correct why are there comments like this in the bootloader/main.cpp “// Load the OTA Firmware from external flash” https://github.com/spark/firmware/blob/13faa691e2972ca49989633718bbe6a562f2ea5f/bootloader/src/main.c#L359
  3. What is the purpose then of the external flash? Just large scale data storage?
  4. Is there a way to update the data on the external flash OTA.

Thanks in advance.
Paul

1 Like

Let me ping someone that might be able to help, @rickkas7 are you able to assist?

Kyle

Yes, you are correct. There is 1 MB of flash on the STM32F205 processor and another 1 MB on the SPI flash MX25L8006E which is inside the P1 module but outside the STM32 processor.

There are some comments in this source about loading from external flash because that’s how the Spark Core, which preceded all of the current devices, worked. It used as STM32F105 processor that did not have internal flash, and thus the external flash was required.

The Photon and Electron do not have external SPI flash and use only the STM32F205 internal flash.

One of the best ways to take advantage of the P1 external flash is the flash-eeprom library.

The external flash is not used at all by the system firmware, mainly because it’s only on the P1 and not on the Photon or Electron, so you’re free to use it for whatever you want.

There is no built-in way to update the external flash OTA at this time. You can access it from user firmware so you can use other techniques for loading it, like HTTP or FTP, but there is no built-in support for OTA at this time.

I hope this is helpful,
Rick

2 Likes

Hi Rick.

Thank you very much, this was a very informative response.

Your historical context for the external flash code comments are particularly helpful and I really appreciate them.

Paul.

1 Like