BLE range testing with two nRF5340 DKs: example code for PHY and TX power variation?

Hi everyone,

I'm currently working on a BLE project using two nRF5340 DKs and would like to perform range tests to evaluate the maximum connection distance under different conditions.

My main objectives are:

  • Test BLE connection range using different PHYs (1M, 2M, Coded S=2, Coded S=8).

  • Be able to change the TX power (e.g., from -20 dBm to +3 dBm).

  • If possible, display real-time RSSI and bitrate or throughput from the central device during the connection.

I've tried doing this with different examples from the SDK (such as central_uart / peripheral_uart and hci_rpmsg / hci_pwr_ctrl), but I haven't been able to achieve the setup I need.

If anyone has any example code that does something similar or any tips or suggestions on how to approach this properly,

I would really appreciate the help!

Thanks in advance!

  • Hi Diego,

    I would suggest that you try out the throughput sample on nRF Connect SDK.. See here: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/bluetooth/throughput/README.html 

    Changing the TX power in this sample has been discussed in several tickets in Devzone like this one:  Set transmission power - nrf5340 throughput example  You could also refer: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/matter/getting_started/transmission_power.html#changing_tx_power_for_bluetooth_le 

    Best Regards,

    Swathy

  • Hi SwRa, thanks a lot for your answer!

    I had already checked the throughput sample and related DevZone posts, and they’ve been helpful. However, I believe that most of these examples assume an active BLE connection between the devices.

    What I’m actually looking for is something more like this blog post:
    devzone.nordicsemi.com/.../testing-long-range-coded-phy-with-nordic-solution-it-simply-works-922075585
    In that example, they seem to be testing range with advertising and scanning only, not requiring a full connection.

    My goal is to test and compare the actual coverage distance of all 4 PHYs (1M, 2M, Coded S=2, Coded S=8) using two nRF5340 DK boards. Ideally, I'd like to: Broadcast advertising packets using the selected PHY, measure if and when those packets are received on the other board (scanner), along with RSSI, possibly change TX power (e.g., from -20 dBm to +3 dBm), repeat for all PHYs and log the results for distance comparison...

    Do you know if there’s an example in the nRF Connect SDK for this kind of non-connected, range testing setup using advertising + scanning? Or any guidance on how to modify existing samples (like peripheral_hr and central_hr) to avoid connections but still change PHY and TX power?

    Thanks again for your support!

    Best regards,
    Diego

  • Also, I’ve been using the throughput example you mentioned, and I actually added some logic to print the RSSI in real time and detect disconnections. It works fine most of the time, though once the connection is lost, the RSSI isn't updated anymore — which is expected, and not a big issue for now.

    The main problem I’m facing is that the connection drops very quickly, even when I'm using Coded PHY S=8. In fact, when I move the boards just around 10 meters apart, they already disconnect, which I didn’t expect given that S=8 should provide a much longer range.

    I'm not sure if I'm missing something — maybe a TX power setting, or antenna placement, or something else in the project configuration?

    Any ideas or advice would be very appreciated.

  • Hi Diego,

    There is no out-of-the-box nRF Connect SDK sample that does exactly what you describe (advertising with selectable PHY, scanning with RSSI logging, and TX power control, all without establishing a connection) for the nRF5340 DK. The closest reference is the blog post on long-range testing with Coded PHY, but that example is based on the nRF52840 and the nRF5 SDK, not the nRF Connect SDK or nRF5340 DK. So the only way is to  adapt the approach from the blog post to the nRF5340 DK and nRF Connect SDK by modifying already existing samples. 

    diegonovo02 said:
    the connection drops very quickly, even when I'm using Coded PHY S=8. In fact, when I move the boards just around 10 meters apart, they already disconnect, which I didn’t expect given that S=8 should provide a much longer range.
    The connection range is often less than the maximum possible advertising/scanning range due to link layer supervision timeouts and other connection management factors. The blog post specifically notes that the maximum range in advertising/scanning mode is often greater than in connection mode. For example, in the referenced test, the non-connected (advertising/scanning) range was 1300 meters with Coded PHY, while the connected range was slightly less, even under ideal conditions. Indoors or with suboptimal antenna orientation, the range can be much less. Factors that can affect your results include: Antenna orientation, TX power, Environment, Project configuration.

    Regards,

    Swathy

Related