This is my code snippet
int main(void)
{
uint32_t err_code;
...
// Scheduler
scheduler_init();
// Initialize the SoftDevice handler module.
SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, true); // Use scheduler
..... register system event dispatch here .......
// Initialize persistent storage module.
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);
storage_param.block_size = DATA_BLOCK_SIZE;
storage_param.block_count = DATA_BLOCK_COUNT;
storage_param.cb = pstorage_callback;
err_code = pstorage_register(&storage_param, &storage_handle);
APP_ERROR_CHECK(err_code);
err_code = pstorage_block_identifier_get(&m_base_handle, 0, &storage_handle);
APP_ERROR_CHECK(err_code);
err_code = pstorage_clear(&m_base_handle, DATA_BLOCK_COUNT * DATA_BLOCK_SIZE);
APP_ERROR_CHECK(err_code);
// Wait until FLASH all cleared
uint32_t count;
do {
err_code = pstorage_access_status_get(&count);
APP_ERROR_CHECK(err_code);
} while(count); /* Stuck here??? */
....
}
The program stuck in the while segment, and count is always 0x1. Why?