I have a ESP32-ETH01 / SY108 connected to a DWM1000 (Anchor). I do not get any errors, but I am getting no data from a known working Makerfabs (Tag) module. The code is as follows:
#include <SPI.h>
#include "DW1000Ranging.h"
//#include <UDPSender.h>//https://github.com/jvnvic/UDPSender/tree/main
#define ANCHOR_ADD "86:17:5B:D5:A9:9A:E2:9C"
//GPIO 14 (CLK), GPIO 15 (MISO), GPIO 12 (MOSI), and GPIO 4 (CS).
//SCLK (SCK): GPIO 14MOSI (SDA/SDI): GPIO 13 (or GPIO 12/15 depending on configuration)MISO (SDO):
//GPIO 12 (Note: GPIO 12 is a strapping pin; see warning below)CS (SS): GPIO 4 (or any other free general-purpose GPIO)
#define SPI_SCK 12//
#define SPI_MISO 35 //
#define SPI_MOSI 14//
#define DW_CS 15 //
//SPIClass customSPI(HSPI);
// connection pins
const uint8_t PIN_RST = 2; // reset pin
const uint8_t PIN_IRQ = 39; // irq pin
const uint8_t PIN_SS = DW_CS; // spi select pin
//UDPSender udpSender("192.168.0.101", 5000);
void setup()
{
Serial.begin(115200);
delay(100);
#define ETH_SPI_CLOCK_MHZ 1
// udpSender.begin();
// Serial.println("[MAIN] Waiting for Ethernet connection...");
// while (!udpSender.isConnected()) {
delay(1000);
// #define ETH_SPI_CLOCK_MHZ 2 ///懥
// }
// Serial.println("[MAIN] Ethernet connected! Sending UDP messages...");
// udpSender.sendMessage("Hello, Single UDP Packet!"); // Send one message
delay(1000);
//init the configuration
// customSPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI, DW_CS); //SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI);
DW1000Ranging.initCommunication(PIN_RST, PIN_SS, PIN_IRQ); //Reset, CS, IRQ pin
//define the sketch as anchor. It will be great to dynamically change the type of module
DW1000Ranging.attachNewRange(newRange);
DW1000Ranging.attachBlinkDevice(newBlink);
DW1000Ranging.attachInactiveDevice(inactiveDevice);
//Enable the filter to smooth the distance
//DW1000Ranging.useRangeFilter(true);
//we start the module as an anchor
// DW1000Ranging.startAsAnchor("82:17:5B:D5:A9:9A:E2:9C", DW1000.MODE_LONGDATA_RANGE_ACCURACY);
DW1000Ranging.startAsAnchor(ANCHOR_ADD, DW1000.MODE_LONGDATA_RANGE_LOWPOWER, false);
// DW1000Ranging.startAsAnchor(ANCHOR_ADD, DW1000.MODE_SHORTDATA_FAST_LOWPOWER);
// DW1000Ranging.startAsAnchor(ANCHOR_ADD, DW1000.MODE_LONGDATA_FAST_LOWPOWER);
// DW1000Ranging.startAsAnchor(ANCHOR_ADD, DW1000.MODE_SHORTDATA_FAST_ACCURACY);
// DW1000Ranging.startAsAnchor(ANCHOR_ADD, DW1000.MODE_LONGDATA_FAST_ACCURACY);
// DW1000Ranging.startAsAnchor(ANCHOR_ADD, DW1000.MODE_LONGDATA_RANGE_ACCURACY);
// #define ETH_SPI_CLOCK_MHZ 1
}
void loop()
{
DW1000Ranging.loop();
}
void newRange()
{
Serial.print("from: ");
Serial.print(DW1000Ranging.getDistantDevice()->getShortAddress(), HEX);
Serial.print("\t Range: ");
Serial.print(DW1000Ranging.getDistantDevice()->getRange());
Serial.print(" m");
Serial.print("\t RX power: ");
Serial.print(DW1000Ranging.getDistantDevice()->getRXPower());
Serial.println(" dBm");
//udpSender.sendMessage("Hello, Single UDP Packet!");
}
void newBlink(DW1000Device *device)
{
Serial.print("blink; 1 device added ! -> ");
Serial.print(" short:");
Serial.println(device->getShortAddress(), HEX);
//udpSender.sendMessage("Hello, Single UDP Packet!");
}
void inactiveDevice(DW1000Device *device)
{
Serial.print("delete inactive device: ");
Serial.println(device->getShortAddress(), HEX);
//udpSender.sendMessage("Hello, Single UDP Packet!");
}
I have tried switching to HSPI and VSPI as well. The pins I have available are: 39,36,15,14,12,35,4 and 2. I am using short jumper wires between the ESP32-ETH01 and the DWM1000. Any suggestions would be greatly appreciated. Thank you!