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

    From the team:

    The TX power being logged in the nrf802154_nrf5.c file https://github.com/nrfconnect/sdk-zephyr/blob/42a1b2637a135036c5355473058cef3d2821af2c/drivers/ieee802154/ieee802154_nrf5.c#L363 is the power requested on the antenna. Changing mentioned Kconfigf gain parameters of the FEM does not affect what the application requests for tx power. The nRF 802.15 4 Radio Driver takes the requested value and passes it to Front-End Support Module in MPSL which performs split of the power between SoC and FEM.

    Having a higher gain Kconfig option will simply lead to use lower power on the SoC. 

    The application must request more power in runt-time.

    The second potential misuse is that these Kconfig options MPSL_FEM_NRF21540_TX_GAIN_DB don't physically set the gain that will be achieved by the nRF21540. This value is not transferred to the nRF21540 chip. It rather informs software about the gain that the given nRF21540 used on the target board is calibrated for. Default values are 10 and 20 dB.

    Regards,
    Amanda

  • Hi Amanda,

    Thank you for the quick reply!

    So if I want a final power of 13dBm, I need to set 

    CONFIG_NET_CONFIG_IEEE802154_RADIO_TX_POWER to 13 and leave MPSL_FEM_NRF21540_TX_GAIN_DB to the default value, is that correct ?
    Also, how can I choose which antenna is used (ANT_SEL pin) in my application with the MPSL library ?
     

    I've tried to use those function but when I use them, the radio is not working anymore. 

    nrf_802154_antenna_diversity_tx_mode_set(NRF_802154_SL_ANT_DIV_MODE_MANUAL);
    nrf_802154_antenna_diversity_tx_antenna_set(NRF_802154_SL_ANT_DIV_ANTENNA_2);

    Kind regards,

    Andrew

  • Hi Andrew, 

    AndrewSafehear said:
    CONFIG_NET_CONFIG_IEEE802154_RADIO_TX_POWER to 13 and leave MPSL_FEM_NRF21540_TX_GAIN_DB to the default value, is that correct ?

    Yes, this is the way. 

    AndrewSafehear said:
    how can I choose which antenna is used (ANT_SEL pin) in my application with the MPSL library ?

    You can use ant-sel-gpios - GPIO characteristic of the device to control the ANT_SEL signal of the nRF21540. See Optional propertiesIf pulled low = 0 then only ANT 1. If pulled high = 1, the ANT 2 is used. Also, see this https://github.com/nrfconnect/sdk-zephyr/blob/f7b06162027da4421bd7df097137b601a21ceb8d/boards/arm/nrf21540dk_nrf52840/nrf21540dk_nrf52840.dts#L119 

    AndrewSafehear said:
    I've tried to use those function but when I use them, the radio is not working anymore. 

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

    -Amanda

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

Reply Children
No Data
Related