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

    You can find the guide to use the FEM together with the Radio Test in the Radio Test documentation:
    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/samples/peripheral/radio_test/README.html

    Regards,

    Hieu

  • Hi Hieu

    thank you for the response! I read this. The issue I am facing is that how to add the MPSL library into the NCS vs code. studio.Because its required to set the gain of nrf21540. Can you please refer to some examples available for that?

    Thanks & Regards,

    Muhammad Usman

  • Hi Hieu!

    Again thank you so much for your support!

    You are right, I have to read and understand the basic functionality. Thank you for the links and guidance! Definitely, I will go through all these.

    In the last 2 days, I tried to enable the nrf21540 FEM module for nrf52833. I assigned the pins according to the custom board design (nrf21540+nrf52833).I want to share my work with you. Am I in the right direction?

    Here is the image which explains the configuration of the .dts .overlay file and device tree output.Now MP

    Now,

    CONFIG_MPSL=y
    CONFIG_MPSL_FEM=y
    CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y
    also enabled in the prj.conf file and "fem.h" in radio_cmd.c  and radio_test.c as well. 
    The last thing pending is to test on custom HW. Which will be available to me in 4-5 days.

    Thanks & Regards,

    Muhammad Usman

     

  • Hi Muhammad,

    I am not too confident in review things without test, but the content looks right to me. Just remember to define the SPI IF pins correctly as well.

    Are you modifying the nrf52833dk_nrf52833.dts file directly? You shouldn't do that, and just use the overlay file.

    Finally, as we discussed before, the three Kconfigs you listed should be enabled by default if your DTS work correctly, so please try not setting them explicitly, and run a build to see if they are enabled by default in the zephyr/.config file.

    On second thought, if the DTS setup does not work correctly, the Kconfigs should also just be disabled due to unsatisfied dependencies.

    Regards,

    Hieu

  • Hi Hieu,

    Thank you so much for your support! Sure i will follow all your instructions. yes, I modified the overlay file only. Will take 1-2 days to get the hardware for testing. I will update my findings soon on it.

    Thanks &  Regards,

    Muhammad Usman

  • Hi Hieu!

    I tried the radio test example as per above mentioned configuration but the RSSI viewer is showing -38dbm when i set 0dbm gain at nrf52833 and 20dbm default gain at nrf21540. Is it possible to read the CONFREG registers of nrf21540? via Vscode studio debugger? 

    Or any other option to observe that nrf21540 is working? One more option is to view SPI signals on an oscilloscope.

    What u suggest?

    Thanks & Regards,

    Muhammad Usman

  • Hi Muhammad,

    It is not possible to read the CONFREG registers of the nRF21540 via the VS Code Studio Debugger, because the debugger interface is not connected to the nRF21540 in anyway.

    You will need to read that register through the SPI interface.

    Viewing the SPI signals on an oscilloscope or a logic analyzer would tell you whether the nRF52/53 SoC is controlling the FEM but does not guarantee that the FEM is working.

    To confirm that the FEM is working, the best method is to measure the output power of the antenna directly, for example with a spectrum analyzer.

    As an alternative, you could consider configuring the FEM to different output power with the <output_power> and <total_output_power> commands and see if the RSSI value is changing as you would expect it to be. RSSI value is not very reliable, but as long as you keep the physical setup stable, it should be able to help you see differences.

    Regards,

    Hieu

Reply
  • Hi Muhammad,

    It is not possible to read the CONFREG registers of the nRF21540 via the VS Code Studio Debugger, because the debugger interface is not connected to the nRF21540 in anyway.

    You will need to read that register through the SPI interface.

    Viewing the SPI signals on an oscilloscope or a logic analyzer would tell you whether the nRF52/53 SoC is controlling the FEM but does not guarantee that the FEM is working.

    To confirm that the FEM is working, the best method is to measure the output power of the antenna directly, for example with a spectrum analyzer.

    As an alternative, you could consider configuring the FEM to different output power with the <output_power> and <total_output_power> commands and see if the RSSI value is changing as you would expect it to be. RSSI value is not very reliable, but as long as you keep the physical setup stable, it should be able to help you see differences.

    Regards,

    Hieu

Children
Related