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

nRF52840, nRF5_SDK_15.1.0, running SD , problems using nrf_fstora_sd with scan interval and scan window high like 1600.

Using SCAN_INTERVAL and SCAN_WINDOW  at 1600 vill make the flash write and erase come out with a error, the fstorage is working fine before the SD is initialised.

/** @brief Application main function. */
/** @brief Parameters used when scanning. */
// OBS OBS changing scan parameters to 1000/0.625 will make the flash write come out with an error!!!?? RIM 20181003
#define SCAN_INTERVAL 0x00A0 // (1000.0 / 0.625) /**< Determines scan interval in units of 0.625 millisecond. */
#define SCAN_WINDOW 0X00A0 // (1000.0 / 0.625) /**< Determines scan window in units of 0.625 millisecond. */
#define SCAN_DURATION 0x0000 /**< Timout when scanning. 0x0000 disables timeout. */
static ble_gap_scan_params_t const m_scan_params =
{
.active = 1,
.interval = SCAN_INTERVAL,
.window = SCAN_WINDOW,
.timeout = SCAN_DURATION,
.scan_phys = BLE_GAP_PHY_1MBPS,
.filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL,
};

With the sugestion to increase the SCAN_INTERVAL if flash storage was a problem this is not the first place to look for the error. 

Is there some parameters like timeout that I have overlooked?

regards CRIM.

Parents Reply Children
  • The error code was not saying anything it just announced "flash operation failed" . The error only happens when using the 1600 (1000/0.625) ms in SCAN_INTERVAL and SCAN_WINDOW, changing the two variables to 160ms (0xA0)ms the flash operation is working fine. I was trying everything to make it work with 1600 an finally after a lot of test I was passing by the SCAN parameters several times but compared to other examples they was higher, then I tried to change the SCAN parameters to a value used in other examples and the flash operations was working. The 1600ms was some remersens from a project I  inherited from another project and I can fine live with the change in SCAN parameters, I was just curios if I had overlooked something otherwise it is a limitation in the SCAN parameters when using the flash and SD together. 

  • SCAN_INTERVAL and SCAN_WINDOW can't be the same value, otherwise the soft device will never have time to write to the flash. SCAN_WINDOW needs to be lower than SCAN_INTERVAL.

  • Weird! it is working fine with 0X0A0 at both parameters?? Also most of the examples I have seen they have the same value, maybe I have to take a look at the specification and how to optimise the two parameters to the application running. I am just not quite sure how high I can go without loosing the flash function specific 1600ms is not working. 

  • Then I suggest you don't use 1600 as SCAN_WINDOW. If for some reason you need to use 1600 then I suggest you stop the scanning when you write to flash and start it again when done writing to flash.

Related