This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541: Problem with I2C interfacing with ads7828

Part Number: CC2541
Other Parts Discussed in Thread: ADS7828

Hi

I am trying to interface cc2541 with ads7828 using i2c interface and receive data on mobile using BLE.
However, I am receiving constant data as 0x00 or 0xFF.

Below is the code used by me:

--------------------------------------------------------------------------------------------------------------------------------------------

void i2c_start()
{
I2CCFG &=~I2C_SI;
I2CCFG |=I2C_STA;
while((I2CCFG&I2C_SI)==0);
I2CCFG &=~I2C_STA;
}

void i2c_stop()
{
I2CCFG &=I2C_STO;
I2CCFG |=~I2C_SI;
while((I2CCFG&I2C_STO)!=0);
}

void i2c_send(unsigned int x)
{
I2CDATA = x;
I2CCFG &= ~I2C_SI;
while ((I2CCFG & I2C_SI) == 0);
}

unsigned int i2c_read()
{
I2CCFG &= ~I2C_SI;
while ((I2CCFG & I2C_SI) == 0);
return I2CDATA;

}

void i2c_init()
{
//I2CCFG=0x45;
I2CWC = 0x00;
I2CCFG |= (I2C_ENS1 | I2C_AA);

}

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

static void performPeriodicTask( void )
{

uint8 count;
uint8 addr = 0x49;
uint8 command= 0x84;

i2c_init();
i2c_start();

if(I2CSTAT == 0x08)

{
i2c_send(addr);
}

i2c_send(command);

count = i2c_read();

i2c_stop();

SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR4, sizeof(uint8), &count);

}

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

please help me with it.