cancel
Showing results for 
Search instead for 
Did you mean: 

MAX9853 Audio Codec

repzak
Associate II
Posted on February 12, 2010 at 20:25

MAX9853 Audio Codec

11 REPLIES 11
chikos332
Associate II
Posted on May 17, 2011 at 13:40

Hi Kasper,

On STM32, the MCLK frequency is equal to 256xFs (where Fs is the audio frequency, ie.48KHz, 44.1 KHz, 16KHz ...) so if your audio frequency is 48KHz you will have 12.288 MHz on MCLK....

The codec you chose, is requiring, in slave mode, that MCLK is fixed to 13MHz or 26MHz. With STM32 the best case for you will be to generate 48KHz frequency with 12.288MHz MCLK frequency (which is not really good!!).

Now, you can choose to run your codec in master mode (in this case you will need to use an external oscilator/quartz of 13/26 MHz for the codec) and use the STM32 I2S in slave mode. but I personally don't really advise you this option.

Many other codecs run with the rule of MCLK = 256xFs, I advise you to look for such codecs... it is much more flexible and secure...

I personally tried the CS43L22 provided on STM32 board and it looked good for me (of course it depends on your requirements...).

repzak
Associate II
Posted on May 17, 2011 at 13:40

Hello,

If i remember correctly the pin i am using for MCLK is also a timer output.

Would thata work to use a hardware timer in the STM32 to generate the 13Mhz?

What i like very much for this codec is the 2x data channels and the Line-in which can be routed to the output.

Kasper

repzak
Associate II
Posted on May 17, 2011 at 13:40

Hello,

Maybe this is a better choice...

http://www.analog.com/static/imported-files/data_sheets/ADAU1361.pdf

I also need the differential output..

Kasper

Posted on May 17, 2011 at 13:40

Hi Kasper,

 TI has a very wide selection of audio codecs 

http://focus.ti.com/paramsearch/docs/parametricsearch.tsp?family=analog&familyId=583&uiTemplateId=NODE_STRY_PGE_T&familyAliasId=1100583

Long time ago I have used one of them, and today there are even better ones

http://www.circuitcellar.com/library/print/0906/Szymanski194/index.htm

 

good luck

Jan

chikos332
Associate II
Posted on May 17, 2011 at 13:40

Hi,

If I understood correctly, you want to use the TIMER to generate the 13MHz clock on MCLK pin?

Well, it could be a clever idea, but don't forget that you will have to synchronize the TIM output with the I2S data transmission/reception... which is (in my opinion) quite complicated...unless you have some clue?

Anyway, I don't think it will be a wise choice, it may generate lots of issues without being really efficent...

bestvirut
Associate II
Posted on May 17, 2011 at 13:40

I also play with MAX9851 with STM32F103Z by using I2S3,

I think it's not easy to setup because I cannot find any example source code for this codec. Now I can setup it using I2C and it seems that analog part is not ready when I use external MCLK clock.

(Bit7 of status reg 0x01 is not set). I think because my oscillator is 0.8V P2P but MCLK is digital signal that require Vih and Vio at proper level. PWM of stm32 cannot generate exactly 13MHz or 26MHz and unfortunately I2S3 MCLK pin for me is routed to other function not MCLK so I also cannot generate 12.228MHz for 48K signal. When I read datasheet of MAX9851-9853 I think that if we can input MCLK 13 or 26 MHz we can operate this codec both in master and slave mode. So we can use STM32 as I2S master and generate bit clock and ws(left,right) signal include feeding data stream. There is no need to sync timer MCLK with I2S data transmission and reception but maybe I'm wrong. Anyway, this codec is more difficult than few codec I used before.

repzak
Associate II
Posted on May 17, 2011 at 13:40

Hello,

In the datasheet it says somewhere that when you use ADC or DAC you must supply 13Mhz or 26Mhz in order to let the sigma-delta converter operate.

So you can only skip this signal if you runt line-in to line-out and then there is not much purpose in haveing the codec.

Maybe if you use 12.xx your sound will be slower and some samples will be failing...

I will change to the Analog part i sent the datasheet for, i am only doing my PCB at the moment.

Kasper

bestvirut
Associate II
Posted on May 17, 2011 at 13:40

I will try to play with it for 1-2 days if I can find new oscillator or generate MCLK signal correctly. My PCB designed both I2S codec and SpeedX voice codec, and luckyly my application need not to play stereo, so only speech is enough. I think may be external mp3 chip is more easier and cheaper than I2S codec + expensive small oscillator. The WAV file is very big, if you use ADPCM it's 4 times smaller, however we need to parse these files header and setup codec including I2S. Some mp3 chip just open file and feed all data to play.

repzak
Associate II
Posted on May 17, 2011 at 13:40

Hello,

I will use a software MP3 lib, i all ready have this up running in Primer II, you can look at my project on that page.

I think it will use 80-90% of the current speed of stm32 (72Mhz) for reading SD card and decode and playback (320kbit), it uses some more in the primer for circle os overhead.

Why can the timer nog generate 13Mhz precise? i think you both can turn at the input prescaler and the counter value??