Flashing Direction Finding Connectionless rx sample to nRF5340 -> GPIO toggling for antennae switching not working

Hi,

I am working on a AoA project and I am using modified main.c script form direction_finding_connectionless_rx sample. My program was working fine with nRF52833 DK but then I decided to switch to nRF5340 for more processing power. Now I want to have BLE controller on network core and host and application on application core. I followed guides on https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf5340.html and webinar https://www.youtube.com/watch?v=uqKxmsrP2Hc. Additionally I am using Boostxl-AoA antenna array from Texas Instruments.

With new board (nRF5340 DK) toggling GPIO pins for antenna switching is not working. There is no toggling of any pin (0V all the time). Everything else works as expected (receiver is able to receive periodic advertising packets with CTE and I get the IQ data).

So my procedure for flashing is like this:

1. I modified hci_rmpsg sample from Zephyr repo so it included boards directory with nrf5340dk_nrf5340_cpunet.conf file:

#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y

CONFIG_BT_CTLR_ADV_EXT=y
CONFIG_BT_CTLR_SYNC_PERIODIC=y

# Enable Direction Finding Feature including AoA and AoD
CONFIG_BT_CTLR_DF=y

# Disable Direction Finding TX mode
CONFIG_BT_CTLR_DF_ANT_SWITCH_TX=n
CONFIG_BT_CTLR_DF_ADV_CTE_TX=n

CONFIG_BT_EXT_ADV=y

and nrf5340dk_nrf5340_cpunet.overlay file:

/*
 * Copyright (c) 2021 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

&radio {
	status = "okay";
	/* This is a number of antennas that are available on antenna matrix
	 * designed by Nordic. For more information see README.rst.
	 */
	dfe-antenna-num = <16>;
	/* This is a setting that enables antenna 12 (in antenna matrix designed
	 * by Nordic) for Rx PDU. For more information see README.rst.
	 */
	dfe-pdu-antenna = <0x5>;

	/* These are GPIO pin numbers that are provided to
	 * Radio peripheral. The pins will be acquired by Radio to
	 * drive antenna switching when AoA is enabled.
	 * Pin numbers are selected to drive switches on antenna matrix
	 * desinged by Nordic. For more information see README.rst.
	 */
	dfegpio0-gpios = <&gpio0 4 0>; 
	dfegpio1-gpios = <&gpio0 5 0>; 
	dfegpio2-gpios = <&gpio0 6 0>; 
	dfegpio3-gpios = <&gpio0 7 0>; 
};

I also modified prj.conf to look like this:

CONFIG_RPMSG_SERVICE=y
CONFIG_RPMSG_SERVICE_MODE_REMOTE=y

CONFIG_HEAP_MEM_POOL_SIZE=8192

CONFIG_MAIN_STACK_SIZE=512
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_MAX_CONN=16
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_RAW_RESERVE=1
CONFIG_BT_BUF_CMD_TX_COUNT=4


# Required to enable BT_BUF_CMD_TX_SIZE for LE Set Extended Advertising Data command
CONFIG_BT_EXT_ADV=y

# Required to enable BT_PER_ADV_SYNC_MAX
CONFIG_BT_PER_ADV_SYNC=y
CONFIG_BT_OBSERVER=y

#CONFIG_BT_CTLR=y
CONFIG_BT_LL_SW_SPLIT=y

#CONFIG_BT_CTLR_ADV_EXT=y
CONFIG_BT_CTLR_SYNC_PERIODIC=y

# Enable Direction Finding Feature including AoA and AoD
CONFIG_BT_CTLR_DF=y
CONFIG_BT_CTLR_DF_ANT_SWITCH_TX=n

# Disable Direction Finding TX mode
CONFIG_BT_CTLR_DF_ADV_CTE_TX=n

# Disable AoA Feature (antenna switching) in Rx mode
CONFIG_BT_CTLR_DF_ANT_SWITCH_RX=y

2. I build and flash hci_rpmsg sample with:

west build -b  nrf5340dk_nrf5340_cpunet

west flash

3. I copied Bluetooth: Direction finding connectionless locator sample from nRF Connect SDK in separate directory. I modified main.c according to my application. My prj.conf file looks like this:

#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

#CONFIG_BT_RPMSG_NRF53=y
CONFIG_BT=y
CONFIG_BT_DEVICE_NAME="Locator nRF5340 DK"

CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV_SYNC=y
CONFIG_BT_OBSERVER=y

