DWM3001CDK porting to Zepyhr

Hello,

I can find the old DWM1001-DEV in the offcial Zephyr Documantion: Decawave DWM1001 — Zephyr Project Documentation

We have the new DWM3001cdk now and I am trying to port this board to Zephyr. Unfortunately the Documentation is not that detailed then the old one form the DWM1001-DEV so I can’t port this one to one with the new PINs.

So my questions are the following:

  1. Am I right that the I can’t use the DWM3001EVB (GitHub - foldedtoad/dwm3000: Port of Qorvo/Decawave's DWM3000 Module on the DWS3000 Arduino Shield or GitHub - br101/zephyr-dw3000-decadriver: Zephyr Driver for Qorvo/Decawave DW3000)?

  2. Do someone know where can I find the PIN Numbers for the SPI from DW3000 to the nRF52833? Or do I not need that PINs?

Thank you for your help in advance.

Hi @Schven04
please check it here DWM3001CDK Quick Start Guide - page 7

Cheers
JK

Thank you for your answere. I already checked this one and got a lot of Information from that Schematic.

But I only found SPI 1 connection PINs there not the SPI 2 that might be that one for the communication between nrf52 and DW3110. For example in the DWM1000C Data Sheet, there is Table 4, which explains the internal nRF52382 pins and their function. Unfortunately I can’t find this in the documantaion from DWM3001C.

Hi @Schven04
have you seen this:
DWM3001C-100 Schematic

Cheers
JK

1 Like

Thank you that was what I am looking for.

Cheers
Sven

Hi, you can use the driver at GitHub - br101/zephyr-dw3000-decadriver: Zephyr Driver for Qorvo/Decawave DW3000, you’d just have to give the right pins in the .dts file

1 Like

Thanks for that.

Unfortunately I always get an Error when I try tu build this.

This is my dts SPI Config:

&spi2 {
compatible = “nordic,nrf-spi”;
status = “okay”;
cs-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = “default”, “sleep”;
test: dw3110@0 {
compatible = “qorvo,dw3110”;
label = “DW3110”;
spi-max-frequency = <8000000>;
irq-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; /* P1.02 /
reset-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; /
P0.25 */
status = “okay”;
reg = <0>;
};

};

Did you had this error as well or did you see the problem what I can’t find?

D:/svenh/Documents/Programmieren/Zepyhr/sit_dwm3001/sit/drivers/dw3110/platform/deca_spi.c: In function ‘dw3000_spi_init’:
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\drivers\dw3110\platform\deca_spi.c:41:20: warning: Macro is deprecated
41 | spi = device_get_binding(DT_LABEL(DW_SPI));
| ^~~~~~~~~~~~~~~~~~~~~
In file included from D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\device.h:38,
from D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\drivers\dw3110\platform\deca_spi.c:7:
d:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\samples\decawave_examples\ex_00a_reading_dev_id\build\zephyr\include\generated\devicetree_generated.h:12506:53: error: ‘DT_N_S_soc_S_spi_40023000_P_label’ undeclared (first use in this function); did you mean ‘DT_N_S_soc_S_spi_40023000_P_reg’?
12506 | #define DT_N_S_soc_S_spi_40023000_S_dw3110_0_PARENT DT_N_S_soc_S_spi_40023000
| ^~~~~~~~~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\devicetree.h:3892:29: note: in definition of macro ‘DT_CAT3’
3892 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
| ^~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\devicetree.h:773:27: note: in expansion of macro ‘DT_PROP’
773 | #define DT_LABEL(node_id) DT_PROP(node_id, label) __DEPRECATED_MACRO
| ^~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\drivers\dw3110\platform\deca_spi.c:41:34: note: in expansion of macro ‘DT_LABEL’
41 | spi = device_get_binding(DT_LABEL(DW_SPI));
| ^~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\util_internal.h:105:36: note: in expansion of macro ‘DT_N_S_soc_S_spi_40023000_S_dw3110_0_PARENT’
105 | #define UTIL_PRIMITIVE_CAT(a, …) a##VA_ARGS
| ^
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\util_internal.h:104:26: note: in expansion of macro ‘UTIL_PRIMITIVE_CAT’
104 | #define UTIL_CAT(a, …) UTIL_PRIMITIVE_CAT(a, VA_ARGS)
| ^~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\devicetree.h:351:28: note: in expansion of macro ‘UTIL_CAT’
351 | #define DT_PARENT(node_id) UTIL_CAT(node_id, _PARENT)
| ^~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\drivers\dw3110\platform\deca_spi.c:21:17: note: in expansion of macro ‘DT_PARENT’
21 | #define DW_SPI DT_PARENT(DT_INST(0, qorvo_dw3110))
| ^~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\util_internal.h:105:36: note: in expansion of macro ‘DT_N_INST_0_qorvo_dw3110’
105 | #define UTIL_PRIMITIVE_CAT(a, …) a##VA_ARGS
| ^
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\util_internal.h:104:26: note: in expansion of macro ‘UTIL_PRIMITIVE_CAT’
104 | #define UTIL_CAT(a, …) UTIL_PRIMITIVE_CAT(a, VA_ARGS)
| ^~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\devicetree.h:326:31: note: in expansion of macro ‘UTIL_CAT’
326 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
| ^~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\drivers\dw3110\platform\deca_spi.c:21:27: note: in expansion of macro ‘DT_INST’
21 | #define DW_SPI DT_PARENT(DT_INST(0, qorvo_dw3110))
| ^~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\drivers\dw3110\platform\deca_spi.c:41:43: note: in expansion of macro ‘DW_SPI’
41 | spi = device_get_binding(DT_LABEL(DW_SPI));
| ^~~~~~
d:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\samples\decawave_examples\ex_00a_reading_dev_id\build\zephyr\include\generated\devicetree_generated.h:12506:53: note: each undeclared identifier is reported only once for each function it appears in
12506 | #define DT_N_S_soc_S_spi_40023000_S_dw3110_0_PARENT DT_N_S_soc_S_spi_40023000
| ^~~~~~~~~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\devicetree.h:3892:29: note: in definition of macro ‘DT_CAT3’


D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\util_loops.h:23:81: note: in expansion of macro ‘Z_FOR_LOOP_2’
23 | _57, _58, _59, _60, _61, _62, _63, _64, N, …) N
| ^
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\util_loops.h:1072:9: note: in expansion of macro ‘Z_FOR_EACH_ENGINE’
1072 | Z_FOR_EACH_ENGINE(Z_FOR_EACH_IDX_EXEC, sep, F, _, VA_ARGS)
| ^~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\util_macro.h:515:9: note: in expansion of macro ‘Z_FOR_EACH_IDX’
515 | Z_FOR_EACH_IDX(F, sep, REVERSE_ARGS(VA_ARGS))
| ^~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\cbprintf_internal.h:449:9: note: in expansion of macro ‘FOR_EACH_IDX’
449 | FOR_EACH_IDX(Z_CBPRINTF_PACK_ARG, (;), VA_ARGS);
| ^~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\cbprintf_internal.h:486:9: note: in expansion of macro ‘Z_CBPRINTF_STATIC_PACKAGE_GENERIC’
486 | Z_CBPRINTF_STATIC_PACKAGE_GENERIC(packaged, inlen, outlen,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\sys\cbprintf.h:358:9: note: in expansion of macro ‘Z_CBPRINTF_STATIC_PACKAGE’
358 | Z_CBPRINTF_STATIC_PACKAGE(packaged, inlen, outlen,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\logging\log_msg.h:229:17: note: in expansion of macro ‘CBPRINTF_STATIC_PACKAGE’
229 | CBPRINTF_STATIC_PACKAGE(_msg->data, _plen,
| ^~~~~~~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\logging\log_msg.h:416:17: note: in expansion of macro ‘Z_LOG_MSG2_STACK_CREATE’
416 | Z_LOG_MSG2_STACK_CREATE(_cstr_cnt, _domain_id, _source, _level, _data,
| ^~~~~~~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\logging\log_msg.h:449:9: note: in expansion of macro ‘Z_LOG_MSG2_CREATE3’
449 | Z_LOG_MSG2_CREATE3(_try_0cpy, _mode, _cstr_cnt, _domain_id, _source,
| ^~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\logging\log_msg.h:460:9: note: in expansion of macro ‘Z_LOG_MSG2_CREATE2’
460 | Z_LOG_MSG2_CREATE2(_try_0cpy, mode, UTIL_CAT(Z_LOG_FUNC_PREFIX, _level),
| ^~~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\logging\log_core.h:240:9: note: in expansion of macro ‘Z_LOG_MSG2_CREATE’
240 | Z_LOG_MSG2_CREATE(UTIL_NOT(IS_ENABLED(CONFIG_USERSPACE)), _mode,
| ^~~~~~~~~~~~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\logging\log_core.h:253:9: note: in expansion of macro ‘Z_LOG2’
253 | Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, VA_ARGS)
| ^~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\logging\log.h:61:24: note: in expansion of macro ‘Z_LOG’
61 | #define LOG_INF(…) Z_LOG(LOG_LEVEL_INF, VA_ARGS)
| ^~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\drivers\dw3110\platform\deca_spi.c:46:17: note: in expansion of macro ‘LOG_INF’
46 | LOG_INF(“DW3000 on %s”, DT_LABEL(DW_SPI));
| ^~~~~~~
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\sit\drivers\dw3110\platform\deca_spi.c:46:27: warning: Macro is deprecated
46 | LOG_INF(“DW3000 on %s”, DT_LABEL(DW_SPI));
| ^~~~~~~~~~~~~~~~~~~~~
[87/128] Building C object zephyr/drivers/pinctrl/CMakeFiles/drivers__pinctrl.dir/pinctrl_nrf.c.obj
[88/128] Building C object modules/sit/drivers/dw3110/platform/CMakeFiles/…__sit__drivers__dw3110__platform.dir/port.c.obj
[89/128] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/9ba18aea840a404f6472a56e9295c06e/nrfx/helpers/nrfx_flag32_allocator.c.obj
[90/128] Linking C static library zephyr\drivers\timer\libdrivers__timer.a
[91/128] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/nrfx_glue.c.obj
ninja: build stopped: subcommand failed.

I Think the Error have to be at the begining or at the end. The rest should be the result of that. But I can’t understand whats really wrong.

Use compatible = “decawave,dw3000”;

I did and got the same Error

Here is a working example:

&spi0 {
status = “okay”;
compatible = “nordic,nrf-spim”;
sck-pin = <28>;
mosi-pin = <31>;
miso-pin = <3>;
cs-gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;

dw3000@0 {
	compatible = "decawave,dw3000";
	label = "DW3000";
	spi-max-frequency = <1000000>;
	reg = <0>;
	reset-gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
	irq-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
};

};

Also please use the ‘bin’ branch of my repository. I’ll merge that to master now though

Okay I have changed everything to your new build options.

Now I’ve got this error with your config:
In file included from D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\toolchain.h:50,
from D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\devicetree\zephyr.h:15,
from D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\devicetree.h:3931,
from D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\device.h:38,
from D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\drivers\spi.h:24,
from D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\drivers\spi\spi_nrfx_spim.c:7:
D:\svenh\Documents\Programmieren\Zepyhr\sit_dwm3001\zephyr\include\zephyr\toolchain\gcc.h:77:36: error: static assertion failed: “/soc/spi@40003000 defined without required pin configuration”
77 | #define BUILD_ASSERT(EXPR, MSG…) _Static_assert(EXPR, “” MSG)

Also this warning:
‘sck-pin’ is marked as deprecated in ‘properties:’
‘mosi-pin’ is marked as deprecated in ‘properties:’
‘miso-pin’ is marked as deprecated in ‘properties:’

Seems you use an newer version of Zephyr. I last tested with NCS 2.0.0

Thanks for the hint, I downgreaded the Version di Zephyr 3.0.0 and NCS 2.0.0 and now it build correctly.

But anyway know I got a Runtime Error:
[00:00:00.285,675] os: ***** BUS FAULT *****
[00:00:00.285,675] os: Precise data bus error
[00:00:00.285,705] os: BFAR Address: 0x1bfcf23
[00:00:00.285,705] os: r0/a1: 0x00000000 r1/a2: 0x00000005 r2/a3: 0x01bfcef7
[00:00:00.285,736] os: r3/a4: 0x200014dc r12/ip: 0x00000a24 r14/lr: 0x0000ed2b
[00:00:00.285,736] os: xpsr: 0x61000000
[00:00:00.285,736] os: Faulting instruction address (r15/pc): 0x0000439a
[00:00:00.285,766] os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:00.285,797] os: Current thread: 0x200006f8 (unknown)
[00:00:01.737,976] os: Halting system

That comes when I call the dwt.softreset() method in Port.c. Am I am right thats comes because of false PIN declaration?
But I took the PINs from the Schematic in this Post where the connection between DW3000 and nrf is via SPI3 and the following PINs:
&spi3 {
compatible = “nordic,nrf-spim”;
status = “okay”;
sck-pin = <3>;
mosi-pin = <8>;
miso-pin = <29>;
cs-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
dw3000@0 {
compatible = “decawave,dw3000”;
label = “DW3000”;
spi-max-frequency = <1000000>;
reg = <0>;
reset-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
irq-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
};

};

Hi, that doesn’t look related to the pin configuration.

Maybe you should try to use GitHub - br101/zephyr-dw3000-examples: DW3000 Examples and add your modifications from there?

1 Like

Thanks you very much for your help.

I’ve got an an LOG Message form that example. There are a Error Message: No HW reset configured but the DEV ID is OK. So the first example seems to be work.

Do you have your port available on GitHub? I’m also looking to port the same.

Hi

you can have a look here. I might not be a perfect example to working with Zepyhr but the Ports in dts and dtsi File seems to be working correct.

https://github.com/svhoy/uwb_zephyr_dwm3001cdk

Please remember thats this example just works unter Zepyhr 3.0.0 and not the newst version. I have to Port this when I have time for that in future.