Single Sided Two Way Ranging

Dear All,

I have been trying to translate the decawave demo code from STM32 library to the nRF52832 library as my final aim is to replace the stm32 micro-controller with nRF52832 for the localization purposes. Currently I have 2 nRF52 DK (PCA10040) boards and a TREK1000 that contains 4 EVB1000. I have started with the single-sided two way ranging example provided in the git-hub by using two nRF52 boards with two EVB1000:

I have connected the nRF52 DK with the J6 External SPI connector on EVB1000 with wires and the connection is following:
EVB1000 nRF52 DK
J6 Pin2 (GND) GND
J6 Pin5 (MISO) P0.18
J6 Pin7 (SCK) P0.16
J6 Pin8 (MOSI) P0.20
J6 Pin9 (CS) P0.17
J6 Pin10 (GND) GND

I also added a picture of how I connected them although it maybe not so useful:

On nRF52, I have used the same SPI1 and I didn’t modify the example at all. I have run the ss_twr_init on one nRF52 DK and the ss_twr_resp on the other nRF52 DK.

I am able to run the code successfully after powering on both boards and run the tests in debug modes using Keil. From debuggin, I can see that the Dev_ID is read correctly as 0xDECA0130. But after when I run into the ss_init_run() and ss_resp_run() in the while(1) loop, I see that both nRF52 boards are stuck at:

/* We assume that the transmission is achieved correctly, poll for reception of a frame or error/timeout. See NOTE 8 below. */
while (!((status_reg = dwt_read32bitreg(SYS_STATUS_ID)) & (SYS_STATUS_RXFCG | SYS_STATUS_ALL_RX_TO | SYS_STATUS_ALL_RX_ERR)))
{ };

On both sides, I see the same values read from SPI of EVB1000: 0x02800002

Switch S2 and S3 on EVB1000 are set as all off.

So, what can be the problem here? I really appreciate if anyone could help me out. Thanks a lot!

Besides that, I have also attached the library of nRF52832 that I’ve written for the mapping of Demo example for the 4 anchors and 1 tag and also for this I can read the dev_id but no communication is going on between the anchors. I’ll be grateful if someone could take a look at the files. Thanks again…

Hi, Kashgarim,

According to the Status value 0x02800002 both boards have preamble timeouts.

You should increase the timeouts when porting from STM to nRF (don’t know why). When I ported simple ss_twr applications I had to increase them 2-3 times.

Also, your attachment seems not to exist anymore. Could you please update it?

Kind regards,

Hi SergeyS,

Thank you very much for your reply and I’ll try to increase the timeouts to see if it works. The attached file seems removed, so I have added a link from my google driver:

Could you please take a look? Thank you again!

I’m trying to get your firmware build but fail due to errors.

What version of the nFR5 SDK are you using?

I’m using the nRF5_SDK_15.0.0_a53641a, the latest version. I have downloaded it from the following page on downloads:

The name is: [color=#1a99da][size=small]nRF5-SDK-zip[/size][/color]

I have used the template project in the nRF5 SDK in the folder:

Thank you.

Hi, Kashgarim,

I was trying to run your application but still unsuccessfully.

Seems like it never goes into the IRQ subroutine which means either nothing happens with the DWM module (which seems to be unlikely) or IRQ configuration is incorrect.

I keep trying to get it work.

By the way, if anybody has a working port of TREK1000 to nRF52832 please share the information how you got it work.

Kind regards,

Hi Sergey,
I really appreciate your kind help and efforts for checking the code. I have tested the code in Keil uVision 5 and I also attach the project folder its name is ‘template_project’, and is placed in nRF5_SDK_15.0.0_a53641a\examples\peripheral. Maybe you could run it if you have the keil.
The path to the mapped project for nRF52832 is in ‘\template_project\pca10040\blank\arm5_no_packs’. For the single-sided twr, it seems that the DECAIRQ is not used. I tried to increase the preamble timeout length, and I get hardware fault. I’m working on it. Thank you again!

If you need just to connect 2 devices, I have working ss-twr code for nRF chip.

1 Like

It will be great if you could share it with me. My initial plan was to make the two devices work with SS-TWR, then move to the 4 anchor-1 tag demo project. If the SS-TWR works, then at least I can make sure that I have the right SPI connection. After that, I could try to correct my library for the 4-anchor 1 tag demo project.

Here is an example provided by Decaware that I tested, and which definitely works good.

You just flash one device as initiator, and another one as responder. And the last one sends its position via UART.

Just make sure you connected the DWM to nRF to the same pins as in examples

Kind regards,

Hi Sergey,

Thank you very much for your kind help! But I don’t see the example project in attachment or in any links. Could you check it please?

Best regards,

Oh, sorry please, forgot to insert the link

Thank you very much! Actually I have been testing the same example for the single-sided twr and I’ve had the issues related to the communications that I described in the post. After I increased the preamble timeout, I still see no communication between them. When you were testing the example, did you use the dwm1001 or did you use the nRF52 DK and EVB1000 and connected them with wires through SPI port?

Best regards,

I used DWM1001 module.

What exactly have you changed in the code?

From the code, I didn’t change anything. Most probably the problem could be the hardware setup that I made, as I didn’t use the DWM1001 but I have connected the EVB1000 with nRF52 DK through external SPI interface with wires. I have been able to read the device ID, but then for the communication part in the while loop, it didn’t work. Maybe I will switch to the DWM1001 if I couldn’t make it work. Thank you very much again for your kind help.

Best regards,

But you said you increased the preamble timeout and then there was no communication.

Have you checked in the example code if you connected your DWM to the same nRF pins as in DWM1001 module?

I’m sorry, but yes, besides increasing the preamble timeout, I kept the other parts of the code the same. I have seen the pin configuration in the dw1001_dev.h file and I followed the same configuration. So, I was able to read the device ID. Since my SPI connections are through wires, there might be an interference of the signals when I use the 8MHz SPI clock rate and this might be causing the communication issue. I will check it out.

I was checking the same example with the DWM1000 module connected to the STM32F103 board with wires and there was no any problem caused by SPI interferrence

That’s a good news, thank you! By the way, when you used the external SPI connector, how did you configure the EVB1000? I have set the [color=#333333]Switch S2 and S3 all off. Is there anything else that you’ve changed in the switches? When we use the external SPI, the RST seems to be a problem since there’s no pin on EVB1000 that can be connected to the external MCU.[/color]

I don’t have EVB1000 board, I have standalone DWM1000 module, and I just soldered wires to it and then connected to STM board. You can see it in the attached image