nRF21540 custom gain with MPSL

Hello,

To follow the talk we add on this ticket.

 How can I configure a custom TX gain with the MPSL library ?

I want to have an output power of 8 dBm on the nRF21540.

I tried to change the MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA and set CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL configs but the signal on a analyzer was -23dBm and not near 8 dBm as I wanted.

When I just use the default value of 10 dBm, the analyzer get a power near 10 dBm as wanted.

Regards,

Andrew

Parents Reply
  • Here is the conf file used with the radio_test project for the nrf21540dk_nrf52840 board:

    #
    # Copyright (c) 2020 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    CONFIG_CONSOLE=y
    CONFIG_CONSOLE_HANDLER=y
    CONFIG_SHELL=y
    
    CONFIG_DYNAMIC_INTERRUPTS=y
    
    CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y
    CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y
    CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA=8
    
    CONFIG_NRFX_TIMER0=y
    
    CONFIG_ENTROPY_GENERATOR=y
    
    CONFIG_SHELL_BACKEND_RTT=y
    CONFIG_SENSOR=y

    WIth this one, when I use the command "total_output_power 8" and then "start_tx_modulated_carrier" I have -23dBm on the analyzer.

    Regards,

    Andrew

Children
  • Hi, 

    What NCS version are you using?

    A known bug was identified which lead to incorrect values being set in the TXPOWER register, sounding very similar to the issue you describe, and we have a fix to the issue which is covered by this pull request.

    Would you be able to apply this PR on your end and see if it fixes your issue? If it doesn't work in your version, is it possible for you to test the PR with v2.2.0? 

    In order to apply the PR to your local NCS installation you can use the following Git commands:

    // Open a Git bash and navigate to the nrf folder of the v2.2.0 installation
    git fetch origin pull/10120/head:pr_10120_test_branch
    git checkout pr_10120_test_branch
    west update
    
    // In order to go back
    git checkout v2.2.0
    west update

    Regards,
    Amanda H.

  • Hi,

    I'm using NCS v2.2.0.
    As I can see the PR resolve a problem with the HCI driver.
    But I don't use it as I use the 802.15.4 driver on my main project. And the bug is also here with my main project.

    I will try to use the PR but I'm not sure if it will change something.

    Regards,

    Andrew

  • Hi,

    The PR didn't help...

    When I use my project (802.15.4 nrf driver with a TX power configured at 10dBm) and check with wireshark (nrf52840-DK sniffer), without those configs: 

    CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y
    CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y
    CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA=8

    I have a RSSI of -22dBm at 5cm.

    With those configs, I have a RSSI of -40dBm at 5cm...

    Same code, same TX power requested. The only change is those 3 lines inside the prj.conf file.

    Regards,

    Andrew

  • Hi Andrew, 

    AndrewSafehear said:
    The PR didn't help...

    Doesn't the PR help the radio_test project? Another customer said that can help with the radio_test. Since you provide the config for the radio_test project for the nrf21540dk_nrf52840 board and used the command "total_output_power 8" and then "start_tx_modulated_carrier", I provide the PR for fixing the known issue. 

    AndrewSafehear said:
    When I use my project (802.15.4 nrf driver with a TX power configured at 10dBm)

    Are you using the same project as this ticket? If not, what is the difference? It seems you already get the desired output tx power in that case. 

    Do you mean to set CONFIG_NET_CONFIG_IEEE802154_RADIO_TX_POWER to 10 in your project? If so, is it possible to try to set CONFIG_NET_CONFIG_IEEE802154_RADIO_TX_POWER to 8 and leave MPSL_FEM_NRF21540_TX_GAIN_DB to the default value? Also, use

    CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y

    I tried to change the MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA and set CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL configs but the signal on a analyzer was -23dBm and not near 8 dBm as I wanted.

    When I just use the default value of 10 dBm, the analyzer get a power near 10 dBm as wanted.

    Do you mean you are able to get the default value of 10 dBm with the radio_test sample or your project?

    -Amanda H.

  • Hello Amanda,

    Doesn't the PR help the radio_test project?

    I don't have a spectral analyzer free right now so I can't say... I will have it tomorrow.

    Are you using the same project as this ticket?

    Yes I am. I got the desired output power (10dBm) when I leave MPSL_FEM_NRF21540_TX_GAIN_DB to the default value. When I try to put CONFIG_NET_CONFIG_IEEE802154_RADIO_TX_POWER to 8 I don't really get 8dBm as the nRF21540 is configured at 10dBm and the nRF52840 is configured at -4dBm (a total of 6 and not 8).

    I already use CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y in this program.

    Do you mean you are able to get the default value of 10 dBm with the radio_test sample or your project?

    I will try to make a summary of all my tests:

    Default values are: 

    - MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y
    - MPSL_FEM_NRF21540_GPIO_SPI=y
    - MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA=20
    - MPSL_FEM_NRF21540_TX_GAIN_DB_POUTB = 10

    Modified values are:

    - MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=y
    - MPSL_FEM_NRF21540_GPIO_SPI=y
    - MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA=8
    - MPSL_FEM_NRF21540_TX_GAIN_DB_POUTB = 10

    When I use default values and I want 10 dBm, I get it on both project.

    When I use default values and I want 8dB, I get 6 dBm on both.

    When I use default values, change MPSL_FEM_NRF21540_TX_GAIN_DB to 10dBm and I want 10 dBm, I get it on both project.

    When I use modified values and change MPSL_FEM_NRF21540_TX_GAIN_DB to 8dBm, I get -23dBm on both project.

    When I use modified values and change MPSL_FEM_NRF21540_TX_GAIN_DB to 10dBm, I get -23dBm on both project.

    The problem appears when I try to change MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA.

    Sorry if I was confusing...

    I really need to be able to change the nRF21540 parameters on the go if possible...

    If it's really not possible, I will try to change UICR values for my last try.


    Kind regards,
    Andrew

Related