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

pstorage_load stops Ble_advertising

Hey , My application stores the data on BLE disconnect to pstorage succesfully. But on reset if i try to read the data from pstorage it stops advertising, but the pstorage_load returns the same value that i stored previously.

can anyone please help me with this. Here is my code

       int main(void)
 {
	ret_code_t err_code ;
	
	SEGGER_RTT_WriteString(0, "Initialization...\n");
	// Initialize.
    timers_init();
    ble_stack_init();
	pstorage_test_init();
	gap_params_init();
services_init();
advertising_init();
conn_params_init();
	gpiote_init();
		
SEGGER_RTT_WriteString(0, "Advertising starts..\n");
advertising_start();
	
  appRTCInit();
  epoch_pstorage_load();
// Enter main loop.
for (;;)
{
    power_manage();
}

}

i have attached my code

main.c

image description

Parents
  • the module is not advertising at all. if i comment epoch_pstorage_load(); function it is advertising . the code snippet for epoch_pstorage_load() is : void epoch_pstorage_load() { uint8_t dest_data_0[4]; uint32_t retval; uint8_t i; uint32_t count;

    	char 										recieved_data[20];					
    	SEGGER_RTT_WriteString(0,"pstorage load blocks 0 \r\n");
    	retval= pstorage_load(dest_data_0, &block_handle, 32, 0);				 //Read from flash, only one block is allowed for each pstorage_load comman		
    	if(retval != NRF_SUCCESS)
    	{	
    		SEGGER_RTT_WriteString(0,"Error in Store Pstorage");
    	}
    	
    	for( i= 0; i<4 ;i++)
    	{
    	sprintf(recieved_data," Load Data:%x\n",dest_data_0[i]);
      SEGGER_RTT_WriteString(0, recieved_data);
    	}
    
    	pstorage_wait_handle = block_handle.block_id;            
    pstorage_wait_flag = 1;                                    
    pstorage_clear(&block_handle, 32);
    while(pstorage_wait_flag) { power_manage(); }
    

    }

Reply
  • the module is not advertising at all. if i comment epoch_pstorage_load(); function it is advertising . the code snippet for epoch_pstorage_load() is : void epoch_pstorage_load() { uint8_t dest_data_0[4]; uint32_t retval; uint8_t i; uint32_t count;

    	char 										recieved_data[20];					
    	SEGGER_RTT_WriteString(0,"pstorage load blocks 0 \r\n");
    	retval= pstorage_load(dest_data_0, &block_handle, 32, 0);				 //Read from flash, only one block is allowed for each pstorage_load comman		
    	if(retval != NRF_SUCCESS)
    	{	
    		SEGGER_RTT_WriteString(0,"Error in Store Pstorage");
    	}
    	
    	for( i= 0; i<4 ;i++)
    	{
    	sprintf(recieved_data," Load Data:%x\n",dest_data_0[i]);
      SEGGER_RTT_WriteString(0, recieved_data);
    	}
    
    	pstorage_wait_handle = block_handle.block_id;            
    pstorage_wait_flag = 1;                                    
    pstorage_clear(&block_handle, 32);
    while(pstorage_wait_flag) { power_manage(); }
    

    }

Children
No Data
Related