This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pstorage_register returning NRF_INVALID_PARAM after registration second module

Hi, I'm having a problem with registering more than one pstorage_handle_t. So far I believed that I can register as many pstorage_handle_t as I want, but the number of these handlers must be less than PSTORAGE_MAX_APPLICATIONS.

So my code looks like this:

void PStorageBlockHandlersInit()
{
	uint32_t err_code;
    pstorage_module_param_t	blockParams;


	blockParams.block_count = 1;
	blockParams.block_size  = sizeof(uint32_t);
	blockParams.cb 					= PStorage_SerialNumberRetVal_Handler;

	err_code = pstorage_register(&blockParams, &pstorage_serialnumber);
	RTC_Wait(1); //	Wait 125ms to be sure that the block for flashing serial number is registered
		
	//	The block parameters for both: the recent and the oldest readout pointers are the same so don't change them
	err_code = pstorage_register(&blockParams, &pstorage_recentDayReadoutPointer);
	RTC_Wait(1); //	Wait 125ms to be sure that the block for flashing serial number is registered

	
	err_code = pstorage_register(&blockParams, &pstorage_theOldestDayReadoutPointer);
	RTC_Wait(1); //	Wait 125ms to be sure that the block for flashing serial number is registered
	
	err_code = pstorage_register(&blockParams, &pstorage_currentPageStartPointer);
	RTC_Wait(1);
	
	err_code = pstorage_register(&blockParams, &pstorage_currentEventLogPointer);
	RTC_Wait(1);

	blockParams.block_count = EVENT_LOG_SIZE; 			// default 64
	blockParams.block_size  = sizeof(event_log_t);  // default 8 bytes
	blockParams.cb 					= PStorage_SerialNumberRetVal_Handler;

	err_code = pstorage_register(&blockParams, &pstorage_eventLog);
	RTC_Wait(1);
 }	

The first handler - pstorage_serialnumber registers just fine. But the second one returns NRF_INVALID_PARAMS.

Do I make a mistake assuming that I can register more than one pstorage_handle_t?

Related