sd_softdevice_is_enabled somtimes hardfaults

During some operations like factory reset, or during a hardfault we want to check if the softdevice is enabled and disable it if it is enabled before continuing with further operations. For example during factory reset, or forget device and we want to erase the flash are with the bonding information.

However, sometimes sd_softdevice_is_enabled hardfaults.

We are using s140 and SDK v15

Here are registers at the time of crash:

(gdb) info reg
r0             0x200298d7          537041111
r1             0xa8e35             691765
r2             0x10000000          268435456
r3             0x1000              4096
r4             0xf5                245
r5             0x3                 3
r6             0x200281f4          537035252
r7             0x200281ec          537035244
r8             0x0                 0
r9             0x4a646e            4875374
r10            0x4a646f            4875375
r11            0xa5a5a5a5          -1515870811
r12            0xfa000000          -100663296
sp             0x200298d0          0x200298d0 <task_TIME+1568>
lr             0x59635             366133
pc             0x595fe             0x595fe <sd_softdevice_is_enabled+2>
xpsr           0x81000000          -2130706432
msp            0x20037fe0          537100256
psp            0x200298b0          537041072

Related