Hi Developers!
I programmed a new code for my custom board's nRF51422, where I use the TIMER1 to generate 500ms interrupts to measure something important with this scheduling. I joined the TIMER1 with a GPIO, where a LED shows me the 500ms intervals (LED is blinking every 500msecs). Everything just works fine, but when I uncomment the code for BLE, the LED stops blinking, so my TIMER1 stops working.
Did anyone meet with this problem, where using BLE causes TIMER1 stops working? And can anybody help to solve my problem?
Ps.: I figured out, that 3 of my functions cause the problem, because when I comment them, the LED is blinking again. If one of these three functions is uncommented, the LED stops blinking again.
The functions are:
static void BLE_P_GAP_Params_Init_f(void){
uint32_t err_code;
ble_gap_conn_params_t gap_conn_params; // Connection parameters
ble_gap_conn_sec_mode_t sec_mode; // Security mode
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); // Security: no protection
err_code = sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *)DEVICE_NAME, strlen(DEVICE_NAME));
APP_ERROR_CHECK(err_code);
err_code = sd_ble_gap_appearance_set(BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT); // Set the appearance value, that matching the application's use case
APP_ERROR_CHECK(err_code);
memset(&gap_conn_params, 0, sizeof(gap_conn_params)); // Init gap_conn_params structure: copy 0 to it's items
gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
gap_conn_params.slave_latency = SLAVE_LATENCY;
gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT;
err_code = sd_ble_gap_ppcp_set(&gap_conn_params); // Set GAP Peripheral Preferred Connection Parameters (PPCP)
APP_ERROR_CHECK(err_code);
}
static void BLE_P_Advertising_Init_f(void){
uint32_t err_code;
ble_advdata_t advdata;
ble_uuid_t m_adv_uuids[] = {{SPDS_UUID_SERVICE, m_spds.uuid_type}};
// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = true;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
advdata.uuids_complete.p_uuids = m_adv_uuids;
ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout = APP_ADV_TIMEOUT_IN_SECONDS;
err_code = ble_advertising_init(&advdata, NULL, &options, BLE_P_Advertising_EventHandler_f, NULL);
APP_ERROR_CHECK(err_code);
}
static void BLE_P_ConnParams_Init_f(void){
uint32_t err_code;
ble_conn_params_init_t cp_init;
memset(&cp_init, 0, sizeof(cp_init));
cp_init.p_conn_params = NULL;
cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY;
cp_init.next_conn_params_update_delay = NEXT_CONN_PARAMS_UPDATE_DELAY;
cp_init.max_conn_params_update_count = MAX_CONN_PARAMS_UPDATE_COUNT;
cp_init.start_on_notify_cccd_handle = m_spds.tx_char_handles.cccd_handle; //BLE_GATT_HANDLE_INVALID;
cp_init.disconnect_on_fail = false;
cp_init.evt_handler = BLE_P_ConnParams_EventHandler_f;
cp_init.error_handler = BLE_P_ConnParams_ErrorHandler_f;
err_code = ble_conn_params_init(&cp_init);
APP_ERROR_CHECK(err_code);
}