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
  • Hi

    Yes, the Device Manager uses pstorage module internally, so it will conflict with direct calls to sd_flash_write and sd_flash_page_erase, and it is not a valid use case. If you use the device manager then you must also use pstorage to store application data.

    There is a pstorage example available here that should get you started with the module. This thread talks a little bit about where data is actually stored in flash.

    It should be safe to store data in multiple pages. Just make sure that your allocated blocks have size that is page aligned, e.g. 16,64,128,1024 bytes, but no larger than one page, i.e. 1024 bytes.

  • I'm working with the mbed library. Something seems to have overwritten the handle of my GattCharacteristic object causing the line

    if ((p_characteristics[charHandle]->getProperties() .....
    

    in nRF51GattServer::updateValue to hardfault. Still investigating if it's a problem on my part.

    EDIT:

    It looks like most of the _valueAttribute struct in the GattCharacteristic object is beening overwritten with values that are strikingly similar to memory and flash addresses used by the softdevice (eg. 0x20001948, 0x0000B3B7)

Reply
  • I'm working with the mbed library. Something seems to have overwritten the handle of my GattCharacteristic object causing the line

    if ((p_characteristics[charHandle]->getProperties() .....
    

    in nRF51GattServer::updateValue to hardfault. Still investigating if it's a problem on my part.

    EDIT:

    It looks like most of the _valueAttribute struct in the GattCharacteristic object is beening overwritten with values that are strikingly similar to memory and flash addresses used by the softdevice (eg. 0x20001948, 0x0000B3B7)

Children
No Data
Related