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
  • Solved it. need to Verify if there is any flash access pending below is the function that needs to be called after every pstorage api(like clear, store, load)

    bool storage_isPstorageBusy() { uint32_t retval; uint32_t count;

    // Verify if there is any flash access pending, if yes - return true
    retval = pstorage_access_status_get(&count);
    if (retval != NRF_SUCCESS)		
         {				
    	return false;
    }    
    return (count!=0)?true:false;    
    

    }

Reply
  • Solved it. need to Verify if there is any flash access pending below is the function that needs to be called after every pstorage api(like clear, store, load)

    bool storage_isPstorageBusy() { uint32_t retval; uint32_t count;

    // Verify if there is any flash access pending, if yes - return true
    retval = pstorage_access_status_get(&count);
    if (retval != NRF_SUCCESS)		
         {				
    	return false;
    }    
    return (count!=0)?true:false;    
    

    }

Children
No Data
Related