Topics

How to configure #NVS if #FCB in used for #BluetoothMesh ? #bluetoothmesh #fcb #nvs

vikrant8051 <vikrant8051@...>
 

Hi all,

I wanna use #NVS to save #BluetoothMesh Models states.

As per current implementation, #BluetoothMesh stack is using #FCB for persistent storage.

If I use #NVS (with default setting) along with #FCB, and try to save some data using it, then it pushes NODE into unprovisioned state. This should be because of overlapping.

Solution is to modify NVS's storage offset. For e.g.

#define NVS_STORAGE_OFFSET (FLASH_AREA_STORAGE_OFFSET - 4096)

But it will be not a good idea, if #DFU_OTA going to be part of project. Am i right ?

Do anyone have better solution ?

Thank You !!






Puzdrowski, Andrzej
 

Hi

 

As you notice right now it is impossible to use both NVS and FCB out of the box. So you need a hack.

I think finally this problem should be resolved by introduction of dedicate flash slot which are described via DTS (similar to the current one, the  STORAGE_PARTITION).

STORAGE_PARTITION might be kept for situation where it is only storage partition.

Unfortunately I don’t have time right now to improve this. Any contribution and further comment regard this are highly welcome 😃

 

Andrzej

 

From: devel@... [mailto:devel@...] On Behalf Of vikrant8051
Sent: Monday, June 04, 2018 4:50 PM
To: devel@...; users@...
Cc: Laczen JMS <laczenjms@...>
Subject: [Zephyr-devel] How to configure #NVS if #FCB in used for #BluetoothMesh ?

 

Hi all,

 

I wanna use #NVS to save #BluetoothMesh Models states.

 

As per current implementation, #BluetoothMesh stack is using #FCB for persistent storage.

 

If I use #NVS (with default setting) along with #FCB, and try to save some data using it, then it pushes NODE into unprovisioned state. This should be because of overlapping.

 

Solution is to modify NVS's storage offset. For e.g.

 

#define NVS_STORAGE_OFFSET (FLASH_AREA_STORAGE_OFFSET - 4096)

 

But it will be not a good idea, if #DFU_OTA going to be part of project. Am i right ?

 

Do anyone have better solution ?

 

Thank You !!

 

 

 

 

 

 

laczenJMS
 

Hi Vikrant,

At the moment the default settings for NVS and FCB are indeed
overlapping; you cannot use them at the same time. To use NVS and FCB
together my advice would be to look at the board dts file and to
shrink the image partitions so that there is more space at the end of
flash for storage. NVS needs a minimum of 2 sectors of each one flash
page. Shrinking the image partitions will probably require you to
rebuild and flash mcuboot.

I would not just set the NVS offset to FLASH_AREA_OFFSET - 4096. If on
your system the flash page size is 4096 bytes, the second sector of
NVS will still overlap. As soon as you reach the end of the first
sector you will overwrite the first flash page of FCB.

Kind regards,

Jehudi