Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Error with Two Way Ranging Initiator and Responder and Help with TWR Example #185

Open
maeenk opened this issue Oct 24, 2020 · 20 comments
Open

Comments

@maeenk
Copy link

maeenk commented Oct 24, 2020

Hello Guys, I am having some trouble when running both the Two Ranging Codes (Initiator and Responder) and also with the 2-D Main Anchor and Tag Implementation codes. I am new to this and want to replicate this system but I've come across some difficulties. Currently, I am using a Node MCU 1.0 ESP 12-e chip that is wired with a DWM1000. I have around people recommending external power, but I a connected my Node MCU to a laptop port. The Basic Receiver and Basic Sender had also had issue as I got bunch of "Question Marks" in the Serial Monitor from the Basic Receiver's Serial Monitor while the Basic Sender is continuously transmitting the packet.

Basic Receiver
image

Basic Sender
image

For the Two Ranging Initiator and Responder. Once I implemented the changes for "Fix ISR #181", the Two Way Responder started to output the following although I believed the changes would help bypass this problem. The Two Way Initiator runs the same edited "Fix ISR #181" changes.

(Using the example code provided printed a bunch of hex values, and really implementing that changed reduced it. )
image

Could you shed some light on the matter?

Along with this, I am also having difficulty with implementing the Standard RTLS Project. Whenever these codes are uploaded, sometimes the Serial Monitor is blank or it outputs the basic setup string statements but never the ranging. The RTLS project utilizes the original src libraries and not the "Fix ISR #181" changes (that was used only in the Two Way Responder and Initiator).

Tag's Serial Monitor.
image

Anchor B and C
image

And Anchor Main is usually blank with no range values and once with the printed strings in the setup function.

Sometimes the output from the tag and anchors' serial monitors may not come out until several minutes or ever (nothing even after 10 minutes). Would you please shed some light to this matter as well. What fixes can I implement?

Thank you in advance!

@Anacron-sec
Copy link
Contributor

Can you try this version? https://github.com/F-Army/arduino-dw1000-ng/releases/tag/0.3

I suggest you proceed in steps, first try to make basic sender and receiver work. Let me know if the stable release works (a lot of code was merged in between and maybe something broke)

@maeenk
Copy link
Author

maeenk commented Oct 25, 2020

So I went ahead and tried both the basic sender and receiver tests. These are the outputs I am getting on the Serial Monitor.

Basic Receiver
image

Basic Sender
image

I am not too sure if I am suppose to see these symbols...

@Sonic0
Copy link
Contributor

Sonic0 commented Oct 25, 2020

Hi @maeenk,
we have been using the same MCU. Check out the wiki to find out pins connection with NodeMCU 1.0, this seems to be an SPI or alimentation problem. Our DWMs use 3.3V out voltage from NodeMCU.
In addition, I had have a problem like this when I make a mistake during the soldering of the DWM1000.

@maeenk
Copy link
Author

maeenk commented Oct 25, 2020

You are maybe right. I will double check that.
image

I was wondering if you utilized an external power supply because I am simply using the connection from a usb to a computer. Or a voltage regulator; if so, any recommendations?

Thank you again for your response. It is helping a lot.

@Sonic0
Copy link
Contributor

Sonic0 commented Oct 25, 2020

I was wondering if you utilized an external power supply because I am simply using the connection from a usb to a computer. Or a voltage regulator; if so, any recommendations?

We have used the internal voltage regulator of the NodeMCU 1.0 and the Main Anchor connected via computer USB.
Try keeping the WAKE pin to 3.3V. Otherwise, try another dwm1000 device.
Unfortunatetly, no other ideas.

@maeenk
Copy link
Author

maeenk commented Oct 26, 2020

By any chance, were these the connections? These are the physical connections I made. Just want to make sure. Thank you again for your help!

image

@Sonic0
Copy link
Contributor

Sonic0 commented Oct 26, 2020

Yes @maeenk, we have made the same connections but whitout pull-down resistor on IRQ.

@maeenk
Copy link
Author

maeenk commented Nov 4, 2020

