I used to store 10 bytes to flash with pstorage under sdk version 8.2 and it always worked fine. As I also use the mesh app, the timeslot_handler dispatches the pstorage events like this:
case NRF_EVT_FLASH_OPERATION_SUCCESS:
case NRF_EVT_FLASH_OPERATION_ERROR:
pstorage_sys_event_handler(evt);
break;
Now I updated to sdk10 and the storage_callback_handler is no longer called for store, update and clear operations. Has there been a change in the pstorage api that I missed? This is the init and store code:
void storage_callback_handler(pstorage_handle_t * handle,
uint8_t op_code,
uint32_t result,
uint8_t * p_data,
uint32_t data_len)
{
m_result = result;
SEGGER_RTT_printf(RTT_CHANNEL, "callback handler called\n");
if(handle->block_id == pstorage_wait_handle)
{
pstorage_wait_flag = 0;
}
}
uint32_t localizer_storage_init(void)
{
pstorage_module_param_t param;
uint32_t error_code = pstorage_init();
if(error_code != NRF_SUCCESS)
{
return error_code;
}
param.block_size = LOCALIZER_LEN;
param.block_count = 1;
param.cb = storage_callback_handler;
error_code = pstorage_register(¶m, &m_localizerHandle);
if(error_code != NRF_SUCCESS)
{
return error_code;
}
return NRF_SUCCESS;
}
uint32_t localizer_store(void)
{
uint32_t error_code;
pstorage_handle_t block_handle;
error_code = pstorage_block_identifier_get(&m_localizerHandle, 0, &block_handle);
if (error_code == NRF_SUCCESS)
{
SEGGER_RTT_printf(RTT_CHANNEL, "localizer_store clear\n");
pstorage_wait_handle = block_handle.block_id; //Specify which pstorage handle to wait for
pstorage_wait_flag = 1; //Set the wait flag. Cleared in the example_cb_handler
error_code = pstorage_clear(&block_handle, LOCALIZER_LEN);
if (error_code != NRF_SUCCESS)
{
return error_code;
}
while(pstorage_wait_flag)
{
app_sched_execute();
sd_app_evt_wait();
} //Sleep until store operation is finished.
SEGGER_RTT_printf(RTT_CHANNEL, "localizer_store ");
for(int i=0; i<MAX_LOCVAL_LEN; i++)
{
SEGGER_RTT_printf(RTT_CHANNEL, "%02x", m_localizer[i]);
}
SEGGER_RTT_printf(RTT_CHANNEL, "\n");
pstorage_wait_handle = block_handle.block_id; //Specify which pstorage handle to wait for
pstorage_wait_flag = 1; //Set the wait flag. Cleared in the example_cb_handler
error_code = pstorage_store(&block_handle, (uint8_t *)&m_localizer, LOCALIZER_LEN, 0);
if (error_code != NRF_SUCCESS)
{
return error_code;
}
while(pstorage_wait_flag)
{
app_sched_execute();
sd_app_evt_wait();
} //Sleep until store operation is finished.
if (m_result != NRF_SUCCESS)
{
return m_result;
}
}
return NRF_SUCCESS;
}