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

 

  • Also I wonder - I'm writing code for the application core, and using hci_rpmsg on the net core. When requesting the higher voltage, does that need to be set specifically from the net core, since it's managing the radio? Or is it a setting that is "global"?

  • 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?

  • 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

Related