Hello again, it seemed as if I posted in the wrong post last time. Below includes the conversation from the recent post.

image

I wanted to make sure just how exactly do I actually get the same device mode. Does re-downloading the zip file do this? If so, which version should I download? I had switched to an Arduino Uno because I was having difficulty with the NodeMCU. With the Arduino, I was able to get the basic receiver and sender to work. But the two way ranging is still giving me issues. I made sure that I was utilizing 5 volts on the Arduino to use SPI and a bunch of resistors to drop down this voltage to 3.3 volts. However, it doesn't seem to work as I hoped.
By any chance could I see how the connections were set up or could you give any other advice on the matter? I appreciate all the help too.

@Sonic0
Copy link
Contributor

Sonic0 commented Nov 4, 2020

Hi @maeenk , check the DEFAULT_CONFIG structs at the beginning of Arduino examples.

@maeenk
Copy link
Author

maeenk commented Nov 5, 2020

I have made sure that the both serial monitors were printing out the device mode when not using the voltage divider method when testing the two way initiator and responder. Thank you again. I used the two way responder example code; but I do want to point out that in the arduino-dw1000-ng-0.3 version that both the irq and reset pins were commented out, so I uncommented them when running them. I have been following the setup with Arduino Uno below, but used resistors instead of a voltage regulator.

image

Once I used the method with voltage dividers, as Arduino's SPI operates then, I got this from the responder's serial monitor. And this is wrong as I should've seen some range. Maybe it is in something I did but can't seem to find out yet.

image

I decided to see what exactly was being sent and received, and this was the responder's serial monitor. This shows that nothing is being sent nor received by the responder because of the "0" at the end of each line.

image

Would you provide recommendations? Which zip file should I include instead?

@Bartvelp
Copy link
Contributor

Bartvelp commented Nov 7, 2020

hey @maeenk
I have used the ESP8266 and I sort of recognize some of the errors. Please make sure that when the sketch does not print an incorrect Device ID like FFFF in many in your screenshots, or the weird characters printed. These kinds of errors always point to some kind of wiring issue, either I accidentally connected 2 pins together on the DWM (that damn pin spacing is small) or the connection just was not solid enough. Do not use a breadboard, always directly solder a copper wire to both the ESP8266 and to the DWM module, it will save you a lot of headaches.
Did you do this?
In my tests the dwm1000 isn't too picky about power, just add a 100uF capacitor and you should be fine.
IMO you should stick to the latest version of the library and if you use an ESP8266/ESP32 use the one in my pull request that fixes ISR. But sonic and 0nism know a lot more about this library than I do.
Stick to the basicReceiver and basicSender sketch, when you get that working, continue to ranging sketches.

@Sonic0
Copy link
Contributor

Sonic0 commented Nov 7, 2020

Yes, when all F appears at the beginning during the reading of configuration committed to the DWM1000, there is a problem with SPI communication. I had the same problems a the beginning of this project due to the breadboards and soldering mistakes w(゚Д゚)w.

@maeenk
Copy link
Author

maeenk commented Nov 8, 2020

In my tests the dwm1000 isn't too picky about power, just add a 100uF capacitor and you should be fine.

Thank you for the response. I too believe that it has something to do with my wiring. I will move to soldering everything instead of breadboarding. I do want to make sure about the power to the dwm1000. Would I connect a 100 uF capacitor from the VCC to VDDAON, VDD3V3 (in the schematic above)? Just want to make sure the connections to delay this any further.

@Bartvelp
Copy link
Contributor

Bartvelp commented Nov 8, 2020

Add an electrolytic capacitor across VCC (which is the net connected to VDDAON, VDD3V3) and ground. As you might know, the capacitor will act as a (very) small battery that can make sure there is no big voltage drop due to current spikes when transmitting and receiving. Since it buffers a small charge, you always need to connect 1 leg to a positive rail like VCC(/VDD3V3/VDDAON) and 1 leg to ground.
This is my schematic: (BU01 === DWM1000 equivalent)
image
The ceramic cap is not really necessary I think but it is common practice.
Hope this helps.

@maeenk
Copy link
Author

