Sample Programs

We received requests in the past for simpler code as our EVK source code is rather a lot to go through for basic functionality like send, receive (with or without delay), CW and more to work.
We now have finished an API and source code of various stand-alone examples which can be ported to any target microprocessor system with an SPI interface

This DW1000 Software API Guide and source code examples can be downloaded from our website.

I also want to make you aware that (in case you have not been on our website for a while):

Latest DW datasheet : rev2.07
Latest DWM datasheet: rev1.2.
Latest IC user manual: rev2.06.
Latest EVK Code: rev3.05
Latest TREK Code: Rev2.10

Kind Regards,

Hi Leo,

thanks for this Info! I don’t know what is wrong but i can’t download this files. Everytime i get an error. I test it with two browsers but the result is the same.


The Software API seems very useful. I have a question regarding the purpose or the “port.h” and “port.c” files. Is the intention that these are the files we would modify if we were to port the code to a new microcontroller like an RPi?


hello leo , I have read your latest DW1000API ,and there is a question about here :
/* UWB microsecond (uus) to device time unit (dtu, around 15.65 ps) conversion factor.

  • 1 uus = 512 / 499.2 祍 and 1 祍 = 499.2 * 128 dtu. */
    #define UUS_TO_DWT_TIME 65536

in my opinion UUS_TO_DWT_TIME is define 63897. it is equal 1/15.65X10^-6 .why the api use 65536?
thanks .

在 2015年12月10日星期四 UTC+8下午7:53:00,leo Theunissen写道:

To convert real micro seconds (1e-6 s) to DW1000 time the conversion factor would be 63897
But to convert “our” micro seconds (1uus or 1.025e-6s) to DW1000 time then the factor is 65536

So the API is correct.


Thanks for this upload. It helps me very much.
I tried the examples 3a and 3b (tx_wait_resp and rx_send_resp) and they worked together on the EVK boards. I changed the software a bit such that you can see on the lcd if a frame is received properly or if there was an error.

But, 2x16 char is not so much space for tracing.
Is there somebody who got the usb-comm to the PC operational (like usb_sendmessage())?

I tried it: adding various files from the DecaRanging ARM project until everything compiled (that’s a bunch of files!). But it doesn’t run (it halts at usb_init()). I’m not sure if all #defines are set properly, and if there are more initializations to do.
Or is it possible to use the UART of the EVK?

As the user manual decrible the timestamp register is 5 octets .
But why does it use 4 octets for transform the value of timestamp to report the anchor?
here is the code:
#define FINAL_MSG_TS_LEN 4

static void final_msg_set_ts(uint8 ts_field, uint64 ts)
int i;
for (i = 0; i < FINAL_MSG_TS_LEN; i++)
ts_field[i] = (uint8) ts;
ts >>= 8;
Write all timestamps in the final message. See NOTE 10 below. */
final_msg_set_ts(&tx_final_msg[FINAL_MSG_POLL_TX_TS_IDX], poll_tx_ts);
final_msg_set_ts(&tx_final_msg[FINAL_MSG_RESP_RX_TS_IDX], resp_rx_ts);
final_msg_set_ts(&tx_final_msg[FINAL_MSG_FINAL_TX_TS_IDX], final_tx_ts);
in the function “final_msg_set_ts”,the poll_tx_ts is the 5 octets ,but puts in the 4 octets message ? is there any wrong here ?

My question is similar to Joris’ question from 12/22/15. One of my EVB1000s is running ex 1c to transmit and another is running ex 2a to receive. I would like to send out the data on the RX board through UART. Has anyone successfully done this using the example code from decaWave? If so, can you point me in the right direction?


I’m using the DWM1000 module. With the example code I could successfully run the simpeRX/TX applications. I alos managed to get the single side TWR ranging to work. However, this required some modification of the default values. Unfortunately the readings is not terribly correct, but this might be due to incorrect antenna delay settings. There is a note in one of the user guides dealing with my initial observations (rx/ty OK, TWR not OK) which says, if the antenna delay is set larger than real, the TX delays might be too wrong for proper operation. The default delays in the SW are 16384. There seem to be no delay values in the OTP of the module. I thought they should be there? Any ideas how to best perform antenna delay calibration in this situation?

