1 Reply Latest reply on Feb 18, 2016 5:15 AM by andre.milack_3147711

    Storing persistent data

    andre.milack_3147711

      Hi.

       

      I am working on an application which generates a chunk of 20 bytes of data now and then, say every 10 seconds. I would like to keep a buffer in the memory flash containing the last 50 chunks or so, such that I can reset the device and still retrieve those chunks. How could I do that?

       

      The only approach I could come up with so far is to use the DCT app section to store this data. I may be wrong, but every call to wiced_dct_write_app_section() erases the entire section, so I would have my whole buffer completely rewritten every time a new chunk is generated. I would like to be capable of erasing and writing only the memory space needed to store a single chunk, to prevent the flash memory from wearing out too early.

       

      Just for information, I am using WICED SDK 2.4.1 and the evaluation boards Murata SN8200 and Inventek ISM43362.

       

      Thanks in advance!

        • 1. Re: Storing persistent data
          andre.milack_3147711

          I finally managed to implement the persistent storage I needed. I don't know if that is the most appropriate way to do this, but I found out that by including "waf_platform.h" header I can use the functions platform_write_flash_chunk() and platform_erase_flash() to do the operations on the flash memory.

           

          Unfortunatelly, the flash memory on the STM32F205, which is used by the Inventek module, can only be erased at sector level. The memory is organized in sectors of 16KB, 64KB and 128KB. The smaller sectors are already used for the bootloader, DCT and application, so the only sectors available I've got are the last ones, with 128KB each.

           

          So I decided to use two sectors, in a way that every time the buffer gets full one sector will be erased, leaving half of the current data still there. Then I can guarantee that at least the last 128KB of data will be preserved (and 256KB at most). That is way bigger than what I had in mind (1 or 2 KB), but as long as my application barely takes half of the available flash memory, I think there will be no problem.