use stm32l4 MCU to control dwm1000

I am trying to use stm32l4 MCU (stm32l476 spi3 to be exact) to control dwm1000. Had some problems to read and write from/to dwm1000 reliably. Wonder if anybody has used stm32l4 MCU to communicate with dwm1000 or dw1000. Any
advises or better still, any example code? I have used raspberry pi and other sbc to control dmw1000. Thanks in advance.


I’ve used a STM32L432KC. I had problems with the SPI select pin. If you manages manually the NSS pin, you should use the same pin that ni the case of automaticaly managed. The four pins are the consecutive

I am using an stm32 and am having no problems with the SPI comms… I use a separate pin for the cs, doesn’t seem to matter.

Here’s my spi write code: (I am using mbed)

[code]int writetospi(uint16 headerLength, const uint8 *headerBuffer, uint32 bodylength, const uint8 *bodyBuffer)
decaIrqStatus_t stat ;

stat = decamutexon() ;
SPI bus(PA_7, PA_6, PA_5);
if (fast)

for(uint32 i=0; i<headerLength; i++)

for(uint32 i=0; i<bodylength; i++)
decamutexoff(stat) ;


return 0;

@kylehunter. Thanks for your response. Are you using a STM32l4 mcu? The line in your code, SPI bus(PA_7, PA_6, PA_5) is using a “wrapper” SPI, right?

@dpeinado. Can you elaborate on "I had problems with the SPI select pin. " and how you resolved it?

I’m using an STMF103. Yes, it is an SPI wrapper. I’m using Mbed as an OS on the STM, which has wrappers for most (all) peripherals on an ARM chip. Makes it so you don’t have to touch registers for most things.

As for your statement to dpeinado. I never had an issue using any pin I wanted as a cs pin, and just controlling it via software.