This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Having 2 separate application data - one with FDS and one with fstorage

Hi Nordic Dev Team,

I've got an application where I want to store two types of log data in my memory flash that I want to send to server eventually via BLE mobile app.

1. Smaller chunk log data - dynamic size, but the maximum size will be under the maximum byte size of one page.

Allocated Flash : 252kB (max can't be determined since dynamic)

I am quite happy with in my implementation with fds here, which gives some advantages:

  • I can identify which latest record in the flash that has been updated to the server, so the next time new records are appended onto the flash, the nrf will just send from the latest record synced to server -> newest record in the flash.
  • I could also just "delete" (invalidates) the record that has been synced, and create a new one without worrying about the erase cycle limit until the fds_gc() is performed.

2. Huge chunk of raw data - fixed size (each 48020 Bytes), but the maximum size will span across multiple pages (minimum 12 pages for one chunk of raw data).

Allocated Flash : 252kB (max 5 chunk of raw data)

I could potentially use fds for the raw data, but it will require me to divide these chunks across 12 flash pages for every raw data by myself.

Since this operation could happen occasionally, I don't want this raw data shared space with the smaller chunk log data with fds.

The raw data is more for R&D purpose to identify root cause of the output of log data.

The log data has to work well all the time and the risk is sort of mitigated with the implementation of fds and relatively small chunk of data. 

I wouldn't mind that the flash addresses allocated for raw data failed after 10,000 erase cycle across the lifetime of the product.

---------

Since fds doesn't allow you set a fixed addresses for your records, but only through flash_bounds_set() where I have set 130 pages with each page size of 4096Bytes, in total of 532480 Bytes. I understand that this is reserved for fds under APPLICATION DATA memory layout.

static void flash_bounds_set(void)
{
    uint32_t flash_size  = (FDS_PHY_PAGES * FDS_PHY_PAGE_SIZE * sizeof(uint32_t));
    m_fs.end_addr   = flash_end_addr();
    m_fs.start_addr = m_fs.end_addr - flash_size;
}

My Questions:

1. Would I be able to set 2 separate application data of fds not having them share the same boundaries? (e.g.  0x0000- 0x1000 - log data, 0x0000 - 0x2000 - raw data) 

Since my raw data will invalidate a huge chunk of the flash addresses if I use fds, therefore potentially reducing the amount that I can write for my log data.

2. Would I be able to use fds and fstorage implementation at the same time?

I understand that fds used fstorage internally. I think with fstorage, I will be able to know the exact flash address of where my raw data will be stored all the time. It still depends on Question 1 of whether I can set certain flash addresses for certain type of data, since I don't mind if these part of the flash addresses become bad.

Parents
  • Hi Ricco, 
    I agree with Markku that you would just use FDS to store your smaller trunk of data and then define a 2nd instance of fstorage independent from the fstorage instance of FDS to handle  your raw log data.  The 2nd instance fstorage can have a different start and end address of flash for storage. 

    If you support DFU and want to preserve the application data, the NRF_DFU_APP_DATA_AREA_SIZE configuration must cover both the flash areas of fds and 2nd instance of fstorage. 

    As far as I know fds doesn't support storing a record larger than a Virtual flash page (which equals one flash page)

  • Thanks for the answer. Could I have more than 2 instance of fstorage, let say if I want to add another types of data logs with different boundaries?

Reply Children
Related