I have 3 anchors and 2 tags connected, I can see the coordinates on the Android APP.
I’m trying to get the tag coordinates through the serial port, I have one connected through USB to my PC and the other through the serial port to a Raspberry Pi.
Both are connected at 115200 bauds, and I’m sending the “lec” command, and as a response I’m getting just 3 characters. 0x40, 0x01 and 0x01. What am I doing wrong?
Please help, I’ve been stuck on this for the last 3 days. :huh:
In order to use the command “lec”, you need to be in the uart shell mode.
In order to start the shell mode, you have to send “\r” twice or press enter key twice within one second and then wait for a bit. The dwm1001 should answer and then you should be able to use the “lec” command.
You can find more details in the DWM1001-API-guide
I get the same result. When I send any text (be it lec, les, fwfbskdjf, etc) the response is always 0x40 0x01 0x01 (or an @ if shown as ascii)
Maybe it is already in shell mode? should I get a command prompt in shell mode?
edit:
I use this Python code to read from the DWM1001-DEV board:
import serial
import time
try:
ser = serial.Serial(
port=‘/dev/serial0’,
baudrate=115200,
timeout=0.5
)
except:
ser = serial.Serial(
port=‘/dev/ttyACM1’,
baudrate=115200,
timeout=0.5
)
[color=#333333](Basically send \r only twice and then wait 1 second.)[/color]
[color=#333333]The message you get back is an error message from the DWM1001 when it is in generic UART mode. It basically tells it does not understand your request.[/color]
[color=#333333]Let me know how it goes,[/color]
[color=#333333]Thanks[/color]
[color=#333333]Yves [/color]
iam using a python script too , have u tried to run your script on booting raspberry in rc.local !!
or u tried runninng script after shutdown or unplugging (hardware disconnection)
coz iam have a problem getting it to work ,after shutdown it stucks in generic mode knowing that it works perfectly while a normal reboot.
I’m running my script as a service, so it restart if something goes wrong.
You can constantly check if the TAG is in shell mode, if you don’t receive a position from another tag in 5 seconds, assume that it is not inshell mode, there you can send ‘\r’ to check if you receive a ‘DWM>’ (so it is in shell mode but there’s no data being received), if you don’t receive it, start sending ‘lep\r’ (or les, or lec) until you receive a position.
I made a state machine:
mode=0 ==> initial state, not in shell mode ==> send ‘\r\r’ and receive data that includes ‘DWM>’ (data.find(‘DMW>’) >= 0)
mode=1 ==> On shell mode but not receiving data ==> send ‘lep\n’ and receive ‘DWM>’
mode=2 ==> working state, on shell mode and receiving position ==> If it doesn’t receive data for 5 seconds (or more, or less), jump to mode=0
I am using a DWM1001CDK and an ESP32 to read serial data from the DWM. However, I am encountering an issue: when the DWM is connected to the ESP32, I also need to connect another USB B cable to the DWM to access shell mode. In shell mode, I have to press the “Enter” key twice and then enter one of the commands such as ‘lec’, ‘lep’, or ‘les’.
My goal is to have the ESP32 continuously receive the serial data from the DWM without needing to manually enter these commands. How can I achieve this? Any advice or guidance on how to proceed would be greatly appreciated.