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

SoftDevice 132 hardfault on sd_softdevice_enable debug

Hi,

Kindly help with some insights/tip on how to debug this hardfault. The code gives hardfault on my custom board, but not on NRF52-DK. My custom device is only populated with 32Mhz osc and not the 32khz. However, I have configured LFCLK source to internal RC - please see the Init code at the end.

backtrace:

sd_softdevice_enable (p_clock_lf_cfg=0x2000ff78, fault_handler=fault_handler@entry=0x24089 <softdevice_fault_handler>) at ../components/softdevice/s132/headers/nrf_sdm.h:286
286	SVCALL(SD_SOFTDEVICE_ENABLE, uint32_t, sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg, nrf_fault_handler_t fault_handler));
>>> bt
#0  sd_softdevice_enable (p_clock_lf_cfg=0x2000ff78, fault_handler=fault_handler@entry=0x24089 <softdevice_fault_handler>) at ../components/softdevice/s132/headers/nrf_sdm.h:286
#1  0x000241a0 in softdevice_handler_init (p_clock_lf_cfg=p_clock_lf_cfg@entry=0x2000ff78, p_ble_evt_buffer=p_ble_evt_buffer@entry=0x200024d8 <BLE_EVT_BUFFER.11047>, ble_evt_buffer_size=ble_evt_buffer_size@entry=80, evt_schedule_func=evt_schedule_func@entry=0x0) at ../components/softdevice/common/softdevice_handler/softdevice_handler.c:300
#2  0x00022520 in ble_stack_init () at ./main.c:408
#3  main () at ./main.c:636

info registers:

>>> info registers
r0             0x2000ff78	536936312
r1             0x24089	147593
r2             0x50	80
r3             0x0	0
r4             0xe000e100	3758153984
r5             0x2000288a	536881290
r6             0x0	0
r7             0x0	0
r8             0x0	0
r9             0x0	0
r10            0x20000000	536870912
r11            0x0	0
r12            0xb	11
sp             0x2000ff40	0x2000ff40
lr             0x241a1	147873
pc             0x2407c	0x2407c <sd_softdevice_enable>
xpsr           0x41000003	1090519043
msp            0x2000ff40	536936256
psp            0x0	0
primask        0x0	0
basepri        0x0	0
faultmask      0x0	0
control        0x0	0

My BLE init code is :

#define NRF_CLOCK_LFCLKSRC_RC      {.source        = NRF_CLOCK_LF_SRC_RC,            \
								 .rc_ctiv       = 0,                                \
								 .rc_temp_ctiv  = 0,                                \
								 .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM}


static void ble_stack_init(void)
{
    uint32_t err_code;

    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC_RC;

    // Initialize SoftDevice.
    SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

    ble_enable_params_t ble_enable_params;
    err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
                                                    PERIPHERAL_LINK_COUNT,
                                                    &ble_enable_params);
    APP_ERROR_CHECK(err_code);

    //Check the ram settings against the used number of links
    CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);

    // Enable BLE stack.
#if (NRF_SD_BLE_API_VERSION == 3)
    ble_enable_params.gatt_enable_params.att_mtu = NRF_BLE_MAX_MTU_SIZE;
#endif
    err_code = softdevice_enable(&ble_enable_params);
    APP_ERROR_CHECK(err_code);

    // Subscribe for BLE events.
    err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
    APP_ERROR_CHECK(err_code);
}

Please let me know what other information is required to conclude what is the issue causing the hardfault

-------EDIT-----------

I changed the calibration parameters to:

#define NRF_CLOCK_LFCLKSRC_RC      {.source        = NRF_CLOCK_LF_SRC_RC,            \
								 .rc_ctiv       = 16,                                \
								 .rc_temp_ctiv  = 2,                                \
								 .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}

Yet I still get hardfault.

Related