Connecting DWM1001 to ESP32-C3 Super Mini

Hi,

I’m trying to connect my DWM1001 to an ESP32-C3 SuperMini using the ESP’s Serial port, but I’m having trouble. I understand I should send \r\rlep\r to the DWM1001 to retrieve data, but I’m not getting any response. Is there another step to establish the connection, or am I doing something wrong?

I’ll paste the code below for a quick check. Thanks!

void setup() {
Serial.begin(115200);
delay(1000);

WiFi.mode(WIFI_STA);
WiFi.setSleep(false);
WiFi.setAutoReconnect(true);

bool cfgOK = WiFi.config(local_IP, gateway, subnet);
WiFi.begin(SSID, PASS);

uint32_t t0 = millis();
while (WiFi.status() != WL_CONNECTED) {
if (millis() - t0 > 100000) {
break;
}
}

int ok = udp.begin(PORT);

delay(1000);
Serial.write(“\r”);
delay(1000);
Serial.write(“\r”);
delay(2000);
Serial.write(“lep\r”);
delay(600);
}

void loop() {
checkHello();

while (!Serial.available()){
Serial.write(“\r”);
delay(1000);
Serial.write(“\r”);
delay(2000);
Serial.write(“lep\r”);
}

while (Serial.available()) {
character = Serial.read();
content = content.concat(character);
}

if (!udp.beginPacket(destIP, PORT)) {
} else {
if (content.length() == 0) {
const char* ping = “PING”;
udp.write((const uint8_t*)ping, 4);
} else {
udp.write((const uint8_t*)content.c_str(), content.length());
content = “”;
}
udp.endPacket();
++txSeq;
}

delay(50);
}

while (!Serial.available()){
  Serial.write(“\r”);
  delay(1000);
  Serial.write(“\r”);
  delay(2000);
  Serial.write(“lep\r”);
}

while (Serial.available()) {
  character = Serial.read();
  content = content.concat(character);
}

You send the final lep command and them immediatly check to see if any serial data has been received. If there is nothing waiting you move on. At that point in the code it won’t have even finished sending the command. Since you don’t seem to be worrying about delays I’d add another delay after sending the lep command in order to give the DWM1001 time to reply.

Having said that it should see something the first time (there is a delay after the transmit in setup() ) and every other time it sends the command. If you’re not seeing anything then I’d start by double checking the power, ground and data connections, both verify that you’ve got them connected and for the serial that you’re on the correct pins. If that all looks good oscilloscope on the data pins (or if you don’t have one a TTL serial to USB cable to a PC), look at the data pins in each direction and see where the data is going missing.

Serial.write(“\r”);
delay(1000);
Serial.write(“\r”);

There may be a long delay between Serial.write(“\r”) calls.

Try reducing the delay to 0.5 seconds.

Serial.write(“\r”);
delay(500);
Serial.write(“\r”);

or try this.

Serial.write(“\r\r”)

According to chapter 6.1 of the DWM1001-API-Guide, it says to press Enter twice within 1 second.