Decawave SPI issues

Hello, I am using an ATSAM4S32B MCU to communicate with the decawave DWM1000. According to the datasheet the decawave is working in SPI_MODE0 which means it captures data on rising edge and transfers on falling. However, when trying to communicate with it I detected that it is capturing on falling edge and transfering on rising. When trying to change the SPI_MODE on my MCU the Decawave seems to be sampleing before the first falling edge. I am not sure what the issue could be. I have GPIO5 and GPIO6 pulled down to ground so the DW1000 should work in SPIMODE0 but the osciloscope shows otherwise.

Hi,

SPI issues could be caused by a few issues eg. you might have too long wires on the SPI. For high speed communication it may cause problems.

Or maybe reconfigure the MISO might help. See IC user manual. SPI_EDGE reg:04:00 bit:10

SPI data launch edge. This bit allows the system integrator the ability to control the launch edge used for SPI data from the DW1000 on the MISO SPI data output line. This may be used to select the MISO output operation most suitable to the target system. When SPI_EDGE is 0 the DW1000 uses the sampling edge to launch MISO data. This setting should give the highest rate operation. When SPI_EDGE is 1 the DW1000 uses the opposite edges to launch the data. This setting may give a more robust operation.

Leo

I think the MISO configuration might be the issue. The decawave is launching information on the sampleing edge (in this case the rising edge) when it should launch it on the falling edge. How would I go about modifying this value in the register? I just send reg 0x04 and then The sequence of 32 bits for the register with MSB sent first? Is there a function in deca_device.c that can modify this register?

Thank you for your help.

Javier

Hi Jicastillo,
on ATSAM4S32B you are using SPI peripheral and not USART? From my observation the ATMEL SPI peripheral is not compatible with DW1000 (but from datasheet point of view it should be) and USART peripheral is working fine. The DW1000 after reset state use weird hi-speed SPI mode which not all peripherals can handle and as Leo recommends is needed to change it to more common mode.

As Leo pin point you must change the SPI edge mode. If you are using deca driver that you need to hack dwt_initialise function - basically you need to add “dwt_write32bitreg(SYS_CFG_ID, 0x1600);” before “if (DWT_DEVICE_ID != dwt_readdevid())” and after “dwt_softreset();”

I am using the SPI peripheral. Does the DW1000 have a USART interface? I tried adding the line of code you recommended and the DW1000 now only responds 0xFF. It seems that it starts reading before the MOSI pin is set to the correct value. I am still observing that the DW1000 is launching data on the sampleing edge and I read the 0x04 register and the SPI_EDGE pin is at 1 and should launch at a different edge.

Regards,
jicastillo

The DW1000 dont have a USART but ATMEL chip have SPI and USART peripheral. And from my experience ATMEL SPI cant handle DW1000 SPI in native mode.

Which kind of response do you see with and without the modification? Have you tried all 4 SPI combination?

DW1000 native SPI mode change MISO cca 13us (yes micro seconds) after sampling edge. So it could looks like that it is not working in proper way. But SPI definition allow this behavior.