Best regards.

Hi Andreas,

Antenna delay varies on where or how the module or IC is used. The default antenna delay used with DecaRanging (515.371ns) is a good starting point.
It will also vary slightly from PCB design to PCB design or module to module, the equivalent of a few centimeters, so depending on the accuracy one requires you could program the same value into each design, module (slightly less accurate) or program them individually (more accurate).

Attached our Calibration application note APS014. Have a look at chapter 2.3.2 on page 11(14) , this will explain the above.


Hi there Andreas, which microcontroller are you testing the example TX and RX on?


I’m using a Xilinx Zynq = ARM Cortex A9 / 600MHz

Can you walk me through how to use the examples? I am a beginner to C code, gcc, and Ubuntu. I have all of the source code but I don’t know how to compile it. I wanted to run the very first example I saw, simple_tx. I tried doing this:

gcc ./examples/ex_01a_simple_tx/main.c -o main -I./decadriver -I./Libraries/STM32F10x_StdPeriph_Driver/src -I./Libraries/STM32F10x_StdPeriph_Driver/inc -I./platform -I./Linkers -L./Libraries/STM32F10x_StdPeriph_Driver/src -L./Libraries/STM32F10x_StdPeriph_Driver/inc -L./Linkers

But It gives me an error saying:

In file included from ./examples/ex_01a_simple_tx/main.c:17:0:
./platform/port.h:22:23: fatal error: stm32f10x.h: No such file or directory
#include “stm32f10x.h”
compilation terminated.

I see the folder “STM32F10x_StdPeriph_Driver” and it seems like it needs to be somehow installed but I’m not sure how. I feel in over my head. I would appreciate anything you could do to help clarify all of this.
Thanks for the help,

The example are for a STM micro controller so you can just compile the Linux. You will need to install and IDE for STM or port the code to use a standalone toolchain.


Not sure what you mean exactly. The code can’t be run from a regular linux box? It must be run by a microcontroller?

What is IDE for STM? What do those stand for?

Thanks again,

STM is ST MIcroelectronics ( and they make ARM microcontrollers. The EVB-1000 board has an ST Micro ARM chip on it. I don’t use DW’s code but I believe their code assumes you’re using the on-board ARM MCU to run the DW firmware. You can communicate with this micro via USB I think. But no, a regular Linux box cannot run the DW1000 unless you have a SPI interface on your PC (unlikely).

Does that mean that currently the only way to control the evb1000 is by using the graphical user interface on a windows box? It seems like this is the only way.
If I wanted to create a driver in ROS for the evb1000 it seems like the 1st step would be buying a SPI link, then taking the microcontroller’s outputs and meshing them with ROS.

I guess it does. I’ve never used their stuff though so I don’t know.

Hi Forest,
You’re drawing the wrong conclusions.
The source code can be ported to many processors. However for one processor/platform more tailoring of the code needs to be done then for other platforms. It is that porting you’ve to manage.

The EVB1000 can be connected to many platforms. Information on connectivity to these platforms can be found in the EVB schematic while having the DW datasheet at hand would be recommended. How to disable the ARM can be found in the EVK usermanual also.

Maybe also do some investigation eg a “google” on eg “IDE” gives 238million hits , while “IDE ROS” half a million

Have a nice “Pinkster” / Pentecost weekend


Hey Forest,
I suggest you search this google group for this question has been asked already. I was able to connect EVK 1000 to my Ubuntu precise (12.04) and it generated a serial port file at /dev/ttyACM0

Once this was done, it was really easy to obtain ranging information, I could write a sample python code which does the same:

Though I haven’t tested this code myself, but it should more or less work… I will test it shortly and post it here if required. I referred this for the same(thanks to Leo! python code written for ROS):