Topics

Persistent memory issue (NVS and FCB) - Zephyr V1.X versus V2 #ble #nrf52

frv
 

Hi all,

I have the following setup:
- nrf52 demo kit running a simple BLE peripheral application
- Raspberry Pi running a BLE central application

A secured connection is made (authentication based on fixed passkey) and paired information is made persistent (bonded).

I set in the peripheral's prj.conf file the following options:
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_FCB=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_FCB=y

In V1.X this sometimes resulted in system crash when restarting the peripheral or when the connection was broken en reconnected for paired devices

When I built my project in V2.X with these options, I get ALWAYS a OS usage FAULT, Illegal load of EXC_RETURN into PC and results further in a FATAL ERROR and halts the system.

However when I use these options in V2.X:

CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

no more system crash. 

I'm wondering if the issue is related to Flash Circular Buffer support (https://docs.zephyrproject.org/1.13.0/reference/kconfig/CONFIG_FCB.html)
CONFIG_FCB=y
CONFIG_SETTINGS_FCB=y

In the peripheral sample applic distributed with V2.X CONFIG_SETTINGS_FCB is replaced by CONFIG_NVS

Best regards,
Frank

Carles Cufi
 

Hi there,

 

One of the likely culprits is stack sizing.

Please enable CONFIG_HW_STACK_PROTECTION and verify that one of your stacks is not overflowing.

 

Regards,

 

Carles

 

From: devel@... <devel@...> On Behalf Of frv via Lists.Zephyrproject.Org
Sent: 06 December 2019 13:38
To: devel@...
Cc: devel@...
Subject: [Zephyr-devel] Persistent memory issue (NVS and FCB) - Zephyr V1.X versus V2 #ble #nrf52

 

Hi all,

I have the following setup:
- nrf52 demo kit running a simple BLE peripheral application
- Raspberry Pi running a BLE central application

A secured connection is made (authentication based on fixed passkey) and paired information is made persistent (bonded).

I set in the peripheral's prj.conf file the following options:

CONFIG_BT_SETTINGS=y

CONFIG_FLASH=y

CONFIG_FLASH_PAGE_LAYOUT=y

CONFIG_FLASH_MAP=y

CONFIG_FCB=y

CONFIG_SETTINGS=y

CONFIG_SETTINGS_FCB=y

In V1.X this sometimes resulted in system crash when restarting the peripheral or when the connection was broken en reconnected for paired devices


When I built my project in V2.X with these options, I get ALWAYS a OS usage FAULT, Illegal load of EXC_RETURN into PC and results further in a FATAL ERROR and halts the system.

However when I use these options in V2.X:

CONFIG_BT_KEYS_OVERWRITE_OLDEST=y

CONFIG_BT_SETTINGS=y

CONFIG_FLASH=y

CONFIG_FLASH_PAGE_LAYOUT=y

CONFIG_FLASH_MAP=y

CONFIG_NVS=y

CONFIG_SETTINGS=y


no more system crash. 

I'm wondering if the issue is related to Flash Circular Buffer support (https://docs.zephyrproject.org/1.13.0/reference/kconfig/CONFIG_FCB.html)

CONFIG_FCB=y

CONFIG_SETTINGS_FCB=y

In the peripheral sample applic distributed with V2.X CONFIG_SETTINGS_FCB is replaced by CONFIG_NVS

Best regards,
Frank

frv
 

Hi Carles,

Thanks for the tip. I would be really surprised that I already have a stack issue, as the application is still very simple... Nevertheless it can't harm to have this option enabled.

Br,
Frank