Adjusting CC23xx or CC27xx txPower

To optimize application power budget or performance, it is important to change the txPower to achieve the following scenario.

  • When peer devices are in close range, reduce the TX power can save the power budget.

  • When you want your device to increase range by increasing the TX power.

  • Increase the visibility of your application in a crowded environnement

Note

Note that for CC23xx or CC27xx the TX power range goes from -20dBm to 8dBm.

Changing txPower for an advertising set

SysConfig can be used to modify the TxPower used for each advertising set.

  • Open the sysconfig file of your example

  • Go to RF Stacks > BLE > Advertisement Set > Advertisement Parameters

  • Change the TX Power field from The Controller will choose the Tx power to TX Power Value

  • A new field appears below called TX Power Value, enter the value in dBm.

../_images/SysConfig_Txpower_cc23xx.png

Figure 36. txPower configuration

Changing txPower at run time

To modify the txPower at running time, use the HCI command: HCI_EXT_SetTxPowerDbmCmd(int8 txPower, uint8 fraction) The txPowerDbm parameter corresponds to the power in dBm value, the fraction is currently not used. Find more details concerning the HCI function in the API references section of the user’s guide.

Note

To check whether the txPower value has been updated you can either:

  • Check the current consumption: the higher the current consumption indicates higher the txPower.

  • Check the RSSI value: smaller RSSI indicates lower txPower.

RSSI will also vary by environment and that assuming all variables are equal and the devices are in the same location.

Lowering the txPower will lead to a smaller (more negative) RSSI.

HCI_EXT_SetTxPowerDbmCmd(int8 txPower, uint8 fraction) will have no impact on DTM test functions.

Changing txPower for DTM

To modify the txPower in DTM for the purpose of running DTM tests, use the HCI command: HCIExt_SetMaxDtmTxPowerDbmCmd(int8 txPower, uint8 fraction) The txPowerDbm parameter corresponds to the power in dBm value, the fraction is currently not used (i.e. should be set to 0). Find more details concerning the HCI function in the API references section of the user’s guide.

Note

When changing txPower using this method, only the DTM test functions such as EnhancedModemTestTxCmd and HCIExt_ModemTestTxCmd will have the new txPower.

HCIExt_SetMaxDtmTxPowerDbmCmd(int8 txPower, uint8 fraction) will have no impact on the txPower used for non-DTM functionality such as advertising, connections, etc.

Power Control Feature

The Power Control Feature enable us to keep channels less noisy and to save power. The feature enable the option to query the peer device for what is the Accepted Power Reduction (APR) on an active connection and to reduce the amount of power the peer device allows in the connection. The detailed defination of Power Control Request procedure is found in the Bluetooth Core Specifications Version 5.3, Vol 6, Part B, Chapter 5.1.

Depending on the RSSI Monitor feature implemented, there will be an option to enable a monitor of the RSSI value on a specific connection and to ask the peer device autonomously to decrease or increase its power respectively to the RSSI that local device receive in the connection.

Once the power control procedure is done, the TX power changes to the value that was decided for all connection events on a specific connection handle and a specific PHY until another power procedure occurs or the connection is lost.

The power control procedure can be triggered from the host/application layer by the HCI command, or by the peer device in which case the procedure is handled in the controller layer and notify the host/application if configured. Related HCI commands are listed in below. More details about HCI function are in the API references section of the user’s guide.

  • HCI_LE_EnhancedReadTransmitPowerLevelCmd ( uint16_t connHandle, uint8_t txPhy )

  • HCI_LE_ReadRemoteTransmitPowerLevelCmd ( uint16_t connHandle, uint8_t txPhy )

  • HCI_LE_SetTransmitPowerReportingEnableCmd ( uint16_t connHandle, uint8_t localEnable, uint8_t remoteEnable )

  • HCI_EXT_SendPowerControlRequestCmd ( uint16_t connHandle, uint8_t txPhy, uint8_t deltaPowerDb, uint8_t aprEnable )

Power Control Feature with Channel Sounding

Bluetooth LE Specification 6.2, Vol 6, Part D, Section 6.27, defines the process used to adjust transmit power during Channel Sounding procedures. Link Layer specification now defines when LE Power Control can be requested, responded and indicated within a Channel Sounding context. The update allows users to optimize current consumption during Channel Sounding procedures, and/or the following connection events, and dynamically adjust the transmit power depending on distance results.

Power control procedure cannot be initiated during an active Channel Sounding (CS) procedure. See this in the diagram below:

@startuml
participant "Local Application"
participant "Local BLE Stack"
participant "Peer Application"
participant "Peer BLE Stack"

