2018-06-18 06:00 AM
Hi,
How to use HAL_SPI_Receive_DMA correctly? We need to receive an ongoing data stream via spi. For that we use spi receive with dma. But if we call HAL_SPI_Receive_DMA once before the main loop the HAL_SPI_RxCpltCallback will be called only once with correct data. If we put the function call into the callback it's not working but we don't know why... If we put the function call into the main loop it works with correct data, but is it necessary to call the function so often, most of the time it returns BUSY? That's the way we use the function right now:
if (spiHandle->State == HAL_SPI_STATE_READY) {
HAL_StatusTypeDef spiReceiveStatus = HAL_SPI_Receive_DMA(spiHandle, spiBuffer, SPI_BUFFER_SIZE); }Thanks
2018-06-18 06:44 AM
HAL_SPI_RxCpltCallback is called in interrupt context.
Better to save the received data in another buffer in HAL_SPI_RxCpltCallback and set a flag that receive is complete.In main loop check for this flag and initiate a new transfer2018-12-04 09:13 AM
hi @Christian B
I have the same problem, have you found a solution? if yes, can you please explain to me how you did it.
Thank you in advance for your answer.