nrf21540 gain control

Hi All!

Hope you are doing well. I am using NCS 2.0.2 and VSCODE studio. Radio Test example using nrf52833+nrf21540(custom HW) . I want to ask a question how to control the gain of nrf21540 ? 

How to enable it in the radio test example and what will be the sequence of commands for that?

I am using a sequence of commands with only nrf52833DK to ensure FW is working. And output RSSI value is increasing.

output_power pos0dB  /3db /8db

 start_channel 20
 end_channel 60
 start_tx_carrier
 start_tx_sweep

Thanks & Regards,

Parents Reply
  • Just want to share I understood the reason CONFIG_FEM was not set to y. Its dependency MPSL_FEM_ANY_SUPPORT was not set for boards without FEMs.

    # From nrf/subsys/mpsl/fem/Kconfig
    
    config MPSL_FEM_ANY_SUPPORT
    	bool
    	default $(dt_nodelabel_enabled,nrf_radio_fem)

    Thus, if you build for a board with nrf_radio_fem, CONFIG_FEM and consequently CONFIG_MPSL and CONFIG_MPSL_FEM_ONLY should be enabled on their own.

Children
  • HI Hieu 

    Again thank you for your concern and support. I will try to enable it as per your instructions. Facing some issues. Will try to update you on this.

    Thanks & Regards,

  • Hi Hieu

    Thank you for your support and response! I am facing the same issue.

    when 

    Thus, if you build for a board with nrf_radio_fem, CONFIG_FEM and consequently CONFIG_MPSL and CONFIG_MPSL_FEM_ONLY should be enabled on their ow

     

     I set the board "nrf21540_nrf52840" instead of nrf52833DK

     I got the following error!  for build2

    and 

    Can you please help me where is the issue ? 

    Thanks & Regards,

    Muhammad Usman

  • Hi Hieu

    One more observation, when I updated the NCS to 2.3.0. It Enabled the following options.

    In kconfig options:

    .conf file

    But when I restarted the Vscode studio above options were disabled. Can you please also help me in this regard where is the issue?

    Thanks & Regards

    Muhammad Usman

  • Hi Muhammad,

    Muhammad Usman said:

     I set the board "nrf21540_nrf52840" instead of nrf52833DK

     I got the following error!  for build2

    Looking at the error, I guess that you are working with a standalone project you created based on the radio_test sample. However, the radio_test sample does not work that way. You will need to build it from its location within the nRF Connect SDK.

    Muhammad Usman said:
    But when I restarted the Vscode studio above options were disabled. Can you please also help me in this regard where is the issue?

    Firstly, I don't understand what you mean by the above options being disabled. Do you mean that you cannot set them for some reasons? Or do you mean their values are reset somehow?

    If it's their values getting reset, please check if you are using the Save or Save to file button. "Save" only stores the changes to the <build folder>/zephyr/.config file, while only "Save to file" would store the changes to your prj.conf file for subsequent builds.

    Secondly, I see that you are updating CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA and CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTB. Do you fully understand what those configurations do? They refer to the actual POUTA and POUTB in your nRF21540, which can be one-time configured (it's only once over the chip's entire lifetime).

    The factory default of POUTA is 20dB and of POUTB is 10dB. Unless you have performed the one-time configuration of the nRF21540 I mentioned above, then these cannot be changed.

    Related to that, CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB can only be either the value of POUTA or POUTB.

    For more information regarding the two output levels, please refer to the nRF21540 Product Specification.

    Regards,

    Hieu

  • Hi Hieu

    Thank you again for your response and help.

    Looking at the error, I guess that you are working with a standalone project you created based on the radio_test sample. However, the radio_test sample does not work that way. You will need to build it from its location within the nRF Connect SDK.

    Thank you I tried your option and it worked for me for "nrf21540_52840".

    Will that option also work for "52833DK"?

    I added the following lines in  prj.conf file

    CONFIG_FEM=y
    
    CONFIG_MPSL=y
    
    CONFIG_MPSL_FEM=y
    
    CONFIG_MPSL_FEM_ONLY=y      #GPIO/ SPI control features 
    
    
    CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y
    
    CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y
    
    CONFIG_MPSL_FEM_POWER_MODEL=y

    I tried for 52833DK by selecting the board from add build configuration but got the following warnings.

    warning: MPSL_FEM (defined at C:/ncs/v2.3.0/nrf\subsys\mpsl\fem/Kconfig:37) was assigned the value
    'y' but got the value 'n'. Check these unsatisfied dependencies: MPSL_FEM_ANY_SUPPORT (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MPSL_FEM and/or look up MPSL_FEM in the
    menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
    and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
    
    
    warning: MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL (defined at
    C:/ncs/v2.3.0/nrf\subsys\mpsl\fem/Kconfig:132) was assigned the value 'y' but got the value 'n'.
    Check these unsatisfied dependencies: (MPSL_FEM_NRF21540_GPIO || MPSL_FEM_NRF21540_GPIO_SPI) (=n),
    MPSL_FEM (=n), (MPSL_FEM || MPSL_FEM_PIN_FORWARDER) (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL
    and/or look up MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL in the menuconfig/guiconfig interface. The
    Parsing C:/ncs/v2.3.0/nrf/samples/peripheral/radio_test/Kconfig
    Loaded configuration 'C:/ncs/v2.3.0/zephyr/boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833_defconfig'
    Merged configuration 'c:/ncs/v2.3.0/nrf/samples/peripheral/radio_test/prj.conf'
    Configuration saved to 'C:/ncs/v2.3.0/nrf/samples/peripheral/radio_test/build_1/zephyr/.config'
    Kconfig header saved to 'C:/ncs/v2.3.0/nrf/samples/peripheral/radio_test/build_1/zephyr/include/generated/autoconf.h'
    Application Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices
    sections of the manual might be helpful too.
    
    
    warning: MPSL_FEM_POWER_MODEL (defined at C:/ncs/v2.3.0/nrf\subsys\mpsl\fem/Kconfig:154) was
    assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: MPSL_FEM (=n).
    See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MPSL_FEM_POWER_MODEL and/or look up
    MPSL_FEM_POWER_MODEL in the menuconfig/guiconfig interface. The Application Development Primer,
    Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
    helpful too.
    
    
    warning: The choice symbol MPSL_FEM_NRF21540_GPIO_SPI (defined at
    C:/ncs/v2.3.0/nrf\subsys\mpsl\fem/Kconfig:70) was selected (set =y), but no symbol ended up as the
    choice selection. See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MPSL_FEM_NRF21540_GPIO_SPI and/or look up
    MPSL_FEM_NRF21540_GPIO_SPI in the menuconfig/guiconfig interface. The Application Development
    Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
    might be helpful too.

    And CONFIG_FEM is also disabled

    is there any other thing I am missing? Because I have to run the code on custom Hardware nrf52833_nrf21540.

    Or do u have any other option for that?

    Firstly, I don't understand what you mean by the above options being disabled. Do you mean that you cannot set them for some reasons? Or do you mean their values are reset somehow?

     Thank you, now I understand my mistake after your response!

    Thanks & Regards,

    Muhammad Usman 

Related