nRF21540 hardware bringup on custom board

We have a custom board with nRF5340 + nRF21540

I'm going through hardware bringup (checking all the signals with an oscilloscope, etc.) and the nRF21540 is one of the last parts left

Ultimately, I want to update our custom software to include menu options to use the nRF21540 (control RF muxing, hi/lo power, etc.)

But my plan for getting there is start with the nRF21540-DK software provided in this blog

I successfully used the Programmer app in "nRF Connect for Desktop" to program an nRF21540-DK board with the 4747.nRF21540\nRF21540\Pos20dBm\peripheral_nus.hex image provided on the blog (in 4747.nRF21540.zip).  Using the nRF Connect app on my iPhone I can see it advertising at very high power, and LED1 is blinking.  If I power up another nRF21540-DK board configured as central 0dB, LED2 turns on on the peripheral +20dB board.

I tried converting the project in adv_nRF21540_20dBm.zip (downloaded from the blog), update it to nRF Connect SDK v2.2.0 (the version we're currently on), but that didn't work.  It doesn't appear to be transmitting (according to the nRF Connect app on my iPhone).  All 4 LEDs (LED1/2/3/4) are on solid.

I notice that if I include the line "CONFIG_SDC_SLAVE_COUNT=3" in prj.conf I get the error "attempt to assign the value '3' to the undefined symbol SDC_SLAVE_COUNT"

Here is my project

adv_nRF21540_20dBm-20230302.zip

Can you tell what I'm doing wrong?

After I get this working, my plan is to rebuild the project for nRF5340-DK + nRF21540-EK (daughter board)

Once that works I'll try updating our custom firmware.

  • Or if there is a better way to get nRF21540 working with nRF5340, please let me know.

    If there is a shell sample program with nRF21540 commands, that would probably be perfect

  • Hello,

    I have tested your sample setting as peripheral. nRf21540 was not able to act as scanner from the nRF Ble app. 

    So, we guess there is something wrong with FW when porting it to NCS v2.2.0. You also need to use latest version v.2.3.0 of NCS.

     You can use peripheral_uart sample https://github.com/nrfconnect/sdk-nrf/tree/main/samples/bluetooth/peripheral_uart from our official SDK. 

    You also can find how to build the sample with support for the nRF21540 (Front End Module) in the following link:

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.3.0/nrf/samples/bluetooth/peripheral_uart/README.html#fem-support

    Thanks.

    Have a nice weekend. 

    BR

    Kazi

  • One of the options for building with support for FEM is "Build the sample for one board that contains the nRF21540 FEM, such as nrf21540dk_nrf52840", which is what I'm doing.  At least I tried that with the peripheral_uart sample before submitting the ticket.

    Once the support is there, how do I switch between low power, high power, and power down mode on the FEM?

    Where would I find the SDK support for things like that?

  • Hello,

    To enable FEM support, you must add an nrf_radio_fem node in the devicetree file. The node can also be provided by the devicetree file of the target development kit or by an overlay file. 

    I have feedback from our expert in team 
    ''you can use PDN to control the power state of the FEM. This should be automatically be enabled and disabled by the protocol stack using the PDN pin. If this is a standalone app not using any protocol stack then they need to control pdn gpio themselves in the app. In Bluetooth low energy it is automatically done in the controller.''

  • Let me share what I've learned so far, and I have another 2 follow-up questions.

    I started with the peripheral_uart example, and made the changes to use it on the nRF21540-DK board.

    To make the FEM_MODE pin stay low, add “CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=20” to prj.conf

    To make the FEM_MODE pin stay high, add “CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB=10” to prj.conf (instead of the line above)

    To use ANT1, use “ant-sel-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;” in app.overlay

    To use ANT2, use “ant-sel-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;” in app.overlay

    Are those the "right" way to manipulate the MODE and ANT_SEL pins?

    Now I've moved on to the nRF5340-DK + nRF21540-EK

    I see that the default way of handling this setup is loading an image into the network core

    (-Dhci_rpmsg_SHIELD=nrf21540_ek, -DSHIELD=nrf21540_ek_fwd)

    After doing that, I didn't see any of the nRF21540 pins "wiggling" (changing state)

    So I added this to to app.overlay

    	nrf_radio_fem: nrf21540_fem {
    		compatible = "nordic,nrf21540-fem";
    		tx-en-gpios = <&arduino_header 11 GPIO_ACTIVE_HIGH>;   /* D5 */
    		rx-en-gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>;    /* D3 */
    		pdn-gpios = <&arduino_header 15 GPIO_ACTIVE_HIGH>;     /* D9 */
    		ant-sel-gpios = <&arduino_header 10 GPIO_ACTIVE_HIGH>; /* D4 */
    		mode-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>;     /* D2 */
    		supply-voltage-mv = <3000>;
    	};

    Now the pins are wiggling, but I'm getting some build warnings, and I don't seem to be able to manipulate the FEM_MODE and ANT_SEL signals the same.  Is this the right way to implement nRF21540 on nRF5340?

    Where would I find the code, device tree (dts, overlays, etc.) and CONFIG settings for the image that gets loaded in the network core?

    Here is my current project

    peripheral_uart-nRF5340-nRF21540-20230310.zip

Related