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

BT_SETTINGS CCCD creates more flash storage

HI,

i have enabled CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE=y

so after power cycle the device automatically connects with iphone and the service also works fine

after this

I found that RAM flash memory

gets increase at every disconnect and connect

Example

I connect the device with nrf connect app desktop -> programmer

i read the device and found

flash NVM size  25 bytes from F8000

                          24 bytes from F8FF7.

after connected and paired with iphone 8 plus

flash NVM size  158 bytes from F8000

                          72 bytes from F8FF7.

again read the device

flash NVM size  195 bytes from F8000

                          104 bytes from F8FF7.

I need to work on DFU and also NVM flash storage to store 5KB data. My concern is because of this memory increase . where it get collapse or not

to memories the CCCD where only enable is memorize and disable is not to be memorize is it possible

because

when device is out of bound then it will disconnect at the time memory will increase and then in bound it auto connect and that also write .

i want to control this only write the enable function

2. How to delete the particular CCCD stored flash page

3. how to delete the pair bond stored flash page . peer bond data is controlled by softdevice

Parents Reply Children
  • Looking at the documentation for NVS, https://docs.zephyrproject.org/latest/reference/storage/nvs/nvs.html it seem to be erased first when a sector is full.
    "Elements are appended to a sector until storage space in the sector is exhausted. Then a new sector in the flash area is prepared for use (erased)."

    Sunil vignesh said:

    1 . if i set max_pair to be 1 when i connect second device it will over write  if i enable keys_overwrite_oldest?

     Yes, or marked it as invalid and erase it later when it needs the space.

    Sunil vignesh said:

    2. what will happen for CCCD flash writes how to over write the CCCD enable disable in same flash address

     You should not manually change this value from the application. The Bluetooth Host takes care of keeping this value correct.

    Sunil vignesh said:
    3. Is it possible to delete the pairing data from flash storage . and how?

     If you want to remove the bond/pair, use bt_unpair()

    Sunil vignesh said:
    before dfu the flash starts at 0xF8000 and now it starts at 0xFE000 why?

     Perhaps NVS started to use a new sector. The flash space reserved for storage can be found in the dts. E.g.

    					storage_partition: partition@f8000 {
    						label = "storage";
    						reg = < 0xf8000 0x8000 >;
    					};

  • Hi Sigurd,

    Yes, In board files .dts

    having storage partition @f8000

    0xf8000 -  0x8000

    without dfu the peer bond date starts at f8000

    and same config

    while using dfu

    the starting address is changed from f8000 to fe000

    how it is happening

  • Each sector is 4kB, could be it needed to erase something, so therefore it stared to use a new sector (within the allocated area for NVS).

Related