maeenk commented Nov 12, 2020

Hi guys and thanks for the reply,

I am editing this post entirely. I realized that the library beginning of SPI actually sets up the SPI modes. The basic senders and receivers don't utilize SPI, but the Two Way Ranging does. I tried just trying to see waveforms when the dwm1000 is disconnected from the NodeMCU, so just probe the NodeMCU SPI parameter pins. I found from my oscilloscope that the MISO, MOSI was constant low or at 0 which I am assuming is problematic. However, once I connected the Dw1000 with the NodeMCU, I went ahead and probed four of the main pins for SPI: chip select, clock, MISO, and MOSI. Here are the following readings I saw from the oscilloscope. The codes used to run are the Two Way Initiator and Two Way Responder. Channel 1 is the Yellow Signal and Channel 2 is the Blue Signal.

Two Way Initiator:
Channel 1 is MOSI, and Channel 2 is Clk. It is hard to see, but they overlapped one another below
image

Channel 1 is MISO, Channel 2 is MOSI below
image

Channel 1 is Chip Select (CS) and Channel 2 is MOSI below
image

Two Way Responder:
Channel 1 is MISO, and Channel 2 is MOSI below.
image

Channel 1 is Clk and Channel 2 is MOSI
image

Channel 1 is CS and Channel 2 is MOSI
image

Comparing MISO (Channel 1) and MOSI (Channel 2) on both responder and initiator. Responder is the picture on the Left, and Initiator is picture on the Right.
image

When I was observing the MISO and MOSI waveforms from both the responder and the initiator, I was wondering why I am seeing two different waveforms especially in there difference in voltage peaks. The initiator is tiny in comparison to the responder. I kind of assumed that they were going to be similar especially in that they were initialized the same way. The responder seems to be looking fine, but the initiator is probably what is messing up my attempt on your two way ranging examples. The other signals seem to look correct as well. I was hoping what steps would you recommend I take? Is there a simple SPI program to send some bytes over? I am bit of a novice and am very fascinating in running this project as well.

@Bartvelp
Copy link
Contributor

Hi Maeenk,
Unfortunately I am not too familiar with SPI and the expected voltages, so I can't be of much help in that regard.
But can you further explain what you mean by this:

The basic senders and receivers don't utilize SPI, but the Two Way Ranging does.

You cannot connect to the DWM1000 without using SPI, and this library always tries to do so. The default SPI pins are used on the nodemcu, which are D5 D6 and D7, D8 is often used as CS.
Only CS needs to be defined when using this library without interrupts, see:
https://github.com/F-Army/arduino-dw1000-ng/blob/master/src/DW1000Ng.hpp#L65

Maybe somebody else can help you debug your scope pictures

@Sonic0
Copy link
Contributor

Sonic0 commented Nov 13, 2020

Hi everyone, sorry Maeenk but I don't remember anything about SPI protocol.

@maeenk
Copy link
Author

maeenk commented Nov 18, 2020

By any chance, was there any flashing needed on the decawave chip or the dw1000 chip themselves? If so, do you guys know how to do that or provide me steps on flashing? Can't seem to replicate the examples.

@Sonic0
Copy link
Contributor

Sonic0 commented Nov 18, 2020

By any chance, was there any flashing needed on the decawave chip or the dw1000 chip themselves? If so, do you guys know how to do that or provide me steps on flashing? Can't seem to replicate the examples.

Nothing like that, any flashing needed.
How many DWM1000 do you have tried? Now I remember I broke one DWM1000 (probably during the soldering) and the result was like yours.

@benchia001
Copy link

Try adding a 3 second delay at the setup. It seems to help me with the SPI issues. Perhaps the ESP8266 may not have start-up properly and the SPI setup may not be done properly because of that. (I am not sure of the exact reason but it seems to have helped me)

Also using D5/GPIO15 as a CS seems to cause some boot issues -> esp8266/Arduino#2466. Connect a 4.7k (i saw from other forums that using anything between 1k and 5k should do the trick, I personally used 5k) resistor from GND to D5 which should solve the boot issues. Hope this helps

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants