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

sd_flash_write writes corrupted data when BLE is enabled

Hi,

I wrote some code that writes to the flash perfectly when BLE is not enabled but when it is enabled, some of the data are correct while others are either missing or shifted to a later address. Below is a snippet of the code:

uint32_t retval;
while(NRF_ERROR_BUSY == (retval = sd_flash_write(p_dst, p_src, num_words)));
ASSERT(NRF_SUCCESS == retval);

I'm trying to avoid pstorage since I'm want to write to a contiguous block of flash much greater then the page size.

Thanks.

Parents
  • I think the write flash require you to write per page only. You cannot cross the page boundary. What you are experiencing look like cross boundary issue. Try pstorage_store, it handle cross boundary for you. I think, can't confirm at the moment. You can try and see.

  • I'm out of ideas then. I back-to-back flash writes in the callback when i receive SUCCESS, no delay necessary and I've never yet received a BUSY either nor had a bad write nor an ERROR, that I've seen anyway. I'm writing less data at a time than you are but still a substantial amount. I get system events posted whether I'm servicing BTLE or not and haven't been in the hardfault handler for a while. Have you managed to work out what the hardfault reason was (which can be hard)?

    The whole requiring a delay after you get a flash write success message is suspicious, when you get that message, the sd flash write has finished. There's something else going on here which may or may not be directly related to flash storage but is affecting it, I can't suggest what.

Reply
  • I'm out of ideas then. I back-to-back flash writes in the callback when i receive SUCCESS, no delay necessary and I've never yet received a BUSY either nor had a bad write nor an ERROR, that I've seen anyway. I'm writing less data at a time than you are but still a substantial amount. I get system events posted whether I'm servicing BTLE or not and haven't been in the hardfault handler for a while. Have you managed to work out what the hardfault reason was (which can be hard)?

    The whole requiring a delay after you get a flash write success message is suspicious, when you get that message, the sd flash write has finished. There's something else going on here which may or may not be directly related to flash storage but is affecting it, I can't suggest what.

Children
No Data
Related