AnsweredAssumed Answered

capture and play sound by STM32F407 and Codec

Question asked by talebpour.nima on Mar 1, 2017

Hi.

I designed a PCB to use stm32f407 and TLV320AIC12 codec for capturing and playing sound.

As you can see I connected I2S pin of stm to tlv in this way:

 

STM32F407                   TLV320AIC12

CK---------------------------->SCLK

WS--------------------------->FS

ext_SD---------------------->Dout

SD---------------------------->Din

MCK-------------------------->MCLK

and also I connected INP to microphone and OUTP1 to speaker.

 

I used stmcube software for configure my application, so I wrote my code in the following format and started speaking in microphone but I could not hear any voice from speaker.

I do not have any idea why it is not working.

thank you for guiding me in advance.

//*******************************************************************

        MX_I2S2_Init();


        uint8_t CnvRx[50];
        uint16_t Txbuff[5];
        uint16_t Rxbuff[5];
        while(1)
        {
            Txbuff[0]=Rxbuff[0]; //DAC input data
            Txbuff[1]=0x0000;
            HAL_I2SEx_TransmitReceive(&hi2s2,Txbuff,Rxbuff,2,100);
            sprintf((char*)CnvRx,"%04X,%04X\n",Rxbuff[0],Rxbuff[1]);
            Debugger_Send_Data(CnvRx);//send data out by uart
        }

 

 DebuggerOutput:

000F,0000
0010,0000
000D,8000
000E,0000
000E,8000

//*******************************************************************

Outcomes