cancel
Showing results for 
Search instead for 
Did you mean: 

Bug report: (STM32F0 v1.5) SPI TansmitReceive function doesn't receive properly after Transmit function

infoalchemist9
Associate
Posted on August 17, 2016 at 09:01

After generating code using CubeMX 4.14.0 for an STM32F030C6, I noticed a bug in using the blocking (non interrupt or DMA) functions for SPI.

When switching between using the functions HAL_SPI_Transmit and HAL_SPI_TransmitReceive, the function HAL_SPI_TransmitReceive writes only zeroes in the RX array when it is called after HAL_SPI_Transmit. Actual received bits are confirmed on an oscilloscope.

This was tested while communicating with serial flash IS25LQ010B-JNLE, but it is very likely unrelated to the answering device.

If only the function HAL_SPI_TransmitReceive is used, it works every time. No problem.

#bug #stm32 #cubemx #spi
1 REPLY 1
Walid FTITI_O
Senior II
Posted on August 18, 2016 at 10:58

Hi aap.broodje,

I don't understand why you are putting the transmit function and after that the transmit receive. Maybe, in that case, first transfer is still ongoing which makes problems for you. The transmitReceive funtion can do all the job of transfer and receive.

Tray always to use the last version of CubeMx (4.16.0 now) and last version of Cube Library (V1.6.0 now)

I recommend to take a look the the ''SPI_FullDuplexDMA'' example in the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef0.html

at this path :STM32Cube_FW_F0_V1.6.0\Projects\STM32F0308-Discovery\Examples\SPI\SPI_FullDuplex_ComDMA

-Hannibal-