DWM3001CDK Zephyr with SDK Drivers

Good morning everyone,
Quick introduction and background - I primarily work in SQL databases and dabble in C# so embedded systems is completely outside my forte; however, I’m intrigued to learn how to setup an UWB transceiver as I have been developing a digital twin software for a couple of years as a hobby and I want to do near-real time tracking within it. I’m heavily leveraging AI to speed up my workflow trying to get up to speed on the DWM3001CDK. I purchased two of them roughly a month ago. In that time I’ve successfully gotten the RTT, Shell, LEDs, and Accelerometer functioning. For one brief moment I actually succeeded in getting a Device ID read off my DW3000 before it went into sleep mode I think because my CoPilot chat history tells me I did but I must’ve missed it when fumbling through all the code tweaks. That was two weeks ago and I’ve been getting nothing but 0x0000000 since then. For all the great speed enhancements AI has given me, one catch is that once it exhausts everything it knows it starts to get into rabbit holes. It was convinced my pin mapping was incorrect. I’ll share below what I have as I’m pretty sure I’m reading the schematic properly. I’ve been following the SDK guide and having the AI tools help me develop API calls to the DW3000 to initialize, etc.

If anyone has successfully gotten their Device ID read on DWM3001CDK_C2 using Zephyr + SDK Drivers I’d appreciate any advice or assistance. Let me know if you need to see my repo or any specific part of my project.

Current pinout:

&spi3 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	pinctrl-0 = <&spi3_default>;
	pinctrl-1 = <&spi3_sleep>;
	pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
	dw3000: dw3000@0 {
        label = "DW3000";
		compatible = "qorvo,dw3000";
		spi-max-frequency = <32000000>;
		status = "okay";
		reg = <0>;
		reset-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
		irq-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
	};
	
};

spi3_default: spi3_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK,  0, 3)>,   /* SCK  */
					<NRF_PSEL(SPIM_MOSI, 0, 8)>,    /* MOSI */
					<NRF_PSEL(SPIM_MISO, 0, 29)>;   /* MISO */
		};
	};

	spi3_sleep: spi3_sleep {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK,  0, 3)>,
					<NRF_PSEL(SPIM_MOSI, 0, 8)>,
					<NRF_PSEL(SPIM_MISO, 0, 29)>;
			low-power-enable;
		};
	};

Slowly making more progress after another two days reading through docs and driver pointers. My Temperature check was failing and getting stuck in an infinite loop so had to disable it in both initialise and configure API calls. Appears my configure failed and CoPilot is questioning my pins or the logic I’m using for wake up.

/* --------------------------------------------------------------------------
 * Wakeup callback (driver will call this during dwt_initialise)
 * -------------------------------------------------------------------------- */
static void dw3000_wakeup_ic_zephyr(void)
{
    gpio_pin_configure_dt(&cs_gpio, GPIO_OUTPUT);

    gpio_pin_set_dt(&cs_gpio, 0);
    k_sleep(K_USEC(700));

    gpio_pin_set_dt(&cs_gpio, 1);
    k_sleep(K_MSEC(2));

    gpio_pin_configure_dt(&cs_gpio, GPIO_INPUT);
}

Current RTT output.

