This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to create a Specific Flash memory section/page to store specific data structures and how access the those data structure variables.

Hi Team,

I want to create on flash section to store the specific data like Crypto Keys and Serial numbers. How to create one page/section in existing Flash memory without disturbing the rest of the flash pages.

How to access the that specific flash section for Read/write access.Is there any byte limit to write/read Flash Api's.

Could any one help me out on this query and please provide any direct example code for the above scenarios.By looking to the library code we are not able to understand API's how to use those.

Regards,

Srinivas. V

  • Hello,

    Does the rest of your application use flash actively? That is, for other than storing the application itself... Do you use bonding? Or fds or fstorage for anything else?

    Do you intend to change this data during the lifetime of the product, or only once during the initial programming?

    If you don't intend to change this information ever, you can check if you have enough data in the customer registers in the UICR

    If you need more space. Do you intend to rewrite during the lifetime? If not, you can use fstorage to write it to a specific address (preferrably right below the FDS pages if you use FDS). If you also plan to use a bootloader, make sure to reserve one extra page in the pages reserved for application flash (look for the definition NRF_DFU_APP_DATA_AREA_SIZE in sdk_config.h in the bootloader).

    If you do intend to update these data from time to time, I would recommend that you just store them as FDS records. The FDS module will handle the actual reading and writing, and will handle the physical addresses of the records when you want to update the record, write a new, or delete a record.

    Best regards,

    Edvin

  • Hi Edvin,

    Thanks for your reply, I will give more inputs on my requirement.

    1. we need the space at around 1k, and the data should be updated from time to time.

    2. Regarding FDS module how to use it,

        1. How many predefined FDS Pages we are having in NRF52840 SOC and  what is the base address each FDS page.

        2 What is the MAX size of each page in FDS.

        3. How many records we can create in one FDS page, and is there any specific rule to create RECORD Keys.

        4. What is the min size of each record, and if we want to Read/Write the each record seperately how to access that record with out disturbing the other records in that page.

       5. How to create FID and RECORD_KEY, in the example and forum given different ID's,      

                         #define FILE_ID 0x0001                   /* The ID of the file to write the records into. */
                         #define RECORD_KEY_1     0x1111
                         #define CONFIG_FILE           (0x8010)
                        #define CONFIG_REC_KEY   (0x7010)
    Is there any list of FILE ID's and REC_KEY and from there we have to choose or randomly we need to define any ID's.

      6. For this requirement is there any other approach is best fit or FDS is correct for this.

        Here i am giving the sample structure for loading into FDS.

    If we want to update each member seperately, how to do it, we need to create separate record for each data member or we need to group one or two members or entire structure we need to put in single record, which method is best fit for our requirement.

    Eg Structure,

    typedef struct
    {
    uint8_t kBox[KEYSIZE];   , 
    uint8_t kSys[KEYSIZE];
    uint8_t kOld[KEYSIZE];
    uint16_t kSysVersion;
    uint16_t kOldVersion;
    uint16_t kRolloverStarted;
    uint16_t kOldDayExpires;
    uint8_t FLA_family_c;
    uint8_t FLA_product_c;
    uint8_t FLA_beacon_pwr;
    uint8_t FLA_beacon_period;
    uint8_t FLA_bluetooth_features;
    uint8_t FLA_iBeacon_Major[2];
    uint8_t FLA_iBeacon_Minor[2];
    uint8_t FLA_bad_key_max;
    uint8_t FLA_bad_code_max;
    uint8_t FLA_bad_cookie_max;
    uint8_t FLA_lockout_time;
    int8_t FLA_temp_cal;
    uint8_t FLA_RTC_temp_comp_interval;
    uint8_t FLA_RTC_temp_comp_value;
    uint8_t FLA_reserve_16;
    uint8_t FLA_max_key_adjust;
    uint16_t FLA_max_annual_adjust;
    uint16_t FLA_max_turn_on_time;
    uint16_t FLA_max_base_on_time;
    uint8_t FLA_translate_char;
    uint8_t FLA_reserve_25;
    uint16_t FLA_BT_ADV_MFG_ID;
    uint8_t FLA_reserve_28;
    uint8_t FLA_reserve_29;
    uint8_t FLA_reserve_30;
    int8_t FLA_timezone;
    uint8_t FLA_reserve_32;
    uint8_t FLA_reserve_33;
    uint32_t FLA_lock_capabilities;
    uint8_t FLA_iBeacon_UUID[16];
    uint8_t FLA_iBeacon_Power;
    uint8_t FLA_reserve34;
    uint8_t FLA_lc_key[KEYSIZE];
    uint8_t FLA_host_key[KEYSIZE];


    } FLA_SNV_sysStruct_t;

    Regards,

    Srinivas.V

  • Hi Edvin,

    Thanks for your reply, I will give more inputs on my requirement.

    1. we need the space at around 1k, and the data should be updated from time to time.

    2. Regarding FDS module how to use it,

        1. How many predefined FDS Pages we are having in NRF52840 SOC and  what is the base address each FDS page.

        2 What is the MAX size of each page in FDS.

        3. How many records we can create in one FDS page, and is there any specific rule to create RECORD Keys.

        4. What is the min size of each record, and if we want to Read/Write the each record seperately how to access that record with out disturbing the other records in that page.

       5. How to create FID and RECORD_KEY, in the example and forum given different ID's,      

                         #define FILE_ID 0x0001                   /* The ID of the file to write the records into. */
                         #define RECORD_KEY_1     0x1111
                         #define CONFIG_FILE           (0x8010)
                        #define CONFIG_REC_KEY   (0x7010)
    Is there any list of FILE ID's and REC_KEY and from there we have to choose or randomly we need to define any ID's.

      6. For this requirement is there any other approach is best fit or FDS is correct for this.

        Here i am giving the sample structure for loading into FDS.

    If we want to update each member seperately, how to do it, we need to create separate record for each data member or we need to group one or two members or entire structure we need to put in single record, which method is best fit for our requirement.

    Eg Structure,

    typedef struct
    {
    uint8_t kBox[KEYSIZE];   , 
    uint8_t kSys[KEYSIZE];
    uint8_t kOld[KEYSIZE];
    uint16_t kSysVersion;
    uint16_t kOldVersion;
    uint16_t kRolloverStarted;
    uint16_t kOldDayExpires;
    uint8_t FLA_family_c;
    uint8_t FLA_product_c;
    uint8_t FLA_beacon_pwr;
    uint8_t FLA_beacon_period;
    uint8_t FLA_bluetooth_features;
    uint8_t FLA_iBeacon_Major[2];
    uint8_t FLA_iBeacon_Minor[2];
    uint8_t FLA_bad_key_max;
    uint8_t FLA_bad_code_max;
    uint8_t FLA_bad_cookie_max;
    uint8_t FLA_lockout_time;
    int8_t FLA_temp_cal;
    uint8_t FLA_RTC_temp_comp_interval;
    uint8_t FLA_RTC_temp_comp_value;
    uint8_t FLA_reserve_16;
    uint8_t FLA_max_key_adjust;
    uint16_t FLA_max_annual_adjust;
    uint16_t FLA_max_turn_on_time;
    uint16_t FLA_max_base_on_time;
    uint8_t FLA_translate_char;
    uint8_t FLA_reserve_25;
    uint16_t FLA_BT_ADV_MFG_ID;
    uint8_t FLA_reserve_28;
    uint8_t FLA_reserve_29;
    uint8_t FLA_reserve_30;
    int8_t FLA_timezone;
    uint8_t FLA_reserve_32;
    uint8_t FLA_reserve_33;
    uint32_t FLA_lock_capabilities;
    uint8_t FLA_iBeacon_UUID[16];
    uint8_t FLA_iBeacon_Power;
    uint8_t FLA_reserve34;
    uint8_t FLA_lc_key[KEYSIZE];
    uint8_t FLA_host_key[KEYSIZE];


    } FLA_SNV_sysStruct_t;

    Regards,

    Srinivas.V

Related