How can I write to SiPy flash memory?



  • I need persistent storage for my application and intend to use the internal flash memory. The spec sheet says that there is 4MB flash but I can't find any documentation for using the flash. We are not designing another pcb and intend to just use the sipy board with a power supply for a demo. Without having the ability to use onboard flash memory, the application isnt much use when the power resets which would happen periodically.



  • @jmarcelino Thank you for sharing this. To add to this question, are there code example of we can persist an array of structs to the file system? I have a clear idea of how I want to implement a simple persistent database but I cant find micropython examples of doing so. The btree library would have been great but I realised I couldnt use it in this version of the port.



  • You can write files to the onboard /flash filesystem, there's about 512Kb available

    (the stated 4MB includes the space taken up by two copies of MicroPython and some system storage area)

    See this existing topic on how to read/write to files:

    https://forum.pycom.io/topic/1610/nonvalatile-storage-on-wipy



  • more info about my Sipy
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff9010,len:12
    ho 0 tail 12 room 4
    load:0x3fff9020,len:388
    load:0x40078000,len:11584
    load:0x4009fb00,len:848
    entry 0x4009fc9c
    MicroPython v1.8.6-724-g2b9ed601 on 2017-07-28; SiPy with ESP32
    Type "help()" for more information.

    import os
    os.uname()
    (sysname='SiPy', nodename='SiPy', release='1.7.8.b1', version='v1.8.6-724-g2b9ed601 on 2017-07-28', machine='SiPy with ESP32', sigfox='1.0.
    1')



Pycom on Twitter