2016-09-30 05:32 AM
Hello, i hope you can help me.
I am using a stm32f303rct6 and activated the spi interface with dma. The Frame is 8 byte long. The tx an rx works pretty good. But now i am testing some error conditions. In this case, i send at the beginning a rising edge and after 10 ms the 8 byte frame. The spi detected the first rising edge a read the first bit (wrong) into the dr register and all the rest was wrote from the frame without the last bit. (this makes sense) But now is coming the mistake after this wrong frame. To receive an new frame i call the function again:HAL_SPI_TransmitReceive_DMA(&hspi2,&usrCSpiWriteBuffer[0],&usrCSpiReadBuffer[0],USRCOM_PACKAGE_SIZE) != HAL_OK){ ...
But the HAL is not resetting the DMA or reset the spi bitcounter. The next received frame looks crazy. The frame has the last bit from the last frame and the rest of the new frame. How can i reset the dma or the spi to resolve this problem?
Please help me!
Thanks
2016-10-04 07:11 AM
Hello,
I recommend you to have a look at ''SPI_FullDuplexDMA'' example in the STM32CubeF3 at this path:STM32Cube_FW_F3_V1.6.0\Projects\STM32303E_EVAL\Examples\SPI\SPI_FullDuplex_ComDMAThis example can help you to perform SPI data buffer transmission and reception with DMA.Regards