I'm trying to implement an application where one board updates another board with Nordic's DFU service. I'm using the NUS client example as a basis to develop the BLE central application.
My main function looks like this:
int main(void)
{
SEGGER_RTT_WriteString(0,"Starting DFU application\n");
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);
buttons_leds_init();
db_discovery_init();
ble_stack_init();
//ble_services_init();
nus_c_init();
// Start scanning for peripherals and initiate connection
// with devices that advertise NUS UUID.
scan_start();
SEGGER_RTT_WriteString(0,"Entering main loop\n");
for (;;)
{
power_manage();
}
}
As soon as I uncomment ble_services_init(), the application crashes at softdevice_enable and resets. The error code doesn't even get printed. (see below, after checkpoint 3)
static void ble_stack_init(void)
{
uint32_t err_code;
SEGGER_RTT_WriteString(0,"Initializing the SoftDevice and BLE event interrupt\n");
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
// Initialize the SoftDevice handler module.
SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
SEGGER_RTT_WriteString(0,"Checkpoint 1\n");
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);
SEGGER_RTT_WriteString(0,"Checkpoint 2\n");
//Check the ram settings against the used number of links
CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);
SEGGER_RTT_WriteString(0,"Checkpoint 3\n");
// Enable BLE stack.
err_code = softdevice_enable(&ble_enable_params);
SEGGER_RTT_printf(0,"Error code: %d\n", err_code);
APP_ERROR_CHECK(err_code);
SEGGER_RTT_WriteString(0,"Checkpoint 4\n");
// Register with the SoftDevice handler module for BLE events.
err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);
SEGGER_RTT_WriteString(0,"Checkpoint 5\n");
}
Any idea what the problem might be? I'm thinking maybe I need to change some RAM configurations but I'm not sure how.
I'm using SoftDevice s130, SDK11, on nRF51822_qfac. Thanks in advance for your help!