DWM1001-dev via UART with a Raspberry Pico

I want to connect my Raspberry pico to my DWM1001-dev via UART in order to get localization information. I successfully flashed all 4 of my DWMs using the user guide and I can see them in the Android app.
So far I connected the DWM TX to GP5 and the DWM RX to GP4. I also connected the ground pins together. I powered up my DWM with an external battery.
Then I used an USB cable to connect my Raspberry to my computer and I wrote a short code to help me visualize the data in the Thonny IDE:

import utime
import machine
UART_USED = 1
BAUDRATE = 115200
TX_PIN = machine.Pin(4)
RX_PIN = machine.Pin(5)

uart = machine.UART(UART_USED,
baudrate=BAUDRATE,
tx=TX_PIN,
rx=RX_PIN
)
print(uart)

while True:
if uart.any():
data = uart.read(10)
print(“Received data:”, data)
else:
print(“NO MESSAGE”)
utime.sleep(1)

I always get “NO MESSAGE” because uart.any() returns False. I am new to all this stuff and I wanted to make something very simple. I don’t know where I messed up.

Thank you in advance for your help.

Hi @terristaro
Im not much familiar with Python. However the module itself does not sent anything. There are two kind of API’s - binary API (request/response, you should use this one) and shell (human interface).

Read the PANS API document.

Cheers
JK

Thank you for your answer, I will look into the PANS API document.

After reading your answer, I now wonder how did Arduino users manage to get infos from the DWM since the module itself is not sending anything. I “copied” the Arduino codes and tried to adapt the code above on my Pico in order to replicate what Arduino users did, but I couldn’t get any result.

Hi @terristaro
typically everybody is using shell - you need to issue the “les” command and then they try to parse the string for the position. But that bad approach - you should use the binary API.

Don’t forget that nowadays the internet is full of bad examples (and everybody is ok when they are working somehow)…

Cheers
JK

1 Like