DMW1001-DEV API via SPI (without using data ready pin)

Hi,
I’ve been testing 2 DWM1001-DEV to measure the distance between them.
I did that successfully using API via UART, sending 0x0C and 0x00 and then reading the answer.
Now I’m trying to do the same using SPI, but sometimes it doesn’t work.
(At the moment I’m using an Arduino Due to speed up the tests)

What I do is this every 5 seconds:
[list]
[]open communication (Chip select pin low)
[
]send 0x0C and 0x00
[*]close communication (Chip select pin high)

[]while length==0x00 && less than 4" are passed:
[list]
[
]open communication (Chip select pin low)
[]send 0xff and length = read data
[
]close communication (Chip select pin high)

[/list]
[]if length != 0x00 && length != 0xFF
[list]
[
]open communication (Chip select pin low)
[]for a number of times equals to the length:
[list]
[
]send 0xff and read data
[/list]
[*]close communication (Chip select pin high)
[/list][/list]
I don’t know if this is totally correct, in particular if it’s needed to close and reopen communication or if it just need a to wait some time.
Sometimes (20% of cases) I get answers which don’t make sense.
For example I get 0xff for the length, like it didn’t get my query, or i get other value that I don’t understand.

(I attach the arduino code that I’m using for these test)

Thanks for the help

Hi,

it looks like the file you’ve attached did no go through.

Maybe send it again, and I can take a look.

Thanks
Yves

[hr]
I solved my problems putting some delays of about 10 or 100 microseconds between the transfers. Does that make sense?

Using a raspberry pi with android things seems like those delays aren’t needed.

Hi LKNTH

Thanks for letting us know that adding a 10 or 100ms delay between SPI solved your problem. We actually realised that this information is missing in our API document. So document will be updated.
Although 10 or 100ms works well, the minimum delay between SPI transaction is 5ms. Some commands might actually work faster but 5ms is safe limit for all command types.
Leo

I think you misunderstood me: I said microseconds, not milliseconds.
I think that it can be because the module doesn’t notice the change of state on the chip select pin.
Let me know if it makes sense

Hi @LKNTH facing similar issue, getting a valid response 30% of the times, I see you have solved the issue, can you tell me exactly where you put delays, i tried the same didn’t work out, thanks!