SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By paw39
#178199
Hi everyone! :)
I try to receive data from UDA1380 chip(ADC/DAC) by I2S. Could you tell me if my config is ok? I still get interrrupt and only 000000.. appear in UART terminal :(
Code: Select all
/*
===============================================================================
 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_ModeConfig(LPC_I2S,&I2S_ClkConfig,I2S_TX_MODE);

	I2S_ModeConfig(LPC_I2S,&I2S_ClkConfig,I2S_RX_MODE);


	I2S_FreqConfig(LPC_I2S, 44100, I2S_TX_MODE);
	I2S_SetBitRate(LPC_I2S,0,I2S_RX_MODE);

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

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

	LPC_I2S->RXBITRATE = 0;
	LPC_I2S->RXRATE = 0;




	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");


}



I hope you can help because nobody could. Thanks in advance!
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]