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

Flash erase failure when scanning interval/window is 3.125 ms

Hi all,

I have a problem where I get a Flash page erase failure when scanning interval/window is 3.125 ms (or other very small value).

(SD132 2.0.0, SDK 11.0.0)

When I call Flash page erase via sd_flash_page_erase() after power up, it fails if scanning has already been started via sd_ble_gap_scan_start() while using a small interval/window.  In my case both scan interval and window are a count of 5 (x .625 = 3.125 ms).  If I choose 150 count interval and window (x .625 = 93.75 ms) it works fine.

I imagine that the Soft Device doesn't have enough time to schedule the page erase between scan events.  Is it documented somewhere if there is a minimum advertising or scanning interval to be able to do a Flash page erase?  Maybe I should stop scanning, then erase Flash page, then restart scanning?

Maybe it's a limitation of the SoftDevice and/or SDK versions that I am using, which are a couple of years old?

Does anyone know what could be happening?

Thanks!

Gil

  • Yes, I think I've figured it out.  If Flash page erasure takes 85 ms (plus possible overhead), then I can't scan with an interval/window shorter than about 90 ms.  I guess that if I really need to have a short scan interval, then I just have to stop scanning, then erase Flash page, then restart scanning.

  • Additionally:

    1. How about advertising?  If I advertise with an interval/window smaller than about 90 ms?  Should I also stop/restart advertising?

    2. And if I'm connected, should I disconnect or postpone the Flash page erase as well?

    I'm guessing this issue would apply to all 3 … scanning, advertising and connection.  Is that right?

  • Hi,

    Scanning, advertising and connection events typically all block flash access. I recommend having a look at the Scheduling section of the SoftDevice Specification, and in particular the SoftDevice timing-activities and priorities subsection.

    Each advertising event, scan event, and connection event will either be scheduled or not scheduled by the SoftDevice, depending on whether there is a free slot at the requested time (also taking priorities into account.)

    You have already answered the question regarding scanning (as well as provided the two solutions from which you must choose what best fits your application.)

    Flash access may be prioritized over connectable advertiser and scanner, but if the advertising/scan intervals are short then you will quickly get to a situation of "has been blocked consecutively for a few times" which means advertiser/scanner gets higher priority than flash access.

    Keeping connections through flash erases should normally be no problem, depending on the connection setup with regards to supervision timeout.

    In all cases it is important not to request more time (through BLE activity, flash, timeslots, etc.) than what is available, in order for the lower priority activities to get scheduled.

    Regards,
    Terje

  • Thank you for the additional information on advertising and connection events!  I'll mark my own comment as the answer to the initial question about scanning events.

Related