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

Why TXPOWER register is toggling?

Hello

I want to modify the tx powel level to 4 dbm using sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_adv_handle, 4); after Advertising_Init function.

void Advertising_Init_V(void)
{
...
...
...
    APP_ERROR_CHECK(err_code);
 
    err_code = ble_advdata_encode(&srdata, m_adv_data.scan_rsp_data.p_data, &m_adv_data.scan_rsp_data.len);
    APP_ERROR_CHECK(err_code);
 
    // Set advertising parameters.
    memset(&m_adv_params, 0, sizeof(m_adv_params));
 
    m_adv_params.primary_phy     = BLE_GAP_PHY_1MBPS;
    m_adv_params.duration        = APP_ADV_DURATION;
    m_adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
    m_adv_params.p_peer_addr     = NULL;
    m_adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
    m_adv_params.interval        = APP_ADV_INTERVAL;
 
    err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &m_adv_params);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_adv_handle, tx_power_level);
    APP_ERROR_CHECK(err_code);
}

I could able run the code with out issue, when verifying TXPOWER register i observed the value in register is toggling between 0 and 4 as attached video . Even i tried directly update register but its going hard fault after digging through documentation i found RADIO registers are blocked for access. What I want understand is toggling of value is expected behavior or its an issue.

Related