00> *** Booting nRF Connect SDK v3.2.1-d8887f6f32df ***
00> *** Using Zephyr OS v4.2.99-ec78104f1569 ***
00> motion: motion_pipeline_init()
00> [00:00:00.261,047] <dbg> os: setup_thread_stack: stack 0x200033c0 for thread 0x200018e0: obj_size=1088 buf_start=0x20003400  buf_size 1024 stack_ptr=0x20003800
00> [00:00:00.262,023] <dbg> os: setup_thread_stack: stack 0x20003800 for thread 0x20001a70: obj_size=1088 buf_start=0x20003840  buf_size 1024 stack_ptr=0x20003c40
00> [00:00:00.262,908] <dbg> os: k_sched_unlock: scheduler unlocked (0x20002500:0)
00> === DW3000 bring-up start ===
00> Calling dw3000_platform_init(&plat) ...
00> dw3000_platform_init: plat=0x20001800
00> dw3000_platform_init: dwt_update_dw old=0 new=0x20001800
00> [00:00:00.264,160] <dbg> os: z_tick_sleep: thread 0x20002500 for 23 ticks
00> motion: DEVICE_DT_GET(lis2dh12) -> 0x19e08
00> motion: Using accelerometer device: lis2dh12@19
00> Thread analyze:
00> [00:00:00.265,411] <dbg> os: z_tick_sleep: thread 0x20002500 for 66 ticks
00> [00:00:00.265,960] <dbg> os: z_tick_sleep: thread 0x200018e0 for 32768 ticks
00>  thread_analyzer     : STACK: unused 416 usage 608 / 1024 (59 %); CPU: 1 %
00>                      : Total CPU cycles used: 8
00>  0x200018e0          : STACK: unused 304 usage 720 / 1024 (70 %); CPU: 6 %
00>                      : Total CPU cycles used: 33
00> DEVID BEFORE WAKE = 0x00000000
00> RAW DEVID READ = 0x00000000
00> dw3000_platform_init: calling dwt_probe()...
00> [00:00:00.268,829] <dbg> os: z_tick_sleep: thread 0x20002500 for 23 ticks
00>  0x20001b40          : STACK: unused 836 usage 188 / 1024 (18 %); CPU: 0 %
00>                      : Total CPU cycles used: 0
00> [00:00:00.270,050] <dbg> os: z_tick_sleep: thread 0x20002500 for 66 ticks
00>  idle                : STACK: unused 256 usage 64 / 320 (20 %); CPU: 31 %
00>                      : Total CPU cycles used: 188
00> dw3000_platform_init: dwt_probe rc=-1
00> dw3000_platform_init: PROBE FAILED
00> dw3000_platform_init rc=-1, plat.dw=0x20001800
00> Calling dwt_initialise(DWT_READ_OTP_ALL)...
00> dwt_initialise: dw=0x20001800 driver=0x1a71c
00> dwt_initialise: dwt_ops=0x1a77c init=0x4c85
00> dwt_initialise: calling initialize()...
00> ULL: ENTER dw=0x20001800 mode=0
00> ULL: dwt_localstruct_init
00> ULL: Reading LDO_TUNE_LO
00> OTP READ @0x0004 = 0x00000000
00> ULL: Reading LDO_TUNE_HI
00> OTP READ @0x0005 = 0x00000000
00> ULL: Reading BIAS_TUNE
00> OTP READ @0x000a = 0x00000000
00> ULL: otp_ldo_tune_lo=0x00000000
00> ULL: Computing otp_vdddig
00> ULL: otp_vdddig=0x00
00> ULL: Reading AON_VDD_DIG
00> ULL: Checking LDO/Bias tune conditions
00> ULL: Calling ull_set_vdddig_mv
00> ULL: Reading DGC_TUNE
00> OTP READ @0x0020 = 0x00000000
00> ULL: DGC from SW
00> ULL: Checking PLID read
00> ULL: Reading PARTID
00> OTP READ @0x0006 = 0x00000000
00> ULL: Reading LOTID
00> OTP READ @0x000d = 0x00000000
00> OTP READ @0x000e = 0x00000000
00> ULL: Checking VBAT read
00> ULL: Reading VBAT
00> OTP READ @0x0008 = 0x00000000
00> ULL: Checking TEMP read
00> ULL: Reading TEMP
00> OTP READ @0x0009 = 0x00000000
00> ULL: TEMP default
00> ULL: VBAT default
00> ULL: Reading OTPREV
00> OTP READ @0x001f = 0x00000000
00> ULL: Reading XTRIM
00> OTP READ @0x001e = 0x00000000
00> ULL: XTRIM default
00> ULL: Writing XTAL trim
00> ULL: Reading PLL_CC
00> OTP READ @0x0035 = 0x00000000
00> ULL: PLL coarse code default
00> ULL: Skipping temperature init. Fix later GregC
00> ULL: Writing TX_CTRL_LO
00> ULL: Reading SYS_CFG
00> ULL: EXIT SUCCESS
00> dwt_initialise: initialize() returned 0
00> dwt_initialise() returned 0
00> Calling dwt_configure(&cfg)...
00> ULL: setdwstate ENTER req=1 hw=0x00
00> ULL: setdwstate → IDLE (PLL lock required)
00> ULL: setdwstate waiting for PLL lock...
00> ULL: setdwstate PLL lock result=-2
00> ULL: setdwstate EXIT ret=-2
00> ULL: setdwstate ENTER req=2 hw=0x00
00> ULL: setdwstate → IDLE_RC
00> ULL: setdwstate EXIT ret=0
00> ULL: setdwstate ENTER req=1 hw=0x00
00> ULL: setdwstate → IDLE (PLL lock required)
00> ULL: setdwstate waiting for PLL lock...
00> ULL: setdwstate PLL lock result=-2
00> ULL: setdwstate EXIT ret=-2
00> ULL: setdwstate ENTER req=2 hw=0x00
00> ULL: setdwstate → IDLE_RC
00> ULL: setdwstate EXIT ret=0
00> ULL: setdwstate ENTER req=2 hw=0x00
00> ULL: setdwstate → IDLE_RC
00> ULL: setdwstate EXIT ret=0
00>  main                : STACK: unused 15544 usage 840 / 16384 (5 %); CPU: 69 %
00>                      : Total CPU cycles used: 1292
00>  ISR0                : STACK: unused 1624 usage 424 / 2048 (20 %)
00> [0dwt_configure() returned -2
00> DW3000 config failed

@Wassim_Qorvo,
I saw a comment from you on this post (Getting started with DWM3001CDKE - #8 by Wassim_Qorvo) stating that GPIO 1, 19 is the wakeup pin for DW3000. Does DWM3001CDK_C2 actually have an accessible wakeup pin? When I try to access 1, 19 I get the following on RTT.

00> ASSERTION FAIL [(cfg->port_pin_mask & (gpio_port_pins_t)(1UL << (pin))) != 0U] @ WEST_TOPDIR/zephyr/include/zephyr/drivers/gpio.h:1041
00>   Unsupported pin
00> [00:00:00.265,197] <err> os: r0/a1:  0x00000004  r1/a2:  0x00000411  r2/a3:  0x00000000
00> [00:00:00.265,655] <err> os: r3/a4:  0x00000004 r12/ip:  0x000000fc r14/lr:  0x00002aa3
00> [00:00:00.266,113] <err> os:  xpsr:  0x01000000
00> [00:00:00.266,448] <err> os: Faulting instruction address (r15/pc): 0x00017500
00> [00:00:00.266,906] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
00> [00:00:00.267,303] <err> os: Current thread: 0x20002500 (main)
00> [00:00:00.267,700] <err> os: Halting system

The CS assert when I try to force the pins and read back their values appears to not show pin movement so it’s almost like my DW3000 won’t allow me to drive GPIO to wake it.