Hi, I'm having a problem with calling pstorage_register(); The first I call pstorage_register() is just fine, but the second I call return the nrf_invalid_param.Here is the code:
#define PSTORAGE_NUM_OF_PAGES 2
#define PSTORAGE_MAX_APPLICATIONS 10
#define PSTORAGE_MIN_BLOCK_SIZE 4
#define PSTORAGE_MAX_BLOCK_SIZE 0x0400
#define PSTORAGE_CMD_QUEUE_SIZE 10
#define DATA_FLASH_SIZE 1024
#define DATA_FLASH_BLOCK 1
//page zero
param_j.block_size = DATA_FLASH_SIZE;
param_j.block_count = DATA_FLASH_BLOCK;
param_j.cb = data_pstorage_cb_handler;
err_code = pstorage_register(¶m_j, &data_storage_handle[0]);
if (err_code == NRF_SUCCESS)
{
err_code = pstorage_clear( &data_storage_handle[0], DATA_FLASH_SIZE );
}
//page one
err_code = pstorage_register(¶m_j, &data_storage_handle[1]);
if (err_code == NRF_SUCCESS)
{
err_code = pstorage_clear( &data_storage_handle[1], DATA_FLASH_SIZE );
}
//page two
err_code = pstorage_register(¶m_j, &data_storage_handle[2]);
if (err_code == NRF_SUCCESS)
{
err_code = pstorage_clear( &data_storage_handle[2], DATA_FLASH_SIZE );
}
//page three
err_code = pstorage_register(¶m_j, &data_storage_handle[3]);
if (err_code == NRF_SUCCESS)
{
err_code = pstorage_clear( &data_storage_handle[3], DATA_FLASH_SIZE );
}