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

BLE Secure bootloader SD clock issues

Hallo All :-)

As an enthousiast hobbyist I've developed a custom board around an nRF52832-CIAA. When I started testing with a BLE secure bootloader from the SDK16 examples, it all worked flawless on my PCA10040 evaluation board. On my own board however the bootloader did not start at all.

After extensive testing and debugging I found the code failed upon enabling the SoftDevice (I use 6.1.1). This was in nrf_sdh.c in the function call :

ret_code = sd_softdevice_enable(&clock_lf_config, app_error_fault_handler);

Using yet another demo board I found that removing the 32.768 kHz LF crystal caused exactly the same error as seen on my own design. And yes, indeed is this crystal NOT present on my own board. So, no problem I thought. Simply change the clock configuration .........

Sadly I found that whatever I do, the SoftDevice will only start when NRF_SDH_CLOCK_LF_SRC is set to 1 (= XTAL) AND the 32.768 kHz crystal is present.

I've tried every combination between hardware and sdk_ config.h configuration. Defining a clock in the board header file also yields no result. In the SDK header that describes the function for enabling the SoftDevice I read that passing NULL as argument for the clock source would instruct the SoftDevice to use the RC clock with correct settings for calibration interval and temperature drift. Sorry to say,  this also failed.

So, HELP! Anyone got an idea?

Peter

Note : After I posted this question I've continued my search. Now at last the secure bootloader comes to life. In the file nrf_sdm.h (line 310) the comment states that the NULL 'clock argument' passed on calling sd_softdevice_enable() forces the softdevice to use the internal RC clock for LF. So I tried this once more :

ret_code = sd_softdevice_enable(&clock_lf_cfg, app_error_fault_handler);  -> changed into  ret_code = sd_softdevice_enable(NULL, app_error_fault_handler);

Leaving the NRF_SDH_CLOCK_LF_SRC in sdk_config.h at 1 (selecting the XTAL).

Now I sometimes get the DfuTarg when scanning with the nRFConnect App on my phone :-) But I'm not satisfied yet. I want to ALWAYS get the DfuTarg after a device reset (with no valid application that is).

I also tried a DFU_OTA. After a few disconnects I succeeded once. It is far from stable at the moment .....

Related