cancel
Showing results for 
Search instead for 
Did you mean: 

Help with i2s configuration

silent
Associate II
Posted on April 02, 2014 at 12:05

hello everyone

i have adc ad1877, configured as in picture

0690X000006056mQAA.png

How i should configure i2s in stm32f4 ? I have tried this one 

  I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq_32k;

  I2S_InitStructure.I2S_Standard = I2S_Standard_PCMShort;

  I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Enable;

  I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low;

  I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_32b;

  I2S_InitStructure.I2S_Mode = I2S_Mode_MasterRx;

also tried few others configurations but with no luck.

Sometimes if i manually reset few times adc it works. Maybe it must be special logic of reseting this adc?

#i2s #stm32 #dma
14 REPLIES 14
Posted on April 02, 2014 at 12:30

The AD1877 is not crystal clear and I am not going to study it in depth, but I'd say you should use a standard I2S mode rather than PCM mode on the STM32 side (the datasheet says, that the mode displayed in Fig.16 occurs if LRCK is high for between one to 16 BCLK periods).

I assume you made sure you are in 256-CLKIN mode and you are aware of all gotchas of interfacing the STM32 to a 5V device.

JW

silent
Associate II
Posted on April 02, 2014 at 12:45

What do you mean not crystal clear? Which adc you would recommend?

Posted on April 02, 2014 at 13:20

Whooops, sorry, I meant to write, the datasheet is not crystal clear (in that there are too many modes to understand it thoroughly just by quickly skimming the datasheet).

Nevertheless, it's clear that the ADC transmits 32-bit frames, whereas the I2S module in STM32 when set to PCM mode can receive only 16-bits per frame (even if set to the long 32-bit frames). That's why said you should start with setting it to standard Philips I2S mode.

JW

silent
Associate II
Posted on April 02, 2014 at 13:34

I tried phillips standard but had the same trouble.

I agree - datasheet is not clear )
Posted on April 02, 2014 at 14:29

It's time to connect an oscilloscope to the lines, then...

JW

silent
Associate II
Posted on April 02, 2014 at 14:46

I dont have oscilloscope (

But what theoretically it could be? As i said when manually few times reset adc (but not always works) the sound appears (i putted it directly to dac) but with clicks approximately every second

Posted on April 02, 2014 at 15:05

> I dont have oscilloscope (

I understand, but it's quite indispensable in this kind of work. Try to borrow one, or find somebody who would let you to use his. You could also try to use a cheap devboard like the DISCOVERY as a replacement for logic analyzer, but it might result in misleading results if the problem is somewhere in the ''analog'' side, e.g. 3V/5V incompatibilities, power supply related problems etc.

> But what theoretically it could be?

Anything. Power supply/inadequate decopling/grounding related problems, 3V/5V interfacing problems, nuances in the protocol/timing...

JW

silent
Associate II
Posted on April 04, 2014 at 10:37

Checked and rechecked everything, tried all configurations, and nothing. I don't belive that oscilloscope will help me, even i will see some contradiction  - i don't see the way to fix it.

silent
Associate II
Posted on April 04, 2014 at 15:15

Great, now my stm32f4discovery is dead...