I'm following the official tutorial for using pstorage and this the simplest test code I've come up with:
static pstorage_handle_t base_handle;
static void test_pstorage_cb_handler(pstorage_handle_t * p_handle,
uint8_t op_code,
uint32_t result,
uint8_t * p_data,
uint32_t data_len)
{
}
void pstorage_test(void)
{
uint32_t res;
res = pstorage_init();
APP_ERROR_CHECK(res);
pstorage_module_param_t param;
memset(¶m, 0, sizeof(param));
param.block_size = 24;
param.block_count = 10;
param.cb = test_pstorage_cb_handler;
res = pstorage_register(¶m, &base_handle);
APP_ERROR_CHECK(res);
pstorage_handle_t block_handle;
res = pstorage_block_identifier_get(&base_handle, fault_id, &block_handle);
APP_ERROR_CHECK(res);
res = pstorage_clear(&block_handle, 24 * 10);
APP_ERROR_CHECK(res);
}
Despite all function call returning NRF_SUCCESS
, I never get callbacks and pstorage_access_status_get()
continuously returns 1
.
What could I be doing wrong?
EDIT:
My main()
:
int main(void)
{
timers_init();
gpiote_init();
ble_stack_init();
bsp_module_init();
scheduler_init();
gap_params_init();
advertising_init();
services_init();
conn_params_init();
sec_params_init();
pstorage_test();
while (1) app_sched_execute();
}