DA14683: At what point during power up is the BLE TX Power Level Set?

Hardware:

Custom DA14683 Board

Latest SDK = 1.0.14.1081 (Last updated in 2018)

 

Situation:

This question applies to any demo, but lets take the BMS demo for an example.

From hw_rf.h, I can see where the tx power levels are defined in this enum:

typedef enum {
        HW_RF_PWR_LUT_0dbm = 0,   /**< TX PWR attenuation 0 dbm */
        HW_RF_PWR_LUT_m1dbm = 1,  /**< TX PWR attenuation -1 dbm */
        HW_RF_PWR_LUT_m2dbm = 2,  /**< TX PWR attenuation -2 dbm */
        HW_RF_PWR_LUT_m3dbm = 3,  /**< TX PWR attenuation -3 dbm */
        HW_RF_PWR_LUT_m4dbm = 4,  /**< TX PWR attenuation -4 dbm */
} HW_RF_PWR_LUT_SETTING;

From hw_rf.c, I can see the function that sets the TX power level:

void hw_rf_set_tx_power_ble(HW_RF_PWR_LUT_SETTING lut)
{
        RFCU->RF_TX_PWR_BLE_REG = lut;
        rf_tx_power_luts.tx_power_ble = lut;
}

...But the "hw_rf_set_tx_power_ble()" function does not appear to be called anywhere.  

...Also none of the enums from "HW_RF_PWR_LUT_SETTING" appear anywhere in the project.

It is unclear where the TX power is being defined.  It is also unclear at what point in the power up sequence the TX power is being set.

Questions:

1) Where is the default TX Power level defined? (file and line please)

2) At what point in the BLE radio initialization sequence is the TX power level set? (file and line please)

3) If I wanted to change the BLE radio TX power level, what is the correct sequence of operations to do so? (do I need to power down the radio first?, just stop advertising?, etc)

Parents
  • Hi Nathan, 

    According to datasheet : 

    Radio transceiver
    - 2.4 GHz CMOS transceiver with integrated balun
    - 50  matched single wire antenna interface
    - 0 dBm transmit output power
    - -94 dBm receiver sensitivity (BLE)
    - Supply current at VBAT1 (3 V):
    TX: 3.4 mA
    RX: 3.1 mA (with ideal DC-DC converter)

    If you search the code, the hw_rf_set_tx_power_ble() is called in hw_rf_request_recommended_settings() which is called in ad_rf_request_recommended_settings().  Just search into the code in hw_rf.c file.

    #ifdef CONFIG_USE_BLE
    hw_rf_set_tx_power_ble(rf_tx_power_luts.tx_power_ble);
    #endif

    According to hw_rf_tx_power_luts_t struct, rf_tx_power_luts.tx_power_ble = 4. 

    The hw_rf_set_tx_power_ble() is changing the TX power attenuation setting. Why do you need to change this?

    Regards, 

    PM_Renesas

Reply
  • Hi Nathan, 

    According to datasheet : 

    Radio transceiver
    - 2.4 GHz CMOS transceiver with integrated balun
    - 50  matched single wire antenna interface
    - 0 dBm transmit output power
    - -94 dBm receiver sensitivity (BLE)
    - Supply current at VBAT1 (3 V):
    TX: 3.4 mA
    RX: 3.1 mA (with ideal DC-DC converter)

    If you search the code, the hw_rf_set_tx_power_ble() is called in hw_rf_request_recommended_settings() which is called in ad_rf_request_recommended_settings().  Just search into the code in hw_rf.c file.

    #ifdef CONFIG_USE_BLE
    hw_rf_set_tx_power_ble(rf_tx_power_luts.tx_power_ble);
    #endif

    According to hw_rf_tx_power_luts_t struct, rf_tx_power_luts.tx_power_ble = 4. 

    The hw_rf_set_tx_power_ble() is changing the TX power attenuation setting. Why do you need to change this?

    Regards, 

    PM_Renesas

Children
  • wow.  Did this end up being a NOT simple question or what!

    To Answer your question: "Why do you need to change this?"

    https://www.agccert.com/news_show/646.html

    Because of new FCC rules implemented earlier this year, the TX power needs to be under the new FCC KDB 447498 limits.  You guys have not updated your SDK since 2018, well before this new limit was implemented.  So I cannot trust the value you have as the default will work now in 2022.

    I need to know what TX power is being set during initialization, and make sure nothing is transmitted at a higher power than is allowed.  This is why I asked the specific questions I did.  I asked where the default power is defined so I can confirm it's not exceeding the new maximum.  I asked where the power is set, so I can confirm it's not being set higher than max at some initial stage.  I asked how to set the power myself so I can confirm the value I require is being loaded.  I don't consider any of this unreasonable. 

    Regarding the default value for TX power:

    The struct that holds the values set by hw_rf_set_tx_power_ble() is indeed in hw_rf.h as follows:

    typedef struct __attribute__ ((__packed__)) {
        uint8_t tx_power_ble: 4;
        uint8_t tx_power_ftdf: 4;
    } hw_rf_tx_power_luts_t;

    Those “4”s are not values.  They are bit fields used to pack both tx_power_ble and tx_power_ftdf into one byte.  

    The struct rf_tx_power_luts is declared next in that same file:  

    extern hw_rf_tx_power_luts_t rf_tx_power_luts;

    … but it’s tx_power_ble and tx_power_ftdf values are never initialized to anything. (If I’m wrong here, provide file and line please).  

    The usage is:

    void hw_rf_request_recommended_settings(void)
    {
        //…
        hw_rf_set_tx_power_ble(rf_tx_power_luts.tx_power_ble);
        //…
    }

    Which proceeds to set rf_tx_power_luts.tx_power_ble back to itself:

    void hw_rf_set_tx_power_ble(HW_RF_PWR_LUT_SETTING lut)
    {
        RFCU->RF_TX_PWR_BLE_REG = lut;
        rf_tx_power_luts.tx_power_ble = lut;
    }

    You commented that "rf_tx_power_luts.tx_power_ble = 4" when it gets run, but you did not specify where that "4" value is coming from or how you determined that “4” was being used.  Are you confusing the struct 4 bit bitfield with a value?

    NOTE: When I set a debug breakpoint in the hw_rf_set_tx_power_ble() function as called from "hw_rf_request_recommended_settings()" during system power up time, I can see that the value being passed in "lut" = "HW_RF_PWR_LUT_0dbm".  

    So the mystery continues.  Where is the default TX power defined?

    Regarding where in the init sequence is the TX power is being set:

    Yes, I should have been more clear/specific here. hw_rf_set_tx_power_ble() is indeed called from hw_rf_request_recommended_settings(), which is indeed called from ad_rf_request_recommended_settings().  

    That is unfortunately not helpful.  Take that investigation a few steps further.

     ad_rf_request_recommended_settings() is called from rf_init_sdk() and rf_reinit_sdk().  I can see why you stopped where you did because now the trail gets a little less clear.  rf_init_sdk() appears to only be called as part of the jump_table.c  rom_func_addr_table_var[].  

    The only relevant use of that jump table I can see is in ble_platform_initialization(), which is called from ad_ble_init().  This is only called from a Macro ADAPTER_INIT_DEP1.  

    At this point it's unclear what parts of the code are using the ADAPTER_INIT_DEP1 macro.

    I hope we can agree that I did enough "file searching" here.  This is still a very unsatisfactory answer to my question of, where in the initialization process is the TX power being set?

    These are just examples of possible responses that would actually answer my question about "At what point in the BLE radio initialization sequence is the TX power level set?:

      a) At some system power up time, even before system_init() is called.

      b) When ble_mgr_init() is called.

      c) When ble_peripheral_start() is called. (<-- it's this one)

      d) When ble_gap_adv_start() is called.

    Are any of those correct?  If not, please provide the actual answer.

    I numbered my previous specific questions.  Lets go through them and see what information was provided.

    1) Where is the default TX Power level defined? (file and line please)

                       (Partial Answer. See Above. )    

    2) At what point in the BLE radio initialization sequence is the TX power level set? (file and line please)

                      (Partial Answer.  See Above. ) 

    3) If I wanted to change the BLE radio TX power level, what is the correct sequence of operations to do so? (do I need to power down the radio first?, just stop advertising?, etc)

                      (Not Answered.  Same Question)

  • I'll answer one of my questions now.  During normal init procedures, the hw_rf_set_tx_power_ble() gets called for the first time from "ble_peripheral_start()".

    The other questions still stand:

    Questions:

    1) Where is the default TX Power level defined? (file and line please)

                       (Partial Answer. See Above. )    

    2) At what point in the BLE radio initialization sequence is the TX power level set? (file and line please)

                      Answer: hw_rf_set_tx_power_ble() is first called from ble_peripheral_start()

    3) If I wanted to change the BLE radio TX power level, what is the correct sequence of operations to do so? (do I need to power down the radio first?, just stop advertising?, etc)

                      (Not Answered.  Same Question)