Zephyr driver, C++ high level API, nRF mesh and Two Way Ranging GPIO Profiling

Hi,
I would like to share this work in progress with those interested in an open source framework that helps experimenting with different UWB algorithms.
The content is in this repo GitHub - nRFMesh/sdk-uwb-zephyr: Zephyr sdk for uwb module DWM1001C based on nRF52832 and DW1000 Transceiver which is a takeover from GitHub - foldedtoad/dwm1001: Decawave DWM1001-Dev board.

The additions include

  • Using west with a connected zephyr version dependency and a deca driver integration that can be enabled with the flag CONFIG_DW1000=y
  • using the already available board in Zephyr decawave_dwm1001_dev instead of the locally declared board nrf52_dwm1001
  • adding custom mesh network functionality. The issue is that testing UWB shall preferrably have another independent communication and configuration channel and normal Bluetooth cannot cover a bit network so a mesh is needed. nRF52832 do not support openthread and I considered Bluetooth Mesh as a big overhead compared to the simplemesh solution GitHub - HomeSmartMesh/sdk-hsm-sensortag: SensorTag SDK for Zephyr by hsm as Home Smart Mesh (warning simplemesh is simple but incomplete not recommended for other than experimenting)
  • adding a higher level API to greatly simplify TWR applications and others by eliminating redundant blocks in the code and fitting the whole ranging sequence on a single screen function, the new API MP as meshpositioning includes mp_receive() that is overloaded with the structure type intended to be received, mp_request() when sending a struct and expecting a response . Also for when initiating a delayed transmission either expecting a response mp_request_at() or not mp_send_at()
  • support for c++17 and standard library e.g. string, list, map. Now before the C / C++ skepticism takes over, please consider that c++ shall not be used in a real time system without knowing how c++ works. e.g. bad c++ is adding constructor without knowing when where are resources allocated. good c++ is using typed enums, any compile time typing verifications and dead simple iteration loops.
  • using json GitHub - nlohmann/json: JSON for Modern C++ for remote procedure call e.g. an uwb listener has an MQTT interface where an app throws a json config sent over simplemesh to use with dwt_configure()
  • verbose target log for status register thanks to a simple map flag to string

As example the whole responder RF transaction sequence is here

The goal for the future is to allow a central python server to remotely fully configure the dwt and role of each node through mesh and json config, let them do the job in a busy loop without any interference, and then collect the results.

Below a PIO debug setup that can also help for understanding and optimizing the code.

If anyone has questions or is interested in participating please let me know. I provide support for those who do not manage to get this framework to run details in this link

Hi everyone
did you know any references or codes that tried to impelment triangulation on dwm1001c mounted on its dev board ?
because I am trying to adapt the code provided by decawave to support more than one RX/TX but I got nothing

If the dwm1001c is mounted on its dev board or not should not make any different, the dev board only adds debug and flashing facility.

By the code provided by Decawave I assume you mean the code provided for two way ranging like ex_05a_ds_twr_init and ex_05b_ds_twr_resp ? Otherwise you can mention the sample name or repo reference.

These basic demonstration examples are written for two boards only because they have hardcoded tx and rx messages as you can see here tx_poll_msg

If you flash these samples on more than two boards the following will happen :

  • two initiators, one responder => it will work but when you get a measure on the responder you do not know from whom is the distance measure
  • one initiator, two responders => a response collision will happen that prevent the system from working, you’d get errors

To create what you’re looking for (distance measure between multiple nodes) you need to customize the exchanged messages so that each sender and receiver knows if the message is addressed to him or not and decide to respond or not. Which boils down to defining your own protocol that will sequence the two way ranging process.

Thank you for your answer.
do u know any references that could help ?

All references I know that are open source are at ranging level only, not positionning. I’m searching for one still. Localino exist but is not free. That’s why I started creating one. Each company creates its own in order to fulfill very specific requirements. My requirements are to be open source and easy to experiment with but I’ll target only one tag and many anchors. It’s a work in progress that is only starting, I already customised the messages, next step is to add the nodes ids

If you find and existing open source positioning, you can post it on this forum and I can review it and tell you what it’s doing.

okay thank you
I am trying to build smthg like that for now

That’s nice, feel free to use it, but take care that what I developed is a concept only far from being complete, might take many months given the pace of my progress, maybe if others contribute it will progress faster. Also the license I inherited might not fit with some use cases.

yeah I read the licence that’s why I am trying to change decawave’s code as a first solution.

When it comes to the code I have written I can release it under MIT, but I can only do that once I get rid of the decadriver that is GPL, I don’t have the patience to do that rewriting one from the datasheet, if someone is willing to provide an MIT SPI driver for the dwt_ functions, I would use it and switch the license.

Hi guys
I want to achieve a communication between Multiple responders with one initiator using DWM1001-dev
I have the ss_twr_init and responder example running on 2 modules.
I tried to modify them( customize messages between Initiator and responders) to get what but I got nothing
I would be so grateful if someone could help

yes, sure I have a solution already that I can describe, can you post this on a new topic with its own title ?

yeah sure one moment

great, here’s a link for following the thread