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

What might be the reason that `sd_softdevice_is_enabled` fails?

What might be the reason that sd_softdevice_is_enabled fails? I've been programming with the S130 for some time now. And now I am in the process of adapting the bootloader so it can work together with the S130.

#0  SVC_Handler () at /opt/nrf51_sdk/v6/nrf51822//Source//templates/gcc/gcc_startup_nrf51.s:211
#1  <signal handler called>
Read 4 bytes @ address 0x20003FCC (Data = 0x01000000)
Reading 64 bytes @ address 0x20003FC0
Read 4 bytes @ address 0x00035616 (Data = 0x1C184770)
Reading 64 bytes @ address 0x20003F80
Read 1 bytes @ address 0x20003FD3 (Data = 0x00)
#2  0x00035616 in sd_softdevice_is_enabled (p_softdevice_enabled=0x20003fd3 "")
    at /opt/softdevices/s130_nrf51822_0.5.0-1.alpha_API/include/nrf_sdm.h:149
Read 4 bytes @ address 0x0003577A (Data = 0x60FB1C03)
#3  0x0003577a in ble_stack_init () at ../main.c:219
Read 4 bytes @ address 0x0003591A (Data = 0xFF8DF7FF)
#4  0x0003591a in main () at ../main.c:296

So, this is the version without specific UICR fields (for the softdevice I mean, the following one is there of course). Hence, that cannot be an issue.

I have to the address 0x10001014 written the value 0x00035000. With jlink:

w4 0x10001014 0x00035000
mem 0x10001014 4
r

The bootloader is actually running from this address. All kind of LEDs turn on and off. But then I run into trouble when I address the softdevice functions.

Possibilities:

  • The S130 softdevice doesn't work with the bootloader code. Not very likely, I can call the sd_* functions from an application. I don't consider the bootloader any different.
  • The bootloader is situated in a different area in FLASH. Perhaps calls from that area to the softdevice are not allowed. I'm gonna check this by setting another address in 0x10001014 that's also at the end of RAM, but now with an application.
  • I compiled the bootloader with the wrong softdevice. Double-checked this, no, that is not the case.
  • Some hardware (like a clock) is used by both the bootloader and the softdevice. Not likely. Just a call to sd_softdevice_is_enabled shouldn't fail for that reason.
  • The bootloader tries to find the softdevice at the wrong location. I don't think it can make that mistake? Can I even set that somewhere?
  • Something else that I am not aware of.
Related