LPC4088 receiving data from UDA1380 using I2S

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC4088 receiving data from UDA1380 using I2S

883件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by paavo91 on Mon Dec 22 08:32:02 MST 2014
Hi!
I try to receive data from ADC in UDA1380 audio codec using I2S. I prepared UDA to receive audio from LINE IN, but I think I did somethng wrong in I2S config because I only get zeroes.

This is my code:

/*
===============================================================================
 Name        : kodek.c
 Author      : $(author)
 Version     :
 Copyright   : $(copyright)
 Description : main definition
===============================================================================
*/

#ifdef __USE_CMSIS
#include "LPC407x_8x.h"
#endif




#include "lpc_i2s.h"
#include "lpc_pinsel.h"
#include "uda1380.h"
#include "debug_frmwrk.h"



int main(void) {

debug_frmwrk_init();
int8_t ret;
I2S_MODEConf_Type I2S_ClkConfig;
I2S_CFG_Type I2S_ConfigStruct;

volatile uint32_t i;

PINSEL_ConfigPin(0,7,1); //TX
PINSEL_ConfigPin(0,8,1);
PINSEL_ConfigPin(0,9,1);
PINSEL_ConfigPin(0,23,2); //RX
PINSEL_ConfigPin(0,24,2);
PINSEL_ConfigPin(0,25,2);


PINSEL_ConfigPin(1,16,2); //MCLK

I2S_Init(LPC_I2S);


/* Audio Config*/
I2S_ConfigStruct.wordwidth = I2S_WORDWIDTH_16;
I2S_ConfigStruct.mono = I2S_STEREO;
I2S_ConfigStruct.stop = I2S_STOP_DISABLE;
I2S_ConfigStruct.reset = I2S_RESET_ENABLE;
I2S_ConfigStruct.ws_sel = I2S_MASTER_MODE;
I2S_ConfigStruct.mute = I2S_MUTE_DISABLE;
I2S_Config(LPC_I2S,I2S_TX_MODE,&I2S_ConfigStruct);

I2S_ConfigStruct.ws_sel = I2S_SLAVE_MODE;
I2S_Config(LPC_I2S,I2S_RX_MODE,&I2S_ConfigStruct);


/* Clock Mode Config*/
I2S_ClkConfig.clksel = I2S_CLKSEL_MCLK;
I2S_ClkConfig.fpin = I2S_4PIN_DISABLE;
//I2S_ClkConfig.mcena = I2S_MCLK_ENABLE;
I2S_ClkConfig.mcena = I2S_MCLK_DISABLE;
I2S_ModeConfig(LPC_I2S,&I2S_ClkConfig,I2S_TX_MODE);

I2S_ClkConfig.fpin = I2S_4PIN_ENABLE;

//I2S_ClkConfig.clksel = I2S_CLKSEL_MCLK;
//I2S_ClkConfig.mcena = I2S_MCLK_DISABLE;

I2S_ModeConfig(LPC_I2S,&I2S_ClkConfig,I2S_RX_MODE);


I2S_FreqConfig(LPC_I2S, 32000, I2S_TX_MODE);
//I2S_FreqConfig(LPC_I2S, 32000, I2S_RX_MODE);

I2S_Stop(LPC_I2S, I2S_TX_MODE);
I2S_Stop(LPC_I2S, I2S_RX_MODE);

I2S_IRQCmd(LPC_I2S,I2S_RX_MODE,ENABLE);//przerwanie przy odbiorze

LPC_I2S->RXBITRATE = 0;
LPC_I2S->RXRATE = 0;
I2S_SetBitRate(LPC_I2S,0,I2S_RX_MODE);



for(i = 0; i <0x1000000; i++); // delay


ret = Uda1380_Init(200000, 32000);
if(ret==0){
DEBUGOUT("Inicjalizacja kodek OK \r\n");
}else{
_DBD(ret);
}

for(i = 0; i <0x3000000; i++); // delay


    I2S_Start(LPC_I2S);

    NVIC_EnableIRQ(I2S_IRQn);

    while(1){

    }


    return 0;
}





void I2S_IRQHandler()
{

uint32_t input = LPC_I2S->RXFIFO;

_DBD32(input);
DEBUGOUT("\r\n");


}





Thanks

Original Attachment has been moved to: uda1380_1.c.zip

Original Attachment has been moved to: uda1380_0.h.zip

ラベル(1)
0 件の賞賛
返信
1 返信

572件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by paavo91 on Thu Jan 01 09:55:20 MST 2015
Nobody could help?
0 件の賞賛
返信