Hello,
I am implementing ble advertising using below code, i encountered a strange behaviour with this code. If jlink is connected the advertising works just fine. if I disconnect jlink and do a device reset there is no advertising from the device.
void mesh_ble_start_advertising(void)
{
ret_code_t nrf_error_code = 0x00;
static uint8_t adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
ble_gap_adv_params_t adv_params = {
.properties = {
.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_SCANNABLE_UNDIRECTED
},
.interval = MESH_APP_ADV_INTERVAL,
.duration = 0x00,
.channel_mask = {0}, /* Advertising on all the primary channels */
.max_adv_evts = 0,
.primary_phy = BLE_GAP_PHY_AUTO,
.scan_req_notification = 0
};
// brodacast_on = true;
nrf_error_code = sd_ble_gap_adv_set_configure(&adv_handle, &adv_data1, &adv_params);
printf("%d\n",nrf_error_code);
// APP_ERROR_CHECK(nrf_error_code);
/* Start advertising */
nrf_error_code = sd_ble_gap_adv_start(adv_handle, BLE_CONN_CFG_TAG_DEFAULT);
printf("%d\n",nrf_error_code);
// APP_ERROR_CHECK(nrf_error_code);
// while (brodacast_on != false);
nrf_delay_ms(10000);
sd_ble_gap_adv_stop(adv_handle);
}
Please let me know if there is some additional config to be taken care of.