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

Advertisement Data stored in Flash Memory

I have nrf52840 dongle and sdk nRF5_SDK_17.0.0_9d13099.

I would like to know, is there is an example in which, Advertisement Data is stored in flash memory and reading and writing can be done on it.

In order to protect data from getting erase after dongle turns off and on.

I saw the example of storing data in flash memory, but would like to know, how do I point the advertisement data to flash memory.

regards

Shailesh

  • Hi,

    No there isn't an example on this in SDK but you could achieve this by combining BLE with the FDS library. You would have to open the record that contains the stored advertising data and then initialize the advertising_init struct with this data.

    regards

    Jsared

  • Hi Jared,

    I am using Nordic SDK nRF5_SDK_17.0.0_9d13099 and while defining characteristic, i come to a structure, from ble_gatt.h file, structure is as

    /**@brief GATT Attribute. */
    typedef struct
    {
    ble_uuid_t const *p_uuid; 
    ble_gatts_attr_md_t const *p_attr_md; 
    uint16_t init_len; 
    uint16_t init_offs; uint16_t max_len; 
    uint8_t *p_value; /**< Pointer to the attribute data. 
    The stack may access that memory directly without the application's knowledge. For writable characteristics, this value must not be a location in flash memory.*/
    } ble_gatts_attr_t;

    In this structure, p_value is pointing to attribute data and as per SDK, its value location must not be in flash memory.

    If this is so then how can I put advertisement data into flash memory?

    regards

    Shailesh

  • Hi,

    This is regarding deceleration of characteristics if you chose to store the attributes in user controlled part of the memory. Regarding advertisement data, you can store the data that you want to advertise as an fds record and then open the record and set it to ble_advdata_manuf_data_t.

    regards

    Jared 

  • Hi Jsared,

    As per your suggestion, I used the FDS library and stored advertising data.

    but now I am finding an issue is that each time when I write the data, the size of a memory where data is written is increasing.

    After writing data, record_Id of fds_record_desc_t, gets incremented.

    but gc_run_count remains zero only.

    do I have to remove all records, as I just want a single record only?

    regards

    shailesh

  • Hi,

    Are you updating already existing records or are you writing new ones every time? What function are you calling when you write the data?

    regards

    Jared 

Related