I’ve been having some trouble sending and receiving packets using the DW chip’s automatic response facilities.

Automatic-response:  It is possible (and probably necessary for ranging) for the DW chip to quickly enter listen mode after it has transmitted a beacon packet.  There is a special mode that can be set up so that no intervention is required by the host processor.  There is a symmetrical capability to set up the DW chip to respond automatically to inbound beacon packets.

When transmitting a packet, and automatically listening for a response, I was receiving a “timeout” response as if the other end has taken too long to respond.  I simplified all the code down to the bare essentials, but still kept getting the timeout.  This is weird because clearly a response had been received, but by the time I polled the status of the response, the chip had decided it was too late arriving.

The cause turned out to be the SPI baudrate.  I was driving the SPI at 110K which is the slowest data rate that the DW can handle, but it is the speed they suggest for initializing the DW.  Deep in their demo code, the STM32 raises the SPI speed to something a lot higher (a rate that is difficult to decipher from the code).

I scanned the DW manual and couldn’t find any hints about legal  higher SPI speeds. My versions of the datasheet, and user manual are pdfs and for some reason I can’t search for keywords, the way I usually can.  Moreover, I couldn’t find any indication how to tell the DW I was going to talk to it at a higher speed.

Short of any better ideas… I simply cranked up the speed at the Nordic side to 8Mb/s, and let it rip.

Not only did the DW figure out the data rate automatically, but it also fixed my timing bug.  Clearly the Nordic software was not testing the status of the radio fast enough using the slow SPI speeds.

I don’t recall ever reading anything about this issue, but perhaps the new manuals mention it.  I suppose this explains why they crank the SPI speed up.   Doh!


1/21/16   I just read that the maximum possible baudrate for the SPI is 20MHz.

Leave a Reply