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

Debugging HardFault when calling sd_ble_gap_adv_start (works on one board, crashes on the other)

Hi everyone,

Preface: I'm an educator and my students are familiar with the Arduino IDE, so I'm using that in combination with the sandeepmistry/arduino-nRF5 core.

Our main platform is the BBC micro:bit with the nRF51822 QFAA, and things works just as intended. I have a demo sketch that can reliably do both broadcast + observer roles with the S130 2.0.1 softdevice. Everything peachy there.

However, I also have another custom development board with the nRF51822 QFAC, and when I flash the same sketch with the same softdevice on that one, I get a HardFault shortly after calling sd_ble_gap_adv_start(). It's not happening immediately, maybe ~ 100 ms after the call, so I assume it's somehow timer-related, as also described in https://devzone.nordicsemi.com/f/nordic-q-a/11809/hardfault-error-after-calling-sd_ble_gap_adv_start.

My question now is what possible reasons are that this works on one board and doesn't on the other? I can think of the following differences right now:

microbit custom board
QFAA (16k RAM) QFAC (32k RAM)
LF RC Oscillator LF 32kHz Crystal
CMSIS-DAP STLink v2

The one thing that is different and is also timing-related is the LF oscillator. If that is incorrectly initialized, could it be the reason for the softdevice faulting?

Thanks & best regards, Florian

Related