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

Fstorage timeout error

I am running into an issue with the Fstorage Library with SDK14 that I did not have using SDK12.

When I am not connected to BLE I can erase and write flash with no issues. 

When I am connected to BLE I am now getting timeouts errors when I try to erase 1 flash page. (see code below, I get ERR=13)

error = nrf_fstorage_erase(&fstorage, fstorage.start_addr, 1, NULL);

My BLE is only a simple NUS peripheral.  I would think there should be plenty of time for the soft device to erase the flash, right?

Is there a way to change BLE settings so I can get consistent erases and flashes?  Perhaps higher connection intervals?

My handler and my sdk_config.h settings are below.

Parents
  • FormerMember
    0 FormerMember

    Setting higher connection interval would result in more time to erase the flash.

    Could you test the attached main.c in ble_app_uart (SDK 14.2) and check if flash erase works at your side?

    Test the code:

    1. Connect to a central
    2. Test flash write and erase:
      1. Press button 3 to erase.
      2. Press button 4 to write.

     

     

Reply
  • FormerMember
    0 FormerMember

    Setting higher connection interval would result in more time to erase the flash.

    Could you test the attached main.c in ble_app_uart (SDK 14.2) and check if flash erase works at your side?

    Test the code:

    1. Connect to a central
    2. Test flash write and erase:
      1. Press button 3 to erase.
      2. Press button 4 to write.

     

     

Children
  • I think I found the issue.

    I had the supervisory timeout set very low in order to disconnect quickly when out of range.

    MSEC_TO_UNITS(250, UNIT_10_MS)

    by increasing this to 500ms it seems to work every time.  I increased it to 1000ms for some head room.

    I am guessing having that low of a timeout didn't allow enough time to erase the flash(?)