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

Flash write

Hello,

I'm trying to write value to a specified address with ble_flash_page_write .

I'm using ble_flash_page_write after ble disconnect event. I've tested different page address to be sure i'm not writing on application or s110 areas and page address are multiples of 4.

At execution, an Hard fault occur at the ble_flash_page_write line... Any idea about this error ? Is there others solutions to write values to a precise flash address ?

int32_t page = 200;
uint8_t word_count = 1;
uint32_t data_array[2]={0x81ABACAB};
data_array[1] = 0x81ABACAB;
		
err_code = ble_flash_page_write(page,(uint32_t *) &data_array,1);
APP_ERROR_CHECK(err_code);
Parents
  • I might be wrong but I think maybe you are getting the same issue I was getting.

    If I understand correctly, the calls to pstorage_raw_clear() and pstorage_raw_store() simply schedule an erase and a store respectively. So their return value just indicates that you scheduled an erase followed by a write.

    In my case, I had to set up an event handler to get the event indicating the erase operation was successful and then call the function to schedule the write in order for the write to succeed. Not sure if this is what you are facing but I did notice you called an erase back to back with a write which was failing for me for the reason above. Hope this helps. David

Reply
  • I might be wrong but I think maybe you are getting the same issue I was getting.

    If I understand correctly, the calls to pstorage_raw_clear() and pstorage_raw_store() simply schedule an erase and a store respectively. So their return value just indicates that you scheduled an erase followed by a write.

    In my case, I had to set up an event handler to get the event indicating the erase operation was successful and then call the function to schedule the write in order for the write to succeed. Not sure if this is what you are facing but I did notice you called an erase back to back with a write which was failing for me for the reason above. Hope this helps. David

Children
No Data
Related