Arduino Due and DWM1001 via SPI

Hello,

I am trying to get data from my DWM1001-dev, which I already flashed, on my Arduino Due via SPI.
I used a code from this post SPI communication with arduino which managed to get something (maybe not something good, but at least something).

Below is the code that I am using :
#include <SPI.h>
SPISettings settingsA(8000000,MSBFIRST,SPI_MODE0);
//SPISettings settingsA(100000,MSBFIRST,SPI_MODE0);

void setup() {
pinMode(SS,OUTPUT);
Serial.begin(115200);
SPI.begin();
}

void loop() {
Serial.println(“request for cfg”);
SPI.beginTransaction(settingsA);
digitalWrite(SS,LOW);
Serial.print("Sending command, getting back these bytes: ");

Serial.print(SPI.transfer(0x08),HEX);
Serial.print(" “);
Serial.print(SPI.transfer(0x00),HEX);
Serial.println(” “);
digitalWrite(SS,HIGH);
// get the SIZE
uint8_t rxSize = 0x00;
while (rxSize == 0x00) {
digitalWrite(SS,LOW);
rxSize = SPI.transfer(0xFF);
digitalWrite(SS,HIGH);
}
Serial.print(“Size:”);
Serial.print(rxSize,HEX);
Serial.println(”");

Serial.print(“here are the data DWM1001 sent back:”);
digitalWrite(SS,LOW);
for (byte i = 0; i < rxSize; i++) {
Serial.print(SPI.transfer(0xFF),HEX);
Serial.print(" ");
}
digitalWrite(SS,HIGH);

Serial.println(“”);
Serial.println(“------------------”);
SPI.endTransaction();

delay(100);
}

When I am running the program, I always get this :
image
If I disconnect the module, I get this:
image
I don’t know if that is a good sign that I am receiving something other than 0XFF when my module is connected.
I read the API guide but I don’t understand what is going wrong.

Thank you in advance for your help.

Hello,

The arduino libraries for DWM1001 are community driven project and Qorvo did not contribute to them, hence i’m afraid we can’t really offer support.

Maybe you can udpate the original thread to make your issue visible to one of the original contributor ?

Otherwise I found some alternative for DWM1001-Dev with arduino on github but I don’t know if they will offer better results:

Hi @terristaro
just a quick hint:

Put a at least 1ms delay between the SPI transfers
digitalWrite(SS,HIGH);
wait 1 ms;
digitalWrite(SS,LOW);

that should do the trick.