2014-11-09 02:37 PM
I want to use DMA with double buffer. STM32CubeMX provides options for normal and circular buffer.
Should I select circular buffer and then modify the source or is it better to wait for the next version of STM32CubeMX, hoping that there will be a ''double buffer'' option on the next version?2014-11-13 07:42 AM
Hello,
The double buffer mode is not covered by HAL_DMA_Init function. So there is no STM32CubeMX update to expect for this. However, the double buffer mode can be enabled using either one of the functions:HAL_DMAEx_MultiBufferStart
orHAL_DMAEx_MultiBufferStart_IT
. Best Regards2014-12-07 03:40 PM
Thanks for the answer.
How can I use HAL_DMAEx_MultiBufferStart_IT ? The information on the HAL driver description helpful but not very detailed on how to use it. Should I use it after HAL_UART_Transmit_DMA or should I replace HAL_DMA_Start_IT inside HAL_UART_Transmit_DMA with HAL_DMAEx_MultiBufferStart_IT ?2015-03-10 08:05 AM
For the benefit of others, it appears that Stavros' second idea is correct. In order to get double-buffering to work for an SPI port, I had to create a modified version of HAL_SPI_Transmit_DMA() that calls HAL_DMAEx_MultiBufferStart_IT() instead of HAL_DMA_Start_IT().
2015-03-13 11:23 AM
You will also need to create a Memory1 transfer complete callback function (e.g. HAL_SPI_TxM1CpltCallback()) and set the XferM1CpltCallback pointer to point to it.