Introducing an updated Sample set for Xiao nRF54L15 / and NRF CONNECT

I’m running some tests on my machine right now for sdk 3.2.1,
I checked my versions of the samples, I made a bunch of changes to get them to work, here’s an ai analysis of what I had to do:

Changes from Stock SDK (v3.2.1) Summary

Both Samples - Common Changes

1. DK Library replaced with direct GPIO control

Stock uses #include <dk_buttons_and_leds.h> and DK_LED1. Your versions replace this with direct GPIO via <zephyr/drivers/gpio.h>, using GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios) and custom dk_leds_init(), dk_set_led_on(), dk_set_led_off() wrapper functions. This is because the Xiao doesn’t have the DK library’s multi-LED hardware.

2. RF switch configuration added (before bt_enable)

Both samples add manual GPIO2 pin configuration for the Xiao’s RF antenna switch:

gpio_pin_configure(gpio2, 3, GPIO_OUTPUT_ACTIVE);   /* rfsw-pwr = HIGH */
gpio_pin_configure(gpio2, 5, GPIO_OUTPUT_INACTIVE); /* rfsw-ctl = LOW */

This is completely new code not in the stock samples.

3. prj.conf differences

Stock uses:

CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_DK_LIBRARY=y

Your version replaces these with:

CONFIG_GPIO=y
CONFIG_REBOOT=y
CONFIG_BT_LL_SW_SPLIT=n    # Force SoftDevice Controller
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_LOG_DEFAULT_LEVEL=3

Stock also has extra RAM-reduction configs your version drops:

CONFIG_BT_RAS_MODE_3_SUPPORTED=n
CONFIG_BT_CTLR_SDC_CS_MAX_ANTENNA_PATHS=1
CONFIG_BT_CTLR_SDC_CS_NUM_ANTENNAS=1
CONFIG_BT_CTLR_SDC_CS_STEP_MODE3=n

4. Overlays and Kconfig.sysbuild - Identical between stock and yours (same antenna switch DTS overlay, same sysbuild config).

5. CMakeLists.txt - Identical except stock initiator has project(channel_sound_ras_initiator) vs yours has project(NONE).

Initiator-Only Changes

6. Distance calibration and weighted averaging - This is the biggest functional change. Stock just prints raw distance estimates:

LOG_INF("ifft: %.2f, phase_slope: %.2f, rtt: %.2f meters", ...);

Your version adds ~100 lines of calibration logic:

  • Calibration constants (PHASE_SLOPE_SLOPE, RTT_SLOPE, IFFT_SLOPE, offsets)

  • Weighted averaging (Phase 50%, RTT 25%, IFFT 25%)

  • get_distance() now applies calibration: Actual = (Raw - Offset) / Slope

  • Output shows calibrated values + weighted best estimate

1 Like


This is what I get when I run my modified versions of the samples against sdk 3.2.1.
those are valid distances.

1 Like

Ok, let me fully digest what you have here. Just a quick (odd) update/detour on my side. When I moved back to the reflector to just see what it was doing/saying it was acting dead. TLDR: I oddly couln’t talk to it until I tried flipping it over (instantly worked) on the usb c cable to the mac. First time for that for me.

Anyway, I have them both now flashed, talking and on the mac and now I get an interesting security pairing error which is actually a good thing. They are trying to talk now. I’ll see if your info helps me resolve that, thanks!!!

I just pushed a new commit with updates for the modified channel sounding samples for sdk 3.2.1.

do you recommend that I go back to 3.2.1? I’m on 3.2.2

I’m just too lazy to install 3.2.2 it’ll probably work fine!

1 Like

Ok, I just tried your latest commit. The good news, both reflector and initiator built cleanly with zero effort, just flashed and started. Also the initiator boots and waits similar to my connection waiting before with the vanilla nordic code.

The bad news, I get an error on the reflector (with or without the initiator powered up). It’s a one and done error due to halting which is nice (unlike the earlier infinite loops).

Not sure why some chars seem off a bit? But I assume it’s 115200 since it looks generally very clear.

Are you running the sense or non sense variant of the board? Hardware wise

I’m running the sense version of the board

Ok, same hardware setup for me. So nothing to do with that!

Ah, so I got it to work after removing those two gpio mentioned in the device tree overlay for rf switch control. ??

Let me play around with it, but already I saw some cool distance measuring!! (see below)

Thanks soooo much for all your help Toastee0!!!

Can you try again please?

