Manage critical sections to avoid SoftDevice assertion failures
masterThe SoftDevice reserves certain interrupts. Using standard methods like cortex_m::interrupt::free to disable all interrupts will cause the SoftDevice to fail with "assertion failed" errors.
To safely implement critical sections:
- Enable the
critical-section-implfeature innrf-softdevice. - Use the
critical-sectioncrate'scritical_section::withinstead ofcortex_m::interrupt::free. - Use
embassy_sync::blocking_mutex::CriticalSectionMutexinstead ofcortex_m::interrupt::Mutex. - Ensure no third-party libraries you use internally call
cortex_m::interrupt::free.