nRF Connect SDK: 2.1.2
I'm using Zephyr's settings subsystem (with NVS as the backend storage implementation). With this setup, when the method settings_save() is called, changed settings are written to flash.
I've noticed that when Bluetooth is connected and data is flowing (via BLE notifications), sometimes calling settings_save() results in an assertion with MPSL. Specifically, this assertion:
<err> mpsl_init: MPSL ASSERT: 108, 659
This seems to indicate an assertion has occurred on line 659 of file 108. Unfortunately, because MPSL is closed-source, I have no way of looking at the code that generated this assertion to determine the cause. It's possible my code is doing something wrong that leads to this assertion, or it could be a bug in the MPSL, but I cannot investigate further. I'm hoping someone at Nordic with access to the MPSL source can look at line 659 of file 108 and let me know what this assertion means, and if there's anything I can do to prevent it.
Some notes about the cause:
- This assertion occurs intermittently. It does not happen every time
settings_save()is called. - I have never observed it to happen without Bluetooth connected (and I've tried thousands of times!)
- I have never observed it to happen with Bluetooth connected but idle, that is, not sending notifications (and again I've tried thousands of times!)
- When my application is sending notifications, it acts as a peripheral with 15ms connection interval, and it sends one BLE notification of approximately 79 bytes every interval. So, that's one 79 byte notification every 15ms, or approximately 5 kilobytes per second. Calling
settings_save()during this data transmission is when I've seen the assertion occur. But, even then, it does not occur every time. - The assertion seems far more likely to occur on the first
settings_save()on a fresh chip. It occurs approximately 40% of the time in this case. I suspect that, whensettings_save()is called for the first time, additional work is done to set up the NVS structure in flash so there's more opportunity for the failure to occur. After this firstsettings_save(), subsequent calls are much less likely to trigger the assertion.
I'm hoping you can provide some more information on this specific assertion and what, if anything, I can do to prevent it. If you need more information about my application, I can answer any questions you have. However, the application itself is proprietary and cannot be shared.
Thanks!