# Enable Direction Finding Feature including AoA and AoD
CONFIG_BT_DF=y
CONFIG_BT_DF_CONNECTIONLESS_CTE_RX=y


CONFIG_FPU=y
# for inlcude <math.h>	
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_NANO=y

CONFIG_MAIN_STACK_SIZE=8192

And my overlay-aod.conf file like this:

#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Disable AoA Feature (antenna switching) in Rx mode
CONFIG_BT_CTLR_DF_ANT_SWITCH_RX=n

4. I build and flash application to application core:

west build -b nrf5340dk_nrf5340_cpuapp

west flash

Application is working as expected. I am even getting CTE packets but with very low amplitude of IQ samples. From that hit I suspected that no antenna was selected. With oscilloscope I checked GPIO levels (p0.04, p0.05, p0.06, p0.07 -> as default configuration) that are responsible for switching antennae and for sure they are all 0V all the time. My design must have at least one pin always "one"  so that one of antennae is selected. So no antenna is selected. I guess my board can still receive periodic advertising packets with no antennae selected but the amplitude is very small. When i disconnect my antenna array form DK (I am using Murata  MXHS83QE3000 test probe to connect antenna array) and receive with just PCB antenna, then amplitudes of IQ samples get much bigger and I get no toggling of GIPO pins anyway.

Does anyone have any idea why GPIO pins are not toggling?

I tried with different GPIO pins (p1.09, p1.08, p1.05, p1.04) and got the same result.

I tried building and flashing both cores as described in Working with nRF5340. So I added child_image to root directory of application directory. But when I build the app I did not get any additional directory build/\hci_rpmsg as described here: https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-1-ncs-v1-4-0. So I stayed at flashing cores separately as described above.

Can GPIOs be controlled by network core? Is there a secure/unsecure relation broken?

Did I wrongly configured my prj.conf files and when flashing application image, network image is somehow overridden?

I am stuck and I do not know what else to do. Any help would be appreciated.

Thanks

Parents
  • Hi,

    Just a note on this problem,  which I run into as well.

    The fact that the zephyr/nrf uses a pdu-antenna in hci_rpmsg to activate the switching hardware, and not used in my case, you need to be aware that the first gpio in your list is stolen from your switch gpio vectors for the chip select.

    Shown below:

    &gpio_fwd {
        dfe-gpio-if {
            gpios = <&gpio0 25 0>,    /* pdu-antenna */
                <&gpio0 4 0>,
                <&gpio0 5 0>,
                <&gpio0 6 0>,
                <&gpio0 7 0>;
            };

    And its crucial to shift your switch pattern one bit left in order to have the correct pin output when
    switching.

    pattern1 = 0b00000001   will fail without the shift <<1 , not working
    pattern1' = 0b00000010  will is the correct value because its the 2nd gpio (in the example gpio0-4)

    I hope this will help others to make it work.

    Chris

    Update:
    hci_rpmsg, If the boards/nrf5340dk_nrf5340_cpunet.overlay dfe-pdu-antenna = <0x1> set to <0x0> there will be no more 
    signal generate, and if your switch pattern have bit0 alway 0, it will work without shift << 1 as mention above.

    Anyway, a bit trail & error.

Reply
  • Hi,

    Just a note on this problem,  which I run into as well.

    The fact that the zephyr/nrf uses a pdu-antenna in hci_rpmsg to activate the switching hardware, and not used in my case, you need to be aware that the first gpio in your list is stolen from your switch gpio vectors for the chip select.

    Shown below:

    &gpio_fwd {
        dfe-gpio-if {
            gpios = <&gpio0 25 0>,    /* pdu-antenna */
                <&gpio0 4 0>,
                <&gpio0 5 0>,
                <&gpio0 6 0>,
                <&gpio0 7 0>;
            };

    And its crucial to shift your switch pattern one bit left in order to have the correct pin output when
    switching.

    pattern1 = 0b00000001   will fail without the shift <<1 , not working
    pattern1' = 0b00000010  will is the correct value because its the 2nd gpio (in the example gpio0-4)

    I hope this will help others to make it work.

    Chris

    Update:
    hci_rpmsg, If the boards/nrf5340dk_nrf5340_cpunet.overlay dfe-pdu-antenna = <0x1> set to <0x0> there will be no more 
    signal generate, and if your switch pattern have bit0 alway 0, it will work without shift << 1 as mention above.

    Anyway, a bit trail & error.

Children
No Data
Related