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 Children
  • Hi Muhammad,

    If you just build the project and examine the Kconfig output, you will see that the MPSL library is already enabled.

    Update: The library is not included by default. See my next reply

    Without building, you can find how to include the MPSL library with one of these two approaches.

    The first one is you can see that the sample folder contains a Kconfig file. This adds Kconfig options unique to the sample that you can build with.

    In that Kconfig file, you can see that it also "includes" another Kconfig file with the rsource line, which include another one... Overall, the sample will add Kconfig defined in the following files:
    \<ncs_sdk_folder>\nrf\samples\bluetooth\direct_test_mode\src\fem\Kconfig
    \<ncs_sdk_folder>\nrf\samples\bluetooth\direct_test_mode\Kconfig
    \<ncs_sdk_folder>\nrf\samples\peripheral\radio_test\Kconfig

    Going over all the configuration, you can see that you it has the Kconfig CONFIG_FEM, which is on by default, and will include the MPSL in FEM only mode for you.

    Update: CONFIG_FEM is not enabled by default. See my next reply.


    The second approach is to follow the guide linked below and add enable the following Kconfig
    CONFIG_MPSL
    CONFIG_MPSL_FEM_ONLY
    Guide referred: Working with RF front-end modules — nRF Connect SDK 2.3.0 documentation (nordicsemi.com)

    But as we see from the first approach, those configurations are turned on by default due to the project's setup.

  • I just realized my already built project had options changed, and double checked with a fresh unmodified default build.
    There I see that CONFIG_FEM is not enabled by default. I am not sure why since it is supposed to default to n.

    CONFIG_FEM=y
    CONFIG_NRF21540_FEM=y

    The second option from my previous reply would successfully get the MPSL library into your Radio Test build. But the code relies on CONFIG_FEM to work correctly, so please use this option.

    Sorry for the inaccuracies in my previous reply.

  • thank you so much for your concern and response! I just read your messages and I will try and update here as well!

    Thanks & regards,

    Muhammad Usman

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

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

Related