Hello Everyone ,
I want to use pstorage for my project.i get the example code from here devzone.nordicsemi.com/.../ and its working properly(i.e read and write operation). but when i modified it for my requirement as given below its not to read the data what i have write .what mistake i am doing.
//Get block identifiers
pstorage_block_identifier_get(&handle, 0, &block_0_handle);
pstorage_clear(&block_0_handle, 32); //Clear 32 bytes
pstorage_wait_handle = block_0_handle.block_id; //Specify which pstorage handle to wait for
pstorage_wait_flag = 1; //Set the wait flag. Cleared in the example_cb_handler
//Store data to block one. Wait for the last store operation to finish before reading out the data.
pstorage_store(&block_0_handle, source_data_0, 16, 0); //Write to flash, only one block is allowed for each pstorage_store command
while(pstorage_wait_flag) {
power_manage();
} //Sleep until store operation is finished.
pstorage_wait_handle = block_0_handle.block_id; //Specify which pstorage handle to wait for
pstorage_wait_flag = 1; //Set the wait flag. Cleared in the example_cb_handler
pstorage_load(dest_data_0, &block_0_handle, 16, 0); //Read from flash, only one block is allowed for each pstorage_load command
while(pstorage_wait_flag) { power_manage(); } //Sleep until store operation is finished.
if(dest_data_0[1] == source_data_0[1])
{
nrf_gpio_pin_clear(LED_3);
}
while debugging in keil, if i put the breakpoint on the the pstorage_load(dest_data_0, &block_0_handle, 16, 0); line and then at if(dest_data_0[1] == source_data_0[1]) the read value is same as what is written.
but when i put breakpoint directly on
if(dest_data_0[1] == source_data_0[1])
the read value is 0xFF.
Why it is so.
Please let me know what mistake i am doing...
Thanks & Regards,