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

sd_softdevice_enable return ram address instead of error code.

The following is loaded into flash on the nRF52840:
Bootloader: 0xe0000
Application: 0x27000
SOFTDEVICE S140: 0x1000
MBR at 0x0000

Bootloader starts, waits 5 sec and runs the following:
sd_softdevice_vector_table_base_set(0x27000);
nrf_dfu_mbr_irq_forward_address_set(); /* Forward irq from mbr to softdevice */
app_start(0x27000);

Program counter arrives at the application.

If the application calls any sd_* functions the function will return some RAM address: ex: 0x2003ffbc
An example function could be:
uint32_t err_code:
sd_mbr_command_t mbr_cmd = { .command = SD_MBR_COMMAND_INIT_SD};
err_code = sd_mbr_command(&mbr_cmd);

err_code will have the value: 0x2003ffd0

If I remove the bootloader everything runs as expected.
I cannot find any return code which matches the 0x2003ffbc so it must be a RAM address.

Parents Reply
  • Thanks for reporting back. 'SD_MBR_COMMAND_INIT_SD' makes the MBR invoke the Softdevice by executing its reset handler and also start forwarding interrupts to it. Basically the same as calling nrf_dfu_mbr_irq_forward_address_set() followed by app_start(0x1000).

    The 'SD_MBR_COMMAND_INIT_SD' command is only allowed to be called once, and only when the softdevice is not invoked. For instance, when you enable the Softdevice in the bootloader for OTA DFU.

Children
No Data
Related