Hello,I program with nrf52833,NCS v2.9.0.And there is an error happened.
In my main() ,if I place settings_load() at top, it will make my sys resetting.
Cause I need to load param at the first of the sys ready,so placing settings_load() at top.
Can u help to sovle this err?Or do there any other way to store params into flash?Such as flash_write、flash_read and so on?
Best regards.
int main(void)
{
int err;
NRF_POWER->DCDCEN=0; // DCDC disable
if (IS_ENABLED(CONFIG_SETTINGS)) { //If place settings_load() here,some err happened.
settings_load();
}
err = usb_init();
bt_hogp_init(&hogp, &hogp_init_params);
err = bt_conn_auth_cb_register(&conn_auth_callbacks);
if (err) {
printk("failed to register authorization callbacks.\n");
return 0;
}
err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks);
if (err) {
printk("Failed to register authorization info callbacks.\n");
return 0;
}
err = bt_enable(NULL);
if (err) {
printf("Bluetooth init failed (err %d)\n", err);
return 0;
}
printf("Bluetooth initialized\n");
/*
if (IS_ENABLED(CONFIG_SETTINGS)) { //If place settings_load() here,everyting fine
settings_load();
}
*/
if (err == 0) {
printk("Failed to enable USB");
return 0;
}
scan_init();
err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE);
if (err) {
printf("Scanning failed to start (err %d)\n", err);
return 0;
}
printf("Scanning successfully started\n");
return 0;
}