Understanding SPI Flash better

Posted on
  • Hello espruinoers.

    I've skimmed through the espruino firmware source code and noticed that the flash access is abstracted between the internal flash and the external. I am not experienced in hardware but am curious to develop my understanding of how it works.

    I read that writing to flash is done by removing 1's from the cells and that to write 1's an entire block must be reset to 1's. My information source(youtube) described a hierarchy of dies->planes->blocks->pages. My question to you is, how much of this regulation is controlled automatically by the flash controller and how much has to be programmed into the firmware by eg. yourselves. My impression from the Espruino source code is that its all automatically handled?

    I did some research and came under the assumption that the external flash has 10x more endurance for erase/writes ( 10,000 compared to 100,000 ) although this cannot be confirmed because we don't have access to the exact datasheets. I used the Macronix MX25 as described on this forum for being a close match. If the external can handle more write/erase wear, is it being prioritised on the firmware level or is the internal firmware going to be hit harder because its address space that refers to it is smaller. If one starts small and increments up... Should i be concerned?

    If I upload a file with same name that already exists to flash, does the file get moved to new cells?

    Please correct me on all accounts, I'm here for learning.

  • How much of this regulation is controlled automatically by the flash controller and how much has to be programmed into the firmwar

    Espruino can only convert 1s to 0s with a write, and must manually block erase.

    You can get an idea of what's available with http://www.espruino.com/Reference#Flash

    If the external can handle more write/erase wear, is it being prioritised on the firmware level

    On Bangle.js, the external flash is used for everything to be saved. Internal flash isn't use at all.

    If I upload a file with same name that already exists to flash, does the file get moved to new cells?

    Only if it's different. If it is the same, it is kept.

    Espruino basically just works its way around memory 'crossing out' old files and putting new ones in after. It means that it's pretty kind on memory writes since it ends up spreading writes all over the address space.

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

Understanding SPI Flash better

Posted by Avatar for user114097 @user114097

Actions