If I put back the original overlay file, it builds and when I flash I get the instant bus fault

jeltoftMBP:VScode jeltoft$ monr
--- Terminal on /dev/cu.usbmodem72CC059D3 | 115200 8-N-1
--- Available filters and text transformations: debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
*** Booting nRF Connect SDK v3.2.2-74845e169be2 ***
*** Using Zephyr OS v4.2.99-fe4f0106803e ***
[00:00:00.022,829] ␛[0m<inf> app_main: Starting Channel Sounding Reflector Sample␛[0m
[00:00:00.030,382] ␛[0m<inf> app_main: RF switch: pwr=HIGH, ctl=LOW␛[0m
[00:00:00.036,773] ␛[0m<inf> bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                            90 3d 6a f1 a5 ad 64 1d  cd 27 3e bf fc 68 0f 40 |.=j...d. .'>..h.@
                                            40 99 ca ac                                      |@...             ␛[0m
[00:00:00.064,759] ␛[1;31m<err> os: ***** BUS FAULT *****␛[0m
[00:00:00.070,174] ␛[1;31m<err> os:   Precise data bus error␛[0m
[00:00:00.075,918] ␛[1;31m<err> os:   BFAR Address: 0x2578302a␛[0m
[00:00:00.081,842] ␛[1;31m<err> os: r0/a1:  0x20008760  r1/a2:  0x00000001  r2/a3:  0xba2e8ba3␛[0m
[00:00:00.090,541] ␛[1;31m<err> os: r3/a4:  0x00000007 r12/ip:  0x00000000 r14/lr:  0x000204d1␛[0m
[00:00:00.099,236] ␛[1;31m<err> os:  xpsr:  0x01000000␛[0m
[00:00:00.104,460] ␛[1;31m<err> os: Faulting instruction address (r15/pc): 0x00020564␛[0m
[00:00:00.112,381] ␛[1;31m<err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0␛[0m
[00:00:00.120,299] ␛[1;31m<err> os: Current thread: 0x20004858 (MPSL Work)␛[0m
[00:00:00.127,258] ␛[1;31m<err> os: Halting system␛[0m

I don’t think your actually need to specify the RF switch and antenna pins in the overlay. Should be safe to remove that section unless you want to use the external antenna port.

Sure, sg!

I was only doing that because of what I think was a question to confirm if that was my actual issue in the comment just before that. Or maybe I read that incorrectly?

@Loren_Bufanu,

I ran ./install_linux.sh, but I still can’t compile Blink.
In my environment, “fujino/.arduino15” and “fujino/ncs/v3.2.1” are installed. Could this be causing the problem?

I think it would be less confusing to start a new thread for discussion. Could you please start a new thread?

@Loren_Bufanu ,

In the end, installing pyocd solved the problem.

Now I can try out tyour nRF54L15 Arduino core.

@Toastee0 quick question. Do you know if RTT has ever been validated with these two examples for initiator and reflector?

In my testing, I’ve noticed that RTT is basically always 0.00m. Sometimes it’s a few centimeters but I think that’s just noise? The IFFT and PBR seem pretty good, and I’ve also added RSSI just to see what it looked like.

Round trip time(RTT) usually RTT works ok, but often returns 0, which is why I ignore it when it hands 0’s out. the updated sample i made had a feature that should ignore rtt when it’s 0 and provide a weighted estimate off the other data

the two methods are explained here:

https://community.element14.com/challenges-projects/element14-presents/project-videos/w/documents/71994/how-accurate-is-bluetooth-channel-sounding-a-deep-dive-with-the-nrf54l15----episode-691

more info here:

and here:

hi, working through the sample set and i think the board cpu become wonky after i try to flash.

here are the error

Error: Failed to read memory at 0xe000ed00
Warn : target nrf54l.cpu examination failed
Info : starting gdb server for nrf54l.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : gdb port disabled
TargetName Type Endian TapName State


0* nrf54l.cpu cortex_m little nrf54l.cpu unknown
1 nrf54l.aux mem_ap little nrf54l.cpu running

Info : SWD DPIDR 0x6ba02477
Error: Failed to read memory at 0xe000ed00
Info : SWD DPIDR 0x6ba02477
Info : SWD DPIDR 0x6ba02477
Info : [nrf54l.cpu] AP write error, reset will not halt
Info : SWD DPIDR 0x6ba02477
Error: [nrf54l.cpu] DP initialisation failed

anyone gotten this before?