cancel
Showing results for 
Search instead for 
Did you mean: 

I2S3 48KHz16bit Extended data format issue

Rajesh Gali
Associate
Posted on November 22, 2017 at 03:17

I am trying to configure I2S3 in Fullduplex Master RX mode, 48KHz sample rate. Hal Configuration is as shown below

hAudioFDI2s

.

Init

.

AudioFreq

=

AudioFreq

;

hAudioFDI2s

.

Init

.

ClockSource

=

I2S_CLOCK_PLL

;

hAudioFDI2s

.

Init

.

CPOL

=

I2S_CPOL_LOW

;

hAudioFDI2s

.

Init

.

DataFormat

=

I2S_DATAFORMAT_16B

;

hAudioFDI2s

.

Init

.

MCLKOutput

=

I2S_MCLKOUTPUT_DISABLE

;

hAudioFDI2s

.

Init

.

Mode

=

I2S_MODE_MASTER_RX

;

hAudioFDI2s

.

Init

.

Standard

=

I2S_STANDARD

;

hAudioFDI2s

.

Init

.

FullDuplexMode

=

I2S_FULLDUPLEXMODE_ENABLE

;

I2S PLLs are configured successfully for 48KHz sample rate, I confirmed it by probing the WS and BCLK pins 

WS: 48KHz

Bit Clock: 3.072Mhz ( 48 * 16bit * 2ch*)*2 (for extended mode) = 3.072KHz, and I have connected this to an external codec configured to receive I2S signals from ST. 

However, the problem I am facing is I get distorted audio in only left channel. And above setup works well with the 16KHz no distortion in both channels. I confirmed the same behavior with different codec too. So, I don't think this is a misconfiguration in codec. 

I am using DMA to transmit data over I2S 

hdma_i2sRx

.

Init

.

Channel

DMA_CHANNEL_0;

hdma_i2sRx

.

Init

.

Direction

=

DMA_PERIPH_TO_MEMORY

;

hdma_i2sRx

.

Init

.

PeriphInc

=

DMA_PINC_DISABLE

;

hdma_i2sRx

.

Init

.

MemInc

=

DMA_MINC_ENABLE

;

hdma_i2sRx

.

Init

.

PeriphDataAlignment

DMA_PDATAALIGN_HALFWORD

;

hdma_i2sRx

.

Init

.

MemDataAlignment

=

DMA_MDATAALIGN_HALFWORD

;

hdma_i2sRx

.

Init

.

Mode

=

DMA_NORMAL

;

hdma_i2sRx

.

Init

.

Priority

=

DMA_PRIORITY_HIGH

;

hdma_i2sRx

.

Init

.

FIFOMode

=

DMA_FIFOMODE_ENABLE

;

hdma_i2sRx

.

Init

.

FIFOThreshold

=

DMA_FIFO_THRESHOLD_FULL

;

hdma_i2sRx

.

Init

.

MemBurst

=

DMA_MBURST_SINGLE

;

hdma_i2sRx

.

Init

.

PeriphBurst

=

DMA_PBURST_SINGLE

;

hdma_i2sRx

.

Instance

= DMA1_Stream0

Tx configuration:

hdma_i2s_ext_tx

.

Init

.

Channel

= DMA_CHANNEL_2

;

hdma_i2s_ext_tx

.

Init

.

Direction

=

DMA_MEMORY_TO_PERIPH

;

hdma_i2s_ext_tx

.

Init

.

PeriphInc

=

DMA_PINC_DISABLE

;

hdma_i2s_ext_tx

.

Init

.

MemInc

=

DMA_MINC_ENABLE

;

hdma_i2s_ext_tx

.

Init

.

PeriphDataAlignment

DMA_PDATAALIGN_HALFWORD

;

hdma_i2s_ext_tx

.

Init

.

MemDataAlignment

=

DMA_MDATAALIGN_HALFWORD

;

hdma_i2s_ext_tx

.

Init

.

Mode

=

DMA_NORMAL

;

hdma_i2s_ext_tx

.

Init

.

Priority

=

DMA_PRIORITY_HIGH

;

hdma_i2s_ext_tx

.

Init

.

FIFOMode

=

DMA_FIFOMODE_ENABLE

;

hdma_i2s_ext_tx

.

Init

.

FIFOThreshold

=

DMA_FIFO_THRESHOLD_FULL

;

hdma_i2s_ext_tx

.

Init

.

MemBurst

=

DMA_MBURST_SINGLE

;

hdma_i2s_ext_tx

.

Init

.

PeriphBurst

=

DMA_PBURST_SINGLE

;

hdma_i2s_ext_tx

.

Instance

DMA1_Stream5

;

I was wondering is there any known issues with the I2S3 in extended mode? or Am I configuring it wrongly?

Thank you,

Raj

#i2s-dma-audio #i2s-i2s2ext
1 REPLY 1
Posted on November 22, 2017 at 10:44

However, the problem I am facing is I get distorted audio in only left channel.

What exactly do you mean by distorted audio?

I2S contains data for both channels in one stream of data, one data pin, and DMA is channel-agnostic, so it's quite unlikely the problem is here. Can't it be your primary data source? As an experiment, fill a buffer with a simple pattern - a square wave, or a simple triangle - and play it back repeatedly - does the problem still persist?

JW