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

Fstorage - fs_erase causes connection failure

Hello,

I'm encountering a very strange problem while attempting to run an fstorage fs_erase operation on my peripheral device when the central is connected. This is on a nRF52832, SDK 12.1.0, SoftDevice S132 v3.0.0 and running FreeRTOS. The peripheral stores configuration and logged data in program flash space using fstoreage.

Basically what happens is that the central device connects to my peripheral in order to configure it. One of the steps the peripheral must do is erase a configuration page. When the peripheral invokes fs_erase, the connection drops. I added debug and I can see that the fs_erase command and completion event take less than ~200mS to occur. However the connection is dropping due to a connection supervisor timeout. I've tried this with the default time out of 720mS, and with the connection supervisor timeout negotiated up to 6,000mS. It fails in both cases.

I watched what happens in the sniffer, and I see the command received by the peripheral. Then when the peripheral starts the erase process, it stops responding to the connection events from the central with the expected empty packets. The lack of response continues until the connection supervisor timer pops.

Some other notes:

  1. If I invoke the erase from our Serial Uart CLI rather than OTA, the connection drops in the exact same fashion.

  2. The fstorage configuration looks correct when compared to another project in the same environment where this doesn't occur.

  3. The command from the host is initially handled in interrupt context, but the command is passed to our command processing user level task for processing before the fs_erase is invoked.

  4. We are reserving 34 pages of program flash: 32 for data, 1 for a passkey, and 1 for recording user information. It doesn't matter which page we erase, the problem occurs.

  5. We have another project with nearly the exact same setup (it's where I got the code from!) and it does not have this behavior. You see a few connection events ignored, but it's only for tens of milli-seconds.

What could I be doing wrong that the stack would return a NRF_EVT_FLASH_OPERATION_SUCCESS event to us, but not resume normal operations with the host?

I can post code if needed, but I didn't want to bloat the question further unless it would be helpful

Thanks, John

Parents Reply Children
No Data
Related