Hi there,
I'm currently trying to switch from actively advertising to a carrier wave test. This is the code snippet I'm currently debugging on SDK 17.1.0:
if (trigger_test) {
uint32_t dtm_ret = DTM_SUCCESS;
uint16_t power_cmd = (LE_TRANSMITTER_TEST << 14) | ((req_power & 0x3F) << 8) | (SET_TX_POWER << 2) | DTM_PKT_VENDORSPECIFIC;
uint16_t carrier_cmd = (LE_TRANSMITTER_TEST << 14) | (CARRIER_TEST << 2) | DTM_PKT_VENDORSPECIFIC;
uint16_t frequency = (req_freq - 2402) / 2;
uint8_t frequency_field = frequency & 0x3F;
carrier_cmd |= (frequency_field << 8);
if (ble_advertisement_active) {
sd_ble_gap_adv_stop(m_advertising.adv_handle);
}
if (test_active)
{
stop_dtm();
} else if (ble_active) {
NRF_LOG_INFO("Disable softdevice");
uint32_t sd_ret = nrf_sdh_disable_request();
if (sd_ret != NRF_SUCCESS)
{
NRF_LOG_INFO("Softdevice failed to disable %d", sd_ret);
NRF_LOG_FLUSH();
}
while (nrf_sdh_is_enabled()) {} // Wait for SD to finish disabling
NRF_LOG_INFO("Initialising DTM Driver");
NRF_LOG_FLUSH();
dtm_ret = dtm_init();
if (dtm_ret != DTM_SUCCESS)
{
NRF_LOG_INFO("DTM failed to initialise %d", dtm_ret);
}
}
NRF_LOG_INFO("Sending Power DTM CMD");
NRF_LOG_FLUSH();
dtm_ret = dtm_cmd(power_cmd);
if (dtm_ret != DTM_SUCCESS)
{
NRF_LOG_INFO("DTM power cmd failed %d", dtm_ret);
return;
}
NRF_LOG_INFO("Sending Carrier DTM CMD");
NRF_LOG_FLUSH();
dtm_ret = dtm_cmd(carrier_cmd);
if (dtm_ret != DTM_SUCCESS)
{
NRF_LOG_INFO("DTM carrier cmd failed %d", dtm_ret);
return;
}
test_active = true;
}
The code seems to be freezing when I disable the soft device. Is there anything I'm missing which is needed to switch between BLE and DTM?
Kind Regards,
Trystan