Problem using I2S DMA
Posted: Mon Feb 26, 2024 4:25 pm
Hi,
I am currently struggling to get I2S working with DMA as master Tx on STM32F411E disco board.
The I2S data coming out on SD line is very strange.
I attach a good picture, and a bad picture.
The good picture is taken when I write data manually to the SPI data register. The bad picture shows the same data stream when DMA is enabled. The (good) data stream is: 40 00 40 00 3f 9C 3f 9c (hex), which can be matched on the good picture, but not on the bad.
The good data is read out from the DMA buffer, so I am pretty sure that the DMA buffer has the right data.
And here are the relevant settings (for SPI3, using DMA channel 0, Tx stream 5):
DMA SCR: 00000451
DMA PAR: 40003C0C
DMA NDTR: 00008FFD
DMA M0AR: 20002900
DMA M1AR: 00000000
DMA FCR: 00000001
SPI CR2: 00000002
I2S CFGR: 00000E00
I2S PR: 0000020D
I use the same settings for both manual write and DMA, actually I am doing one after the other: first I write the data manually from the buffer, then I run the DMA after 1 sec wait time.
The buffer content does not change, so I would expect that same data comes out in both cases (I know DMA can only output in little endian mode).
The bad picture looks like it would send data in 24 bit format somehow scrambled, but I cannot see anything wrong in these settings.
Maybe anyone has another idea what could be wrong.
Any help is appreciated.
I am currently struggling to get I2S working with DMA as master Tx on STM32F411E disco board.
The I2S data coming out on SD line is very strange.
I attach a good picture, and a bad picture.
The good picture is taken when I write data manually to the SPI data register. The bad picture shows the same data stream when DMA is enabled. The (good) data stream is: 40 00 40 00 3f 9C 3f 9c (hex), which can be matched on the good picture, but not on the bad.
The good data is read out from the DMA buffer, so I am pretty sure that the DMA buffer has the right data.
And here are the relevant settings (for SPI3, using DMA channel 0, Tx stream 5):
DMA SCR: 00000451
DMA PAR: 40003C0C
DMA NDTR: 00008FFD
DMA M0AR: 20002900
DMA M1AR: 00000000
DMA FCR: 00000001
SPI CR2: 00000002
I2S CFGR: 00000E00
I2S PR: 0000020D
I use the same settings for both manual write and DMA, actually I am doing one after the other: first I write the data manually from the buffer, then I run the DMA after 1 sec wait time.
The buffer content does not change, so I would expect that same data comes out in both cases (I know DMA can only output in little endian mode).
The bad picture looks like it would send data in 24 bit format somehow scrambled, but I cannot see anything wrong in these settings.
Maybe anyone has another idea what could be wrong.
Any help is appreciated.