how to work DTM by nRF21540 GPIO mode

I want to run Direct Test Mode by nrf21540 GPIO mode. the following is my environment.

  • HW: nrf5340-DK (2.0.0 2021.42) + nrf21540-ek (1.2.0 2023.7)
  • SW: NCS v2.4.1
    • nrf5340 tx power 0dbm, nrf21540 tx gain 10dbm (default value)

default DTM (SPI/GPIO mode) is no problem. the result is max 9.5dbm.

to change from default mode to GPIO mode (only use tx-en-gpios, rx-en-gpios, pdn-gpios), I modified the following.

  1. nrf/samples/bluetooth/direct_test_mode/prj.conf
    CONFIG_MPSL_FEM_NRF21540_GPIO=y
    CONFIG_MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL=n
    
  2. nrf/lib/fem_al/Kconfig
    config NRF21540_FEM
    	bool
    	default y
    #	select MPSL_FEM_NRF21540_RUNTIME_PA_GAIN_CONTROL
    	depends on MPSL_FEM_NRF21540_GPIO || MPSL_FEM_NRF21540_GPIO_SPI
  3. nrf/boards/shields/nrf21540_ek/nrf21540_ek.overlay
    //		ant-sel-gpios = <&arduino_header 10 GPIO_ACTIVE_HIGH>; /* D4 */
    //		mode-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>;     /* D2 */
    //		spi-if = <&nrf_radio_fem_spi>;

menuconfig became the following

I tried to run but DTM did not work correctly. we can not contorol tx. (over 10 dbm)


please tell me how to way GPIO mode without mode-gpios ant-sel-gpios spi-if. 
thank you

  • my understanding, is it correct?

    • if mode pin is not controled with gpio mode, tx gain becomes 20 db, right?
    • when gpio mode only, we can not modify MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA config, right?
  • Hi,

    Apologies for the long delay.

    When not using the MODE pin in software, you must tie the pin high/low in hardware to set the TX gain. If the pin is floating the FEM is in a undefined state and the TX gain is unpredictable. If you are only using 10dB gain the MODE pin must be pulled up to VDD

    nk said:
    if mode pin is not controled with gpio mode, tx gain becomes 20 db, right?

    Only if the pin is pulled low, if it is floating the gain is undefined.

    nk said:
    when gpio mode only, we can not modify MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA config, right?

    MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA must always equal POUTA_PROD or POUTA_UICR(if the default gain have been changed by writing to the nRF21540 UICR), this config is used by the FEM driver to know what gain settings the mode pin is configured for, and does not change the gain in the FEM.

     

    Best regards,

    Bendik

Related