Shop OBEX P1 Docs P2 Docs Learn Events
Can the empty space on Flash be used to store settings — Parallax Forums

Can the empty space on Flash be used to store settings

When flashing any program to the flash with Proptool, Flexprop, Tachoz etc

is the flash empty space left intact, or erased each time?

I have a handful of values that I prefer to store in flash if possible

The next question would be how to see how much space is on the flash for such user data, and then how to W/R some test data starting at the extreams of the flash space.

Finally, JonnyMac described in a post that the Flash chips have some unique serial that can be read, anyone know how to do that in a few lines of code.

Comments

  • ke4pjwke4pjw Posts: 1,155

    Andy, I save and load configuration items to and from SD and I am sure you can do the same with flash. Here is the memory structure and how I load and save those values. If I need to add a new config item, which I did, I place the new config variable after the last one, and then update the last one in the read/write data object to determine how many bytes to load.

    I highly suspect you can do a similar thing with Chip's Flash filesystem.

            long PIXELCONFIG[124]
            long E131CONFIG[432]
            byte MACADDRESS[6]  ' Must be unique per layer 2 network
            byte IPADDRESS[4]
            byte SUBNETMASK[4]
            byte GATEWAY[4]
            byte DHCP 'Non zero
            byte BRIGHTNESS
            byte DNS[4]
            byte SPEEDDUPLEX
    
      if not \FS.openfile(string("blitzen.cfg"),"R")
    
        debug("Opened")
        FS.readData(@PIXELCONFIG, @SPEEDDUPLEX - @PIXELCONFIG + 1)
        FS.closeFile()
    
    pub writeconfig()
    
        if not \FS.openfile(string("blitzen.cfg"),"W")
    
          debug("Writing Configuration to SD Card.", $0D, $0A)
          FS.writeData(@PIXELCONFIG, @SPEEDDUPLEX - @PIXELCONFIG + 1)
          FS.closeFile()
    
        else
    
          debug("Unable to write config. Aborting.", $0D, $0A)
          abort
    
  • ke4pjwke4pjw Posts: 1,155

    Here is a link to the flash filesystem.

    https://obex.parallax.com/obex/p2-flash-filesystem/

  • JonnyMacJonnyMac Posts: 9,105

    The attached demo will get you started. If you want to write and read standard files, Chip wrote a file system for the flash that is maintained by Steven Moraco. You will find threads about it with a quick search.

Sign In or Register to comment.