cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F400 and CS42L52 audio codec

rafael23
Associate II
Posted on April 16, 2013 at 13:09

Hi!

I have a big problem and need a lot of help. First of all I will try to explain the global situation and after that I will ask you for some questions.

I am working in a project. I have to make a full-duplex audio communication between a PC with Linux and the evaluation board ''Keil MCBSTM32F400''. They have to be connected throw Ethernet. The part of the PC is finished and now I have to implement the part of the evaluation board. The board has to take UDP packets (with PCM audio that was sended from the PC), playback the audio throw the speakers, capture audio throw the built-in MEMS microphone and send the captured audio within UDP packets.

My first step is to make work the speaker (reading a PCM audio file stored in the board memory). I have looked for examples of this board but there is any audio example. I was trying to use the examples for the ''STM32 Discovery'' board and ''STM3240G Eval'' but the problem is that the audio codec is not the same. My board has a CS42L52 audio codec while the other two boards have a CS43L22 auido codec. Both audio codecs are very similar.

I was trying to make some changes to let the examples work with my board but I have a problem with the reset function of the codec. In the example for the STM32 Discovery board, the reset is made using a GPIO pin:

    /* Audio Reset Pin definition */

#define AUDIO_RESET_GPIO_CLK           RCC_AHB1Periph_GPIOD 

#define AUDIO_RESET_PIN                GPIO_Pin_4   

#define AUDIO_RESET_GPIO               GPIOD

In the example for the STM3240G Eval board, the reset function is made using the IO expander and I am not sure what does it means and if I have (or may have) that in my board:

#include ''stm324xg_eval_ioe.h'' /* IOExpander driver is included in order to allow

                                   CS43L22 codec reset pin managment on the

                                   evaluation board */

Can someone help me? I am very frustrated. I have asked to the ARM support but they only have answered me that there is no GPIO pin dedicated to reset the audio codec and that maybe I have to use the I2C to make the reset... but how???

Thanks in advance!
15 REPLIES 15
Andrew Neil
Evangelist III
Posted on April 19, 2013 at 12:58

''how to reset the audio codec''

What does the CODEC datasheet say? 

''I think that the problem is not with the audio codec but with the interconection between it and the microcontroller''

What problem(s), exactly, do you see with that interconnection?

''If you know a forum where I can ask this kind of questions''

 

Have you looked on the CODEC manufacturer's website for support, examples, a forum...?

rafael23
Associate II
Posted on April 19, 2013 at 13:40

''What does the CODEC datasheet say?''

 

 

4.9 Recommended Power-up Sequence

1. Hold RESET low until the power supplies are stable.

 

2. Bring RESET high.

 

3. The default state of the PDN bit is ‘1’b. Load the desired register settings while keeping the PDN bit set to ‘1’b.

 

4. Load the required initialization settings listed in 

Section 4.11

.

 

5. Start MCLK to the appropriate frequency, as discussed in

Section 4.6

.

 

6. Set the PDN bit to ‘0’b.

 

7. Apply LRCK, SCLK, and SDIN for normal operation to begin.

 

8. Bring RESET low if the analog or digital supplies drop below the recommended operating condition to prevent power glitch related issues.

 

 

I don´t know how to hold RESET low and to bring RESET high because in the datasheet the RESET pin of the audio codec is taged as /RST, which is the same tag as, for example, the reset button of the board and every peripherals with a RESET pin.

How can I change the value of /RST, but only to reset the audio?

Andrew Neil
Evangelist III
Posted on April 19, 2013 at 14:04

''in the datasheet (sic?) the RESET pin of the audio codec is taged as /RST''

Do you mean, ''in the Keil MCBSTM32F400 board schematic...''

?

rafael23
Associate II
Posted on April 19, 2013 at 14:08

Yes, I mean in the schematics of the MCBSTM32F400 board

Andrew Neil
Evangelist III
Posted on April 19, 2013 at 14:24

Look at the description of the STM32F4's NRST pin in the RM0090 Reference Manual:

http://www.st.com/stonline/stappl/resourceSelector/app?page=fullResourceSelector&doctype=reference_manual&SeriesID=1577

rafael23
Associate II
Posted on May 07, 2013 at 13:13

Ok, now I could make the audio playback work (thanks a lot to Andreas Finkelmeyer) and also the ethernet. I would like to ''join'' both to reproduce the audio frames that comes through the Ethernet using UDP packets. I have tryed to do it using the DMA and also writing each audio packets directly when they arrives to the board, but there isn´t any sound. 

What should I know to make it work? Which are the important things that I have to be in mind?