cancel
Showing results for 
Search instead for 
Did you mean: 

is there a way to implement SPI burst mode in stm32f401?

jb
Associate II

Hi All,

I am trying to use STM32F401 NUCLEO Board to talk to ST IMU LSD6DSL.

LSM6DSL supports burst mode read, but I can not find a way to implement SPI burst mode from the stmf401 s library.

I am wonderinf if there is any way to implement a SPI burst mode in stm32f401.

Thank you !!

4 REPLIES 4
TDK
Guru

"Burst mode" as in reading multiple bytes in the same transaction? Should be no problem.

If the SPI clock is fast, you may need to use DMA if you don't want to see any delay between SCK pulses, or implement your own code which responds to TXE quickly enough. But the SPI protocol doesn't really require this.

https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM32469I-Discovery/Examples/SPI/SPI_FullDuplex_ComDMA

If you feel a post has answered your question, please click "Accept as Solution".
prain
Senior III

I'm not aware of your IMU specs but Usually​ burst mode in senors means that you can read successive memory addresses without issuing new read command. Typically sensor data values are in successive memory addresses. for example gyro x, y , z. So you can read 3 axis data just with a single read command.

jb
Associate II

Hi

Prain's explaination of "Burst mode" is exactly what we want. We are using DMA, but the problem is that we can't figure out how to receive multiple bytes/words after transmitting a single read address. We are also aware of the size argument to HAL_spi_TransmitReceive_DMA, but this seems to send the read address multiple times rather than sending it once and waiting to receive multiple bytes.

Is there any suggestion on doing this ? Thanks

In SPI multi-byte, the number of transmit and receive bytes should be equal. So you can use HAL_SPI_TransmitReceive_DMA() function.