DWM3000CDK and esp32 spi connection

Hi everyone. I have 2 dwm3000cdk boards. I want to use them with my custom esp32 boards. One of them is going to be an anchor and one of them is going to be a tag.

There is a Raspberry Pi interface on the boards. I connected spi pins to my esp32 spi pins like below.

spi_clk ----> esp32 gpio18
spi_mosi—>esp32 gpio23
spi_miso---->esp32 gpio19
spi_cs------->esp32 gpio5

gnd---->gnd
3v3---->3v3

But i could not read anything.

Is this connection enough or is there anything extra connection that i am missing?

I saw some examples makefabs website about uwb and there are some boards with esp32 and dwm3000 or dwm1000. for example:
[ESP32 UWB Pro | Makerfabs]

I tried to work them too but in their examples there are irq pin or rst pin…
`#include <SPI.h>
#include “DW1000Ranging.h”

#define ANCHOR_ADD “86:17:5B:D5:A9:9A:E2:9C”

#define SPI_SCK 18
#define SPI_MISO 19
#define SPI_MOSI 23
#define DW_CS 4

// connection pins
const uint8_t PIN_RST = 27; // reset pin
const uint8_t PIN_IRQ = 34; // irq pin
const uint8_t PIN_SS = 4; // spi select pin`

is there anybody help to me?

Best regards…

#include <SPI.h>

#define PIN_RST  27  // Reset pin (DW3000)
#define PIN_IRQ  34  // IRQ pin (not use!!!)
#define PIN_SS   5   // SPI Chip Select (CS/SS)

// SPI pinleri (ESP32 VSPI örneği)
#define PIN_MISO 19
#define PIN_MOSI 23
#define PIN_SCK  18

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("DW3000 SPI Test: Read Device ID");

  // SPI pinlerini başlat
  SPI.begin(PIN_SCK, PIN_MISO, PIN_MOSI, PIN_SS);

  // SS pin çıkış olarak ayarlanmalı
  pinMode(PIN_SS, OUTPUT);
  digitalWrite(PIN_SS, HIGH);

  // Reset pinini kullanarak DW3000’i başlat
  pinMode(PIN_RST, OUTPUT);
digitalWrite(PIN_RST, LOW);
delay(10); // kısa süreliğine LOW yap
pinMode(PIN_RST, INPUT); // sonra INPUT olarak bırak
delay(10); // birkaç ms bekle

  // Device ID'yi oku ve yazdır
  uint32_t dev_id = read_dev_id();
  Serial.print("DEVICE ID: 0x");
  Serial.println(dev_id, HEX);

  if (dev_id == 0xDECA0130) {
    Serial.println("DEV ID OK ✅");
  } else {
    Serial.println("DEV ID FAILED ❌");
  }
}

void loop() {

}

// DW3000 Device ID register'ını SPI üzerinden oku
uint32_t read_dev_id() {
  SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0)); // 2 MHz
  digitalWrite(PIN_SS, LOW);

  // Device ID register adresi: 0x00 (3 byte address header)
  SPI.transfer(0x00); // Register address
  SPI.transfer(0x00); // No offset
  SPI.transfer(0x00); // No extension

  // 4 byte oku
  uint8_t b0 = SPI.transfer(0x00);
  uint8_t b1 = SPI.transfer(0x00);
  uint8_t b2 = SPI.transfer(0x00);
  uint8_t b3 = SPI.transfer(0x00);

  digitalWrite(PIN_SS, HIGH);
  SPI.endTransaction();

  return (b3 << 24) | (b2 << 16) | (b1 << 8) | b0;
}
00:14:43.954 -> DW3000 SPI Test: Read Device ID
00:14:43.954 -> DEVICE ID: 0x0
00:14:43.954 -> DEV ID FAILED ❌

still i could not read device id…

Anyone??? :slight_smile:

IRQ and reset are not required for basic operation. Reset is only needed if you want to be able to reset the device. The IRQ is required if you want to maximise the efficiency of the system and some drivers / libraries may require it in order to run correctly when calculating ranges but it’s possible to run without it and it’s certainly not needed for basic read/write operations.

SPI lines normally have external pullup resistors on them. This means that in the event of a lack of response you will normally get 0xFFFF. That you got a device ID of 0 implies either you don’t have any pullups fitted or something is responding on the bus. Unfortunately without a logic analyser or oscilloscope about all you can do in this situation is double and triple check the connections and firmware configuration.

Try running the SPI clock at a lower speed.
Ensure that you have short and neat connections. There have been a number of times when people have had this sort of problem and it’s come down to poor signal integrity.

Thanks a lot for reply Andy. I want to ask a question.
When i buy the modules, i uploaded firmware to the modules like in the quick start PDF. So is this situatian a problem to read device id using spi pins???

I checked the voltages on the board and 3v3 is okey.
Then i tested my esp32 board for spi, i connected mosi pin to miso and uploaded a spi loopback test code. Then esp spi pins are okey.
At last as you said, i connected 10k resistors mosi and miso pins. But nothing changed. Still i could not read.
By the way, i have an analog dicovery device, i am going to use it like logic analyzer to see spi pins and foto of connection. Thanks again.

Best regards…