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 :
If I disconnect the module, I get this:
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.