XIAO nRF54L15 - BLE Coded PHY S=8 for Wireless Sensor Data

Hi everyone!

I’m currently working on a project during my internship where I’m investigating wireless communication for transmitting sensor data.

The goal is to send relatively small amounts of data (approximately 64 bytes) every 500 milliseconds over a distance of around 100 meters. Since reliability is one of the main requirements, I’ve been experimenting with BLE Coded PHY S=8 using the Seeed Studio XIAO nRF54L15.

So far, I’ve managed to establish BLE connections and successfully transmit data between multiple XIAO boards. However, I’ve run into a few challenges that I’m hoping someone here might be able to help me with.

Verifying Coded PHY S=8

My code reports tx_phy = 4 and rx_phy = 4, which confirms that LE Coded PHY is being used. However, I’m still unsure how to verify whether the actual data transmission uses S=8 rather than S=2. Is there a way to confirm this through software, or would I need additional hardware to measure it?

Low RSSI values

Another issue I’ve noticed is that the RSSI is consistently quite low, usually around -90 to -98 dBm, even when the boards are less than 2 meters apart.

I’m currently using the onboard ceramic antennas, and I suspect this might have something to do with the antenna configuration or RF switch. I’ve looked into the settings for controlling the power to the RF switch and selecting between the onboard and external antenna, but I’m not entirely sure whether everything is configured correctly.

Connection stability

The connection also occasionally drops, sometimes with errors such as 0x08 and 0x28, before reconnecting.

To deal with temporary connection losses, I’ve implemented a buffering system that stores sensor measurements locally and automatically sends them once the connection has been restored. Since the data is intended for offline analysis rather than real-time monitoring, a short delay isn’t a major issue. However, I’d prefer to have a stable connection in the first place and use the buffer mainly as a fallback.

While looking for information, I came across the excellent range tests shared by @msfujino and decided to try his example code. I made a few modifications to run it without the OLED display using nRF Connect SDK v3.4.1. I successfully managed to establish a LE Coded PHY connection, but I’m still experiencing the low RSSI values and occasional disconnections mentioned above.

My main question is: Has anyone here successfully used BLE Coded PHY S=8 on the XIAO nRF54L15 for reliable, periodic sensor data transmission? I’m particularly interested in how you verified S=8 and whether there are specific settings or configurations that could help improve the signal strength, range and overall connection stability.

Any advice, experiences or examples would be greatly appreciated!

Thanks in advance!

https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-1-bluetooth-low-energy-introduction/topic/phy-radio-modes/?version=v3.3.0

Hi there,

And Welcome here,

So, 2 ways I use to check the Stats.
Look at the connection params in Nrf for Desktop BLE app. shows the connections settings.
or
2. Check the Connection Parameters Event (ESP-IDF / Arduino)

When the connection event callback triggers (ESP_GATTC_CONNECT_EVT or BLE_GAP_EVT_CONNECTED), the connection parameter update structure provides the active coding scheme details. You can read the conn_params or query the link directly:

esp_ble_conn_update_params_t conn_params = {0};
// The connection handle can be used to query active PHY details
esp_ble_gap_read_rssi(param->connect.remote_bda);

In the Nordic or ESP-IDF Bluetooth stack logs, look closely at the debug output when the connection establishes. The stack logs the active LE Coded PHY option explicitly during the PHY update complete callback:

  • BLE_GAP_PHY_CODED with S=8 will show a significantly longer packet transmission duration and lower throughput profile in the link layer logs compared to S=2.

2. Verify via Air Time / Range Benchmark

Because you cannot read an explicit s_factor variable directly from standard high-level GATT APIs in some core versions, the most foolproof software verification method is measuring packet round-trip time (RTT) or effective payload transmission time:

  • S=2 doubles the range of uncoded PHY by coding 2 symbols per bit.

  • S=8 quadruples the range by coding 8 symbols per bit, meaning transmission time for your 64-byte payload will take exactly 4 times longer than S=2 under identical conditions.

Your using the SoftDevice so there are Debug modes you can use as well.(look at the call back )

