Direction Finding Project: Central and Peripheral Integration

Now I am using the https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/direction_finding_central/README.html and https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/direction_finding_peripheral/README.html for a direction finding project.
I am using the nRF52833DK and an antenna array designed by Nordic. The SDK I used is nRF Connect SDK v2.2.0.

Here I have an uncommon requirement: each of my devices needs to act as both a central and a peripheral.
For example, a device with a single antenna will act as a central to collect the CTE for AoD estimation and as a peripheral to transmit the CTE for AoA estimation. Conversely, a device with an antenna array will act as a central to collect the CTE for AoA estimation and as a peripheral to transmit the CTE for AoD estimation.
Yes, I admit this is not common in direction finding, but it is actually the core function of my project.

-----------------------------------------------------------------------------------

Firstly, I concat the two prj.conf, two nrf52833dk_nrf52833.conf, the overlay-aoa.conf the and overlay-aod.conf.
Now my central and peripheral is using the same prj.conf and nrf52833dk_nrf52833.conf. I added a variable AoA_AoD_Setting to control whether the estimation value is AoA or AoD, so I no longer need overlay-aoa.conf and overlay-aod.conf.
I have tested this setup and can obtain the correct AoA or AoD separately based on the AoA_AoD_Setting in main.c.


Next, I need to combine the main.c of the central and the main.c of the peripheral, and rewrite the main function to switch between AoA and AoD modes, as well as between central and peripheral modes.

Here let's focus on the antenna array side.
1) initialize the bluetooth as a RX.
while(true)
 2) Start scan(), and wait for a connection to calculate the AoA.
 3) Once a connection is established, call enable_cte_request and wait for CTE collection.
 4) Disconnect the connection and call bt_le_scan_stop() when the CTE collection complated In cte_recv_cb.
 5) The AoA is complated, call bt_le_adv_start() and request for a connection.
 6) When the connection is established, call enable_cte_response(conn) and start transmitting the CTE packet.
 7) Wait for the disconnection of the peer device once it completes the CTE collection for AoD estimation.
 8) Call bt_le_adv_stop().
end while

The single antenna side follows a similar process, but it first acts as a TX to transmit the CTE packet for AoA, and then switches to RX to collect the CTE packet for AoD.

Now the while loop above reaches step 6) successfully (or at least it appears to). I can get the correct AoA value from the CTE collected in step 3) and 4). However, when I switch to TX mode, the connection can't be estiblished. The TX(antenna array) just transmit all the time, and the RX(single antenna side) just scan all the time.
So why can't the connection be estiblished?

For switch modes, I just use the following functions:
bt_le_scan_start();
enable_cte_reqest();
bt_le_scan_stop();
bt_le_adv_start();
enable_cte_response(conn);
bt_le_adv_stop();

I guess there are two things I need to understand:
A) In enable_cte_request(), the functions bt_df_conn_cte_rx_enable() and bt_df_conn_cte_req_enable() set certain settings. So, when I call enable_cte_response(), do I need to drop or cancel the settings made by bt_df_conn_cte_rx_enable() and bt_df_conn_cte_req_enable()?
B) I know that Bluetooth can only be initialized once in Zephyr. Is there any operation similar to "drop", allowing me to call bt_enable() multiple times?

Thanks!

  • Thanks for the reply,

    It seems these operations are really quite decoupled and convenient: advertising, scanning, connecting, disconnecting, etc. I was able to resolve error -120 and error -22.

    However, I still face an issue when my two devices switch roles for the first time. One device keeps advertising and the other keeps scanning, but they just won't establish a connection. Everything looks good. There is no error, no failed, no warnning.

    I believe my implementation is quite straightforward: start advertising, connecting, disconnecting, disable advertising, start scanning. The other device performs the opposite operations. Is there anything specific I need to pay attention to during this process?

  • Thank you for your reply! I have resolved the issue!

  • I am just curious about for the antenna array you are using? Can you provide the reference link or something? I have nrf52833dk which i am using as a tag and I am confused about which antenna array I should use. It would be really helpful.

    Thanks

  • Hello, the antenna array I am using is designed by Nordic, which you can find here: https://www.youtube.com/watch?v=AtS6HsrUgZQ&t=1s.

    However, it seems that Nordic does not produce their own designed antenna arrays and only uses them as a basis for their DF demos. I think it would be a good idea to try purchasing an AoA kit like InsightSiP. Alternatively, you can print an array board yourself using acrylic sheets and connect antennas with RF switches as shown in the YouTube video. Overall, it's relatively simple hardware, and customizing it yourself won't take too much time.

    I have a strong interest in AoA and AoD, and I welcome any related questions or discussions.

    Yours,

    Zihao

  • By the ways, are you interested in Central and Peripheral Integration?

    I think this is a relatively niche operation, as I mentioned in this case. So, could you share what project you are working on that led you to this case? I'm just curious, but it's perfectly fine if you'd rather not share.

Related