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

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

also important to mention the official debugging application note which focus on SPI debugging https://www.decawave.com/sites/default/files/aps022_debugging_dw1000_based_products_systems.pdf