group Power Control Procedure

  "Local Application" -> "Local BLE Stack" : HCI_EXT_SendPowerControlRequestCmd()
  "Local BLE Stack" -> "Local BLE Stack" : Wait for pending CS Start Procedure to complete
  "Local BLE Stack" -> "Peer BLE Stack" : LL_POWER_CONTROL_REQ
  "Peer BLE Stack" -> "Local BLE Stack" : LL_POWER_CONTROL_RSP
  "Peer BLE Stack" -> "Peer Application" : HCI_BLE_TRANSMIT_POWER_REPORTING_EVENT

     rnote over "Local Application"
        BLE Stack notifies Application of Power Control Procedure
        :term:`CS` txPower update. Bluetooth LE txPower automatically updated.
     end note

  "Peer BLE Stack" -> "Local BLE Stack" : LL_POWER_CONTROL_IND
  "Local BLE Stack" -> "Local Applications" : HCI_BLE_TRANSMIT_POWER_REPORTING_EVENT
end

@enduml

Figure 37. Context Diagram for Power Control Procedure.

The functions below can be used to implement txPower Control for channel sounding. Transmit power control can be used in many other applications besides channel sounding.

First, to preface the code blocks, the first will be used to initiate a peer transmit power change. This will be initiated depending on the distance output from the ranging library. The logic for initiating will need to be added to the application.

Listing 9. app_car_node.c - Request Peer txPower Update
   //Add 5dBm to the current peer txPower
   status = HCI_EXT_SendPowerControlRequestCmd(connHandle, 0x01, 5, NULL);

Next, on the peer side, the event HCI_BLE_TRANSMIT_POWER_REPORTING_EVENT needs to be enabled to observe incoming transmit power level requests.The event will report the hciEvt_BLETransPwrReport_t structure, which can be used to observe the current transmit power level, the delta of the previous transmit power update, and the maximum and minimum power levels.

Listing 10. app_connection.c - Enable HCI_BLE_TRANSMIT_POWER_REPORTING_EVENT event
   //Create prototype for HCI connection event handler function
   static void Connection_HCIEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData);

   //Create HCI connection event handler
   BLEAppUtil_EventHandler_t connectionHCIHandler =
   {
      .handlerType = BLEAPPUTIL_HCI_GAP_TYPE, // Handler type.
      .pEventHandler = Connection_HCIEventHandler, // Function to handle events.
      .eventMask = BLEAPPUTIL_HCI_COMMAND_COMPLETE_EVENT_CODE | // HCI events to subscribe to.
                   BLEAPPUTIL_HCI_LE_EVENT_CODE
   };

   static void Connection_HCIEventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
   {
      bStatus_t status = USUCCESS;
      switch (event)
      {
            case BLEAPPUTIL_HCI_COMMAND_COMPLETE_EVENT_CODE:
            {
               break;
            }

            case BLEAPPUTIL_HCI_LE_EVENT_CODE:
            {
               ICall_HciExtEvt* pEvt = (ICall_HciExtEvt *)pMsgData;

               switch(pEvt->eventOpcode)
               {
                  case HCI_BLE_TRANSMIT_POWER_REPORTING_EVENT:
                  {
                     hciEvt_BLETransPwrReport_t *pEvt = (hciEvt_BLETransPwrReport_t *) pMsgData;

                     uint8 currentTxPower = pEvt -> txPowerLevel; // Obtain the current TX Power level

                     //Add functionality based on the current txPowerLevel

                     break;
                  }
               }
            }

      }

Note when a device receives this request, the stack will take care of changing the Bluetooth LE txPower. The Channel Sounding txPower is separate. Thus the function below can be added above to configure the CS txPower on the local and peer (Car Node and Key Node) device when needed.

Listing 11. app_car_node.c - Update Channel Sounding txPower
   status = HCI_LE_CS_SetDefaultSettings(connHandle, 3, 1, txPower);

   return status;

Since the peer node will automatically update its txPower for the Bluetooth LE txPower, in this code block the function shown will update the local devices Bluetooth LE txPower. This is not necessary, but will keep the txPower the same between the two nodes.

Listing 12. app_car_node.c - Update Bluetooth LE Connection txPower
   //Updating Bluetooth LE connection txPower to 10 dBm.
   status = HCI_EXT_SetTxPowerDbmCmd(10, connHandle);

Note that the Power Control commands do not automatically update the Channel Sounding txPower. As mentioned, the CS txPower is separate from the overall Bluetooth LE Advertising and connection txPower. When sending a power control request, the peer device will automatically update the Bluetooth LE txPower, but will not update the channel sounding txPower. Thus it is necessary to update the channel sounding txPower separately.