The Low RSSI’s are probably related to the Switch and configuration settings for the Coded_PHY, If you post up the code , Using the code Tags above “</>” paste it in there,
We can look. :+1:

HTH
GL :slight_smile: PJ :v:

Hi @Tymen,
I ran the code in post #1 at the link below to check the RSSI, and it was 50–60 dBm at a distance of 1 m and 70–80 dBm at a distance of 10 m. Please try building it with v3.2.4.

‘XIAO nRF54L15 / nRF52840: Coded PHY Extends Communication Range by 4x — at the Cost of Current Consumption’

Interesting project.

Using a XIAO MG-24, BLE Coded PHY, S-8, with external antenna (RX=Dipole, TX=FPC), and 19.5dB transmit power, my customer achieves a range of 120+m (LOS) and has an average RSSI of -85dbm at that distance.

Coded PHY (and 'MG24) is great for long distance BLE.

Good luck with your project :slight_smile:

Thanks for your help!

I’ve been experimenting with a simpler version of my project to narrow down the issues. I’m using two XIAO nRF54L15 boards with nRF Connect SDK v3.4.1.

For this test, I’m using extended advertising with Coded PHY S=8, sending 64 bytes of sensor-like data every 500 ms. The receiver scans for Coded PHY advertisements and logs the RSSI and PHY information.

The code is working, but I’m still experiencing very low RSSI values, even at short distances.

1. Internal antenna configuration

I’m using the onboard ceramic antenna on both boards. This is how I’ve configured the RF switch:

static const struct gpio_dt_spec antenna_sel =
    GPIO_DT_SPEC_GET(DT_NODELABEL(rfsw_ctl), enable_gpios);

static const struct device *const antenna_power =
    DEVICE_DT_GET(DT_NODELABEL(rfsw_pwr));

static int use_internal_antenna(void)
{
    if (!device_is_ready(antenna_power) ||
        !gpio_is_ready_dt(&antenna_sel)) {
        return -ENODEV;
    }

    int err = regulator_enable(antenna_power);
    if (err < 0 && err != -EALREADY) {
        return err;
    }

    err = gpio_pin_configure_dt(&antenna_sel, GPIO_OUTPUT_ACTIVE);
    if (err < 0) {
        return err;
    }

    return gpio_pin_set_dt(&antenna_sel, 1);
}

2. Coded PHY S=8 configuration

These are the relevant settings from my transmitter’s prj.conf:

CONFIG_BT=y
CONFIG_BT_BROADCASTER=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_EXT_ADV_CODING_SELECTION=y

CONFIG_BT_CTLR_ADV_EXT=y
CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=128

And this is how I configure advertising:

const struct bt_le_adv_param *params = BT_LE_ADV_PARAM(
    BT_LE_ADV_OPT_EXT_ADV |
    BT_LE_ADV_OPT_CODED |
    BT_LE_ADV_OPT_REQUIRE_S8_CODING,
    160, 160, NULL);

err = bt_le_ext_adv_create(params, NULL, &adv);

The advertising interval is 100 ms, and the payload is updated every 500 ms.

3. Receiver configuration

My receiver scans exclusively for Coded PHY advertisements:

const struct bt_le_scan_param *params = BT_LE_SCAN_PARAM(
    BT_LE_SCAN_TYPE_PASSIVE,
    BT_LE_SCAN_OPT_CODED | BT_LE_SCAN_OPT_NO_1M,
    48, 48);

err = bt_le_scan_start(params, NULL);

I’m logging the RSSI and PHY information using:

printk("CSV,RX,%u,%u,%d,%s,%s,%u,%u\n",
       seq, sender_ms, info->rssi,
       phy_name(info->primary_phy),
       phy_name(info->secondary_phy),
       gap, apparent_gaps);

4. Outdoor test results – 10 meters

I also performed an outdoor test today, with both boards approximately 10 meters apart, using their onboard antennas.

Here are some actual results from the serial monitor:

CSV,RX,356,178731,-95,Coded (onbekend S),Coded (onbekend S),0,0
CSV,RX,357,179233,-89,Coded (onbekend S),Coded (onbekend S),0,0
CSV,RX,358,179735,-97,Coded (onbekend S),Coded (onbekend S),0,0
...
CSV,RX,410,205840,-103,Coded (onbekend S),Coded (onbekend S),0,2
CSV,RX,411,206342,-93,Coded (onbekend S),Coded (onbekend S),0,2
...
CSV,RX,459,230440,-101,Coded (onbekend S),Coded (onbekend S),2,9
...
CSV,RX,573,287671,-101,Coded (onbekend S),Coded (onbekend S),7,57
...
CSV,RX,754,378539,-101,Coded (onbekend S),Coded (onbekend S),0,138

(I am from the Netherlands, ‘onbekend’ is Dutch for ‘unknown’)

For the approximately 200-second section of the test log:

  • Average RSSI: -98.3 dBm

  • Lowest RSSI: -104 dBm

  • Highest RSSI: -86 dBm

  • Expected measurement sequences: 399

  • Received unique measurement sequences: 261

  • Missing measurement sequences: 138 (34.6%)

Since this test uses connectionless advertising, these missing sequence numbers don’t necessarily represent the actual radio packet error rate.

The receiver also reports Coded (onbekend S), meaning it identifies LE Coded PHY but doesn’t distinguish between S=2 and S=8.

5. What I’m trying to figure out

Although the code runs successfully, an average RSSI of around -98 dBm at only 10 meters seems unusually low to me, especially considering the longer distances others have achieved with these boards.

My original project uses a GATT connection, but I switched to this simpler advertising-based test to eliminate connection-related issues while investigating the radio performance.

I’m mainly wondering:

  • Is my internal antenna and RF switch configuration correct?

  • Am I missing any important settings to achieve the maximum possible range?

  • Is there a reliable way to verify that the advertisements are actually using S=8 instead of S=2?

  • Could there be another reason for such low RSSI values at only 10 meters?

Thanks again!

Is my internal antenna and RF switch configuration correct?
Could there be another reason for such low RSSI values at only 10 meters?

You need to verify whether the code and hardware logic match. A simple way to do this is to try changing rfsw_ctl and rfsw_pwr and see if the RSSI changes.

Am I missing any important settings to achieve the maximum possible range?

The antennas must be aligned. Position the XIAO units upright so that the antennas have a clear line of sight to each other.

Is there a reliable way to verify that the advertisements are actually using S=8 instead of S=2?

I verified this using the current waveform.

If you could post the entire project rather than just a portion of the code, we’d be able to actually test it here.

Hi msfujino,

Thanks again for your help!

I’ve attached my latest code for both the sender and receiver. I’m using nRF Connect SDK v3.4.1 with BLE Extended Advertising.

I’ve also added a button to the sender to switch between Coded PHY S=2 and S=8, so I can compare the RSSI and performance of both modes. I also have a PicoScope that I plan to use to measure the current consumption waveform and see if I can distinguish between S=2 and S=8 based on the differences in transmission duration.

I’ve attached a photo of my current setup as well (see below). I placed both XIAO boards on small breadboards to keep them stable and make them easy to distinguish.

Is this the correct antenna orientation for testing? The boards are positioned opposite each other, with one rotated 180 degrees. Would you recommend positioning them differently to get the best possible signal?

Thanks for taking a look!

XIAO_BLE_Coded_PHY_Test.zip (7.7 KB)

Please position the antennas facing each other, as shown in the photo.

You need to verify whether the code and hardware logic match. A simple way to do this is to try changing rfsw_ctl and rfsw_pwr and see if the RSSI changes.

Please give it a try and let us know the results.

I’ll set up a v3.4.1 environment and run your code. It will take a little while.

I just finished some PicoScope measurements using the code I shared in post #8, switching between Coded PHY S=2 and S=8 using the button on the sender.

I measured the current consumption of the transmitting XIAO nRF54L15 using a 3.9 V laboratory power supply and a 10 Ω shunt resistor in series with the negative supply connection. The PicoScope was connected across the resistor to measure the voltage drop and calculate the current.

I recorded 64 waveforms for each mode and compared the results:

Measurement S=2 S=8
Average activity duration 4.45 ms 10.90 ms
Average current during activity 7.86 mA 8.65 mA
Average peak current 10.48 mA 10.67 mA

The results show that the current activity lasts approximately 2.45 times longer with S=8 compared to S=2.

I’ve attached below the waveforms for both modes and a photo of my measurement setup showing how everything was connected. (The distance is about 2 - 3 cm and the RSSI was constant -18).

Would this be considered these results a good indication that the coding scheme is actually switching between S=2 and S=8?

EDIT: This test was done before I knew the correct way to set up the antennas shared by @msfujino

I think S is probably set to 8.
Your code isn’t working properly yet, so I can’t receive anything. I’ll try again tomorrow.

EDIT:
What message does the serial monitor display when you do receive something?

Some terms in the serial monitor are in Dutch, so i will also paste the English translation…

*** Booting nRF Connect SDK v3.4.1-b20f8619ba9a ***
*** Using Zephyr OS v4.4.2-33fa6a7aac6a ***
CODED PHY RECEIVER: Coded PHY scanning (S=8 preferred transmitter)
ANTENNA: internal antenna selected
SCANNING started: Coded PHY, internal antenna
CSV fields: type,seq,sender_ms,rssi,prim_phy,sec_phy,gap,total_gaps
CSV,RX,21,10667,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,22,11172,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,23,11678,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,24,12184,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,25,12690,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,26,13196,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,27,13702,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,28,14208,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,29,14714,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,30,15220,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,31,15726,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,32,16232,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,33,16738,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,34,17244,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,35,17750,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,36,18256,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,37,18762,-18,Coded (S unknown),Coded (S unknown),0,0
CSV,RX,38,19268,-18,Coded (S unknown),Coded (S unknown),0,0

To build and flash this project you can use this command’s
1. Build the sender

Open a terminal in the nRF Connect SDK environment and navigate to the project folder.

west build --no-sysbuild -p always -b xiao_nrf54l15/nrf54l15/cpuapp -s sender -d sender/build

2. Flash the sender

Connect the sender board via USB and run:

west flash -d sender/build --runner openocd

3. Build the receiver

west build --no-sysbuild -p always -b xiao_nrf54l15/nrf54l15/cpuapp -s receiver -d receiver/build

4. Flash the receiver

Connect the receiver board via USB and run:

west flash -d receiver/build --runner openocd

Building can also be done in the Applications menu of the nRF Connect SKD environment…

Did the RSSI change when you changed
gpio_pin_set_dt(&antenna_sel, 1);
to
gpio_pin_set_dt(&antenna_sel, 0);
?

I tested this with v3.4.2.
At a distance of 1 meter, with the antennas facing each other, the RSSI is approximately 60 dBm.
At 5 m, through the wall into the next room, it is approximately 80 dBm.

EDIT:
Since there aren’t many 2.4 GHz electronic devices in use in my environment, there may be less interference. For example, why don’t you try measuring the RSSI outdoors?

Hi @msfujino,

Yes, changing gpio_pin_set_dt(&antenna_sel, 1) to gpio_pin_set_dt(&antenna_sel, 0) made a big difference!

I tested this outdoors with both XIAO nRF54L15 boards about 10 meters apart, using NCS v3.4.1.

Internal antenna (GPIO = 1):

  • Average RSSI: -77.4 dBm

  • RSSI range: -72 to -85 dBm

  • All 23 consecutive measurements received.

External antenna selected (GPIO = 0), without an antenna connected:

  • Only 2 measurements received, at -102 and -100 dBm.

  • After that, no more messages were received.

For this test, I only switched the receiver to external mode. The transmitter was still using its internal antenna.

So it looks like the RF switch is working correctly!

Also, thanks for the advice about keeping the boards upright and aligning the antennas with a clear line of sight. And thanks for explaining how you verified S=8 using the current waveform. That’s really helpful for my next tests!

Really appreciate your help!

I’m glad I could be of help.