• Hi,

    I just thought of this and I just want to see if it will work. I want to see if I can multi-boot a microcontroller, such as an ESP32 or STM32 chip from multiple flash chips. For example, I can have Espruino on one chip, Micropython in the other, Lua on the third, etc. I think it will be awesome but before I make it I want to see if it's possible. If it is, how hard would it be?


    P.S. Massive congrats to Gordon for getting 658% of his funding goal for Bangle.JS as of November 24 2019! I can't wait for the new device and wish Gordon the best on his embedded endeavors.

  • I think it depends on the microcontroller - most normal chips want you to run code out of on-chip flash, which obviously messes you up. However some chips allow you to memory-map external flash memory. ESP8266/32 specifically execute all user code from external flash, so I see no reason why you couldn't swap the flash chips out

  • I would guess it could work, but speed might be an issue: routing the traces on a PCB, and the added capacitance of multiple flash chips might cause problems.
    I think this would be a one-off, or a low volume trial, so designing and populating a custom pcb would almost surely be more expansive than 3 off the shelf boards. Maybe you could try stack the flash chips on top of each other, and use some switch to select one. Maybe just switching the CS might work. Or might not. No idea honestly.
    For ESP32, most likely it would be cheaper and easier to just use multiple low-cost devkits. Just leave it in the breadboard with the circuitry you are working with. Unless your goal is to try to solve the same problem in the same circuit in different languages. But still, you can pull the whole devkit.
    For STM32 external flash would be harder, because I think only high-end ones have only external flash. But just replace the cpu-board, if you work with Nucleo boards, or some other lowish-cost option (you can get ~4€ F401, or ~10€ F407 STM32 boards from aliexpress)

  • Maybe just switching the CS might work. Or might not. No idea honestly.

    Well, different CS pin should be all that is needed, that is how SPI works. Without CS selected spi slaves should ignore everything. So hopefully with stacked chips on top like this even the dual and quad SPI that reuses WP and HOLD pins for data i/o should work as long as CS is properly used. At least it is mentioned here https://embeddedinventor.com/quad-spi-ev­erything-you-need-to-know/ near the end - "multiple devices can be linked to a single Quad-SPI interface and the same data lines can be connected to multiple devices. To select a particular chip, the chip select pin can be used. "

    Maybe that is even how it works with SPI flash and SPI SRAM on ESP32 now - flash and sram is on same SPI bus. EDIT: yes, documented here

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Can I multi-boot microcontroller with multiple external flash chips?

Posted by Avatar for BootySnorkeler @BootySnorkeler