cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 I2S Transmit Slave DMA issue

phil2
Associate II
Posted on September 23, 2014 at 08:28

Hi,

I'm currently running a STM32F4 Discovery board, connected to a AD1938 Codec. The STM32 is running as I2S Transmit Slave, with the clocks for WS(LRCLK) and BCLK coming from the AD1938. The STM32F4 is using the USB Audio device driver stack from CubeMX 1.3.0.

I originally attempted to send audio packets, from the USB stack, to the Codec via interrupt driven I2S and found that I continually got buffer underrun interrupts. I decided to attempt DMA ( Circular, No FIFO ).

The issue ( don't laugh ) is that I don't get any DMA errors under deliberate fault conditions.

For instance, I flash an LED when I get DMA half and full transfer complete interrupts. If I pull the power from the AD1938 Codec, the clocks from the codec to the STM32 stop. I expected a DMA buffer underrun. All that happens is the half/full interrupts ''stop''. As soon as I reconnect the power to the codec, the half/full interrupts start again.

My assumption is that the way the I2S/SPI and DMA peripheral communicates is based on the clocking coming into the I2S module. When the clocks to the I2S stop, the I2S module never requests any more data from the DMA. The DMA just waits until it gets another request from the I2S module. Under this configuration ( I2S TX slave ) I'll never get any errors as nothing is essentially going wrong.

Am I correct, or should I be getting some errors when the clocks stop to the I2S?

 

Thanks,

Phil.

3 REPLIES 3
Posted on September 23, 2014 at 09:18

''I2S'' is no magic incantation and things are in fact as simple as it gets.

As you run the STM32's I2S module as *slave*, it works simply as a shift register plus a bit-counter clocked from the master's clock. As soon as clock stops, the shift register stops shifting and the counter stops counting the bits, thus there is no data transmitted thus there is no reason for the I2S to demand further data from DMA.

JW

phil2
Associate II
Posted on September 24, 2014 at 08:37

Thanks for the confirmation.

At least I know I've not done anything daft in my code.

Thanks,

Phil.

Posted on September 24, 2014 at 08:54

I wish I could say this often enough... 😉

JW