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
Posted on April 16, 2013 at 13:28

ST maintains a list of consultants and contractors.

http://www.st.com/web/en/support/mcu_design_consultants.html

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rafael23
Associate II
Posted on April 16, 2013 at 13:39

Thank you so much for your quickly response. I will write an email to one of the spanish consultants :).

rafael23
Associate II
Posted on April 18, 2013 at 12:34

Hi,

I have sent a lot of emails to different consultants but none have answered...

I would like to ask something. I think that I am very close to let the audio of my board works. I am using the I2C example of the STM3240G board and trying to playback the file ''audio_sample.c''. I can use the buttons to play and stop the audio and I can see that, when tha audio is playing, I can listen some ''silent noise'' and when I stop the audio, the noise disappear. I don´t know the problem because of which I cant listen the music of the file ''audio_sample.c''. I´m not sure if the problem is still the ''RESET'' function of the codec because I haven´t do any change about that in the example.

Please, can someone try this example but making a change in the RESET function to ''break'' it and to test if you have the same problem that I have written (ear some noise but not the audi file). If you have a Discovery board, try to change the GPIO pin which reset the audio codec and try to listen the audio file.

Thank you in advance.

frankmeyer9
Associate II
Posted on April 18, 2013 at 14:37

I have sent a lot of emails to different consultants but none have answered...

 

This consultants usually earn their money that way, so they rarely give a free advice...

 ... I can listen some ''silent noise'' and when I stop the audio, the noise disappear.  ...

 

You noise is most probably generated by the audio codec, and come from layout issues, say, EMI. Can you quantify a SNR ?

Posted on April 18, 2013 at 17:04

Yeah, I guess if the first question wasn't ''What are your hourly rates?'', pretty much everything else would be filtered out.

In the current economy getting free technical assistance is going to be difficult unless your needs closely parallels those of others.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
rafael23
Associate II
Posted on April 19, 2013 at 09:58

Two consultants have answered today, but not with an answer. One of them was very nice telling me that he is no longer supporting STM but that he has forwarded my email to a friend that is still working on that :). The other consultant wants to have a telephone call. I will call him later.

Regarding to the question of the SNR... how can I quantify it? I don´t have an osciloscope or something like that. I only have my board and a lot of PC´s.

Edit: I have forgotten to ask you if is necessary to create the callbacks to let the sound works. I have only make changes in the LCD, buttons and leds and the GPIO pins of I2C and I2S. Should it works without callbacks? I am going on thinking that the first problem is with the audio codec reset, which I am not doing in the right way. Do you think that I am right? Do you have any idea of how can I reset the codec without a GPIO pin and without IOExpandor?

Thank you all for your time :)

frankmeyer9
Associate II
Posted on April 19, 2013 at 10:21

Regarding to the question of the SNR... how can I quantify it? I don´t have an osciloscope or something like that.

 

Either a good scope, or some other equipment to measure the noise level in relation to the signal.

I did not yet use that Cirrus audio DAC, but would make the following suggestion.

First, you could measure the noise with the CS42L52 muted (output off via I2C interface).

Then, measure the noise with the CS42L52 on, but a zero level input signal. I suspect some measurable noise here. And if you do a spectral analysis of that noise, I would not be surprised to find down-modulated core clock frequencies in the spectre.

BTW, you could use a PC soundcard for that purpose, there are several free soundcard-based ''Scope'' software packages around, including some advanced signal analysis capability.

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

Cross-Post:

http://www.keil.com/forum/21894/

Doesn't the CODEC manufacturer (Cirrus?) provide sample code?

''I have asked to the ARM support...''

It's not their job to teach you how to use this 3rd-party component.

If you bought a new car, would you expect the car dealer to teach you to drive?

You need to study the documentation (datasheet, app notes, examples, etc) for the CODEC to understand how it works, and how to ''drive'' it.

You need to study the schematics of your board to understand how the STM32 is connected to the CODEC.

http://www.8052.com/forum/read/160143

 

''is necessary to create the callbacks to let the sound works''

 

 

The CODEC neither knows nor cares what programming techniques (eg, ''callbacks'') you use in writing your source code;  all that matters is that it gets the appropriate stimuli - as defined in its datasheet.
rafael23
Associate II
Posted on April 19, 2013 at 12:38

I have studied the schematics and all the other documents related to my board. I don´t expect that nobody teach me how to use the board, I only have asked a concrete question about how to reset the audio codec because my audio codec is very similar to the CS43L22 and in the exaples of the CS43L22 codec, the reset function is made in a way that I cannot do with my board. I think that the problem is not with the audio codec but with the interconection between it and the microcontroller.

If you know a forum where I can ask this kind of questions (because nobody borns knowing microcontroller programming and maybe there is a forum where the people helps with that), please give me the link.