This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Controlling BLE TX power within Timeslot API ?

Any idea how I can control the TX power within the Timeslot API in SDK v6 SD110 v7?

Are there something similar to "sd_ble_gap_tx_power_set(tx_power)" in the Timeslot API for adjusting the output power of the BLE?

Justin

Parents
  • Hi Justin

    I tried this out.

    It is not possible to set the radio power from timeslot with sd_ble_gap_tx_power_set(tx_power); because the timeslot executes in priority level 0 and sd_* calls have priority 2 which therefore causes a hardfault.

    It does not work to set the TX power directly from the timeslot by writing to the NRF_RADIO->TXPOWER register. That is because before the softdevice grants the timeslot, the softdevice will store all configuration, including the radio TX power, and load it back when the timeslot expires, overriding the config you set in the timeslot.

    The thing you can do is to set a flag in the timeslot, and check for that flag in the main loop. If the flag is set in the main loop, you change the configuration with sd_ble_gap_tx_power_set(tx_power);, e.g.

    			if (change_tx_power > 0)
    			{
    				sd_ble_gap_tx_power_set(-30);
    			}
    
Reply
  • Hi Justin

    I tried this out.

    It is not possible to set the radio power from timeslot with sd_ble_gap_tx_power_set(tx_power); because the timeslot executes in priority level 0 and sd_* calls have priority 2 which therefore causes a hardfault.

    It does not work to set the TX power directly from the timeslot by writing to the NRF_RADIO->TXPOWER register. That is because before the softdevice grants the timeslot, the softdevice will store all configuration, including the radio TX power, and load it back when the timeslot expires, overriding the config you set in the timeslot.

    The thing you can do is to set a flag in the timeslot, and check for that flag in the main loop. If the flag is set in the main loop, you change the configuration with sd_ble_gap_tx_power_set(tx_power);, e.g.

    			if (change_tx_power > 0)
    			{
    				sd_ble_gap_tx_power_set(-30);
    			}
    
Children
No Data
Related