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

Hardfault at Enabled/Disabled Softdevice

I use SDK16 with softdevice. Some of its features require hard timings. But it causes hardfault sometimes. It happened at function of gcm_init. My source code is as follows. Does anyone know how to solve it? Please help me, thank you.

void ble_tt02_app_stop(void)
{
uint32_t err_code;
// Stop any impending connection parameters update.
err_code = ble_conn_params_stop();
APP_ERROR_CHECK(err_code);
}

void ble_stack_stop(void)
{
uint32_t err_code;
err_code = nrf_sdh_disable_request();
APP_ERROR_CHECK(err_code);
ASSERT(!nrf_sdh_is_enabled());
}

void ble_tt02_app_start(void)
{
gap_params_init();
gatt_init();
buffer_init();
conn_params_init();
db_discovery_init();
peer_manager_init(); // call it twice will case reset, because the function gcm_init will fail
services_init();
advertising_init();
adv_scan_start();
}


void scan_download(void)
{
...
if(ble_enable_flag == true)
{
ble_enable_flag = false;
ble_tt02_app_stop();
ble_stack_stop();
}
...
}


void resume_ble(void)
{
...
if(ble_enable_flag == false)
{
ble_enable_flag = true;
ble_stack_init();
ble_tt02_app_start();
}
...
}


int main(void)
{
...
nrf_mem_init();
ota_timer_init();
power_management_init();
ble_stack_init();
scheduler_init();
scan_init();
ble_tt02_app_start();
timers_start();
...
}

Related