NCS and nRF21540 with custom protocol

Hello,

First, by "Custom Protocol" I mean that I need to directly access the radio to transmit or receive packets without the L2 layer of Zephyr (IEEE802.15.4 RAW mode).


With this custom protocol, I would like to use the nRF21540 amplifier but I can't make it work correctly.

I'm using the nRF21540DK with NCS v2.0.0 and the proprietary MPSL library but when I activate the logs in the IEEE802.15.4_nrf5.c file, I see that my packets are sent at a power of 8dBm and not 13dBm as I wanted.

I've put those parameters in my conf file:

CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=5
CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTA=5
CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB_POUTB=5
CONFIG_MPSL_FEM_NRF21540_RX_GAIN_DB=13
CONFIG_MPSL_FEM_DEVICE_CONFIG_254=y
When I put 30 for the TX_GAIN parameters, the log print a tx power of 10 and not 38.
 
I don't understand if I'm correctly using the driver or if anything is really happening.
Do I need to create my own implementation and not the MPSL one ?
Kind regards,
Andrew
Parents Reply Children
  • Hi Amanda,

    Did you make it work with the setting?

    Yes it's working, the logs are saying that the output tx power is 13 dBm and my RSSI change when I tweak the parameter.

    You can use ant-sel-gpios - GPIO characteristic of the device to control the ANT_SEL signal of the nRF21540

    I can manually control this GPIO without going through the MSPL library but it's not really zephyr friendly... As I access a GPIO controlled by a driver while bypassing it.

    Do you get any errors? It would help if you could provide the log.

    When I use those function I don't get any log error and they return 1 as the set was correctly done.

    When I debug the card with Ozone, a hard fault is detected when I try to send a packet with the tx function of the ieee802154_radio_api. 

    The target stopped in HardFault exception state.
    
    Reason: A fault with configurable priority has been escalated to a HardFault exception at 0x0001BC38.

    The problem is that I don't know if the antenna diversity module is correctly configured inside the MPSL proprietary library. Is there any API function that I can call directly from my application to change the antenna  selection or even check if the antenna diversity module is correctly configured ? 

    Line 331 of the mpsl_fem.c file, I see that the ANT_SEL pin is configured as inactive but I don't see any other function inside this file that use the ANT_SEL pin...

    #if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), ant_sel_gpios)
    	err = inactive_pin_configure(
    		DT_GPIO_PIN(DT_NODELABEL(nrf_radio_fem), ant_sel_gpios),
    		DT_GPIO_LABEL(DT_NODELABEL(nrf_radio_fem), ant_sel_gpios),
    		DT_GPIO_FLAGS(DT_NODELABEL(nrf_radio_fem), ant_sel_gpios));
    
    	if (err) {
    		return err;
    	}
    #endif

    The only examples for the nRF21540 antenna selection are without the use of MPSL, creating directly a custom driver for the nRF21540.

    Regards,

    Andrew

  • Hi, 

    There is no dedicated API to control the ANT_SEL pin, but this can be done by controlling the ANT_SEL pin with GPIO API like done in this sample

    The "Antenna Diversity" feature as described here for 802.15.4 protocol only and never went out of the experimental stage, so there are no easy Kconfigs to simply turn on this feature. 

    -Amanda

  • Hello,

    I have another question. 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

  • Hi, 

    Please create a new support case for a different issue. 

    -Amanda H.

Related