DSPRelated.com
Forums

Problem with I2C module in C5509A

Started by sm.h...@gmail.com November 2, 2009
Hi all
I want to use PCM1870 (an Audio ADC) for my project. Like other ADCs/Codecs, PCM1870 use the I2C bus to interface with ti DSPs to receive control commands.
There is some problem, after one day effort, I couldn't run the I2C peripheral on C5509A DSP!
here is my code:
-------------------------
#include
#include
#include
#include
#include

/* Create and initialize an I2C initialization structure */
I2C_Setup Init{
0, /* 7 bit address mode */
0x0000, /* own address - don't care if master */
200, /* Slow Peripherals (Mhz)*/
10, /* Transfer rate in kbps, 10-400*/
0, /* number of bits/byte to be received or transmitted (8)*/
0, /* DLB mode off*/
1 /* FREE mode of operation on*/
};
//--------------
int x=1;
int i=0;
Uint16 databyte[7]={0,5,10,11,12,13,14};

void delay(Uint32 k)
{
while(k--);
}
void main()
{
/* Initialize CSL library*/
CSL_init();

//Set Pll & Clock Out
PLL_setFreq(25,2); //200M with crystal frqM
CHIP_FSET(XBSR,CLKOUT,0);
CHIP_FSET(SYSR,CLKDIV,7);

//I2C Module Initialization
I2C_setup(&Init);
delay(100);
I2C_reset();

while(i++<1000)
{
x=I2C_write(databyte,7,1,0x50,1,30000);
printf("x=%d\n",x);
delay(1000);
}
while(1);
}
The value of x is always zero, that's means no error occurs! But there is no signal on both SDA and SCL pins.
Can anybody help me??
Thanks