How to get a pointer to the structure of the registers, for setting VREQCTRL?

Hi all,

I'm trying to turn on the increased voltage for the +3 dBm transmit power.  I understand that to do that, I need to set the VREQCTRL register, or associated bit in a register.

I'm using nRF Connect 1.7.1 with VS Code 1.71.2 (Windows 10) and developing for the nRF5340.

I've seen several posts about doing this on DevZone, and really my question is not so much about the VREQCTRL register itself as much as how to get the pointer required to set it. This doesn't seem to be really addressed on the posts I've seen.

I think I need to call this function: nrf_vreqctrl_radio_high_voltage_set(NRF_VREQCTRL_Type *p_regbool enable), where the first argument is a pointer to the structure of the register. What is the best way to get or create that pointer?

Scott

 

Parents
  • Hi there,

    Just to be clear, you're using the Softdevice controller and the end goal is to increase the TX power right? 

    I think I need to call this function: nrf_vreqctrl_radio_high_voltage_set(NRF_VREQCTRL_Type *p_regbool enable), where the first argument is a pointer to the structure of the register. What is the best way to get or create that pointer?

    You should pass NRF_VREQCTRL which is the pointer to the VREQCTRL peripheral, the pointer should be included from nrfx_config_nrf5340_network.h which should already be part of your project.

    regards

    Jared 

  • Thanks Jared.  I apologize for my newbie-ness here.

    You're correct in stating that my goal is to increase transmit power to maximum.

    However, I'm not familiar with the term "Softdevice controller," and I didn't have nrfx_config_nrf5340_network.h included in this project. I did try adding it to my includes, though, and it did not appear to resolve the issue.

    This project lives on the app core, and on the network core is hci_rpmsg. So, if I need to take a different approach entirely to get there, I'm certainly open to that. 

    Here's a bit of code I found in another post here on devZone that I've been trying to use:

       nrf_vreqctrl_radio_high_voltage_set(NRF_VREQCTRL_NS, true);
       while(!nrf_vreqctrl_radio_high_voltage_check(NRF_VREQCTRL_NS));
    As seen in the screenshot below, the first parameter on the first line is red squiggled as undefined. This happens even if I #include <nrfx_config_nrf5340_network.h>
    I had assumed that this meant I needed to create the necessary pointer to pass in for this function, but maybe it just means I haven't included all the right headers?

Reply
  • Thanks Jared.  I apologize for my newbie-ness here.

    You're correct in stating that my goal is to increase transmit power to maximum.

    However, I'm not familiar with the term "Softdevice controller," and I didn't have nrfx_config_nrf5340_network.h included in this project. I did try adding it to my includes, though, and it did not appear to resolve the issue.

    This project lives on the app core, and on the network core is hci_rpmsg. So, if I need to take a different approach entirely to get there, I'm certainly open to that. 

    Here's a bit of code I found in another post here on devZone that I've been trying to use:

       nrf_vreqctrl_radio_high_voltage_set(NRF_VREQCTRL_NS, true);
       while(!nrf_vreqctrl_radio_high_voltage_check(NRF_VREQCTRL_NS));
    As seen in the screenshot below, the first parameter on the first line is red squiggled as undefined. This happens even if I #include <nrfx_config_nrf5340_network.h>
    I had assumed that this meant I needed to create the necessary pointer to pass in for this function, but maybe it just means I haven't included all the right headers?

Children
  • Hi,

    Since you're using hci_rpmsg I guess you're going to use BLE, either through the Zephyr controller or our Softdevice Controller. In any case, you should increase the TX power by using the HCI Power Control as in the Bluetooth: HCI Power Control example. Writing to NRF_VREQCTRL_Type shouldn't be necessary

    regards

    Jared. 

  • Looking through the HCI Power Ctrl example, I see where it sets the tx power.  But what I don't see is anywhere that it requests extra voltage.  My understanding is that normally, max tx power for the 5340 is +0 dBm, but if you request extra voltage (vreqctrl) you get a +3 dBm offset to all of the existing settings. So, +0 dBm becomes +3 dBm.  In other words, I have no trouble setting power to +0 (which is the highest setting), but I think I need to request that extra voltage in order for this to become +3 dBm.  Have I misunderstood?

    Thanks!

    Scott

  • Scott,

    That was indeed the case before nRF Connect SDK v1.6.0. 

    From changelog:

    • Increased the maximum supported radio output power on nRF53 Series devices from 0 dBm to 3 dBm. If the output power is above 0 dBm, NRF_VREQCTRL->VREGRADIO.VREQH is set (DRGN-15476).

    Which means that the HCI driver should automatically set the VREQCTRL register if you chose an output power over 0 dBm. In the latest NCS version you can use CONFIG_BT_CTLR_TX_PWR to set the default TX power. Do you get any errors if you try to set the TX power to +3 dBm? 

    regards

    Jared 

  • Hi Jared,

    Thanks for the info. This helped clear up some confusion on my side and it's working now.

    So the key things I needed to realize were:

    • The VREQCTRL register gets automatically set if a power level above 0 dBm is requested, so it doesn't need to be manually set.
    • Transmit power parameter is specified as a number in dBm that is the actual power level desired. So if I want +3, I pass in 3 as a parameter, and if I want -12, I pass in -12, and so forth.

    Previously I had been under the impression that there was a set of parameters mapped to different values, like  0 = 0 dBm, 1 = -4 dBm, 2 = -8 dBm, etc.  So, I misunderstood how the power needs to be set as well, and that added to my confusion.

    Thanks for your help, Jared.

    Scott

Related