cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F412 I2S DMA pause resume does not work as expected

Kattemageren
Associate

In our system the I2S is set up with DMA in full duplex mode (circular, no fifo). That works, we get all the halffull interrupts.

Now, ideally, what we want is that some user input will reset the dma buffer pointer.

I found that in order to do that we must first disable the dma stream before we can reconfigure the counter to the full buffersize

I had hoped that I could simply issue the following

HAL_I2S_DMAPause(&hi2s2);
 
 
CLEAR_BIT(hi2s2.hdmarx->Instance->CR, SPI_CR2_RXDMAEN);
 
CLEAR_BIT(hi2s2.hdmatx->Instance->CR, SPI_CR2_TXDMAEN);
 
 
__HAL_DMA_SET_COUNTER(hi2s2.hdmarx, 2*I2SBUFFER_SIZE_SAMPLES);
 
__HAL_DMA_SET_COUNTER(hi2s2.hdmatx, 2*I2SBUFFER_SIZE_SAMPLES);
 
 
SET_BIT(hi2s2.hdmarx->Instance->CR, SPI_CR2_RXDMAEN);
 
SET_BIT(hi2s2.hdmatx->Instance->CR, SPI_CR2_TXDMAEN);
 
 
HAL_I2S_DMAResume(&hi2s2);	
 

But when I check the counter registers (NDTR) only the rx is set correctly, the tx remains unchanged. What am I doing wrong?

Or perhaps someone out there has a better suggestion on how to do this?

We need to reset the bufferpointer such that we fill in fresh data after the user input.

0 REPLIES 0