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.

RTOS/LAUNCHXL-CC2650: I2C programming in using contiki

Part Number: LAUNCHXL-CC2650
Other Parts Discussed in Thread: BLE-STACK

Tool/software: TI-RTOS

Hi

I am using cc2650 Launchxl MCU and Contiki SW stack, so from this cc2650 I need to read  temperature sensor data using I2C communication

I am trying to use I2C functions that is there in i2c.c, i2c.h files inside driverlib folder

I have used some functions to read data but it is not communicating please anyone tell me what might be the problem 

int baseAddress = 0x4F;
int slaveAddres = 0x27;
bool bFast = true;
int rateclk = 400000;
bool breceive = true;

void fgt_i2c_init()
{

I2CMasterInitExpClk(baseAddress,rateclk,bFast);
I2CSlaveInit(baseAddress,slaveAddres);
I2CSlaveEnable(baseAddress);

}
void i2c_read_data()
{

uint32_t data;

I2CMasterControl(baseAddress, I2C_MASTER_CMD_SINGLE_RECEIVE);


I2CMasterSlaveAddrSet(baseAddress,slaveAddres,breceive);


uint32_t sstatus = I2CSlaveStatus(baseAddress);


if(sstatus==I2C_SLAVE_ACT_TREQ ) //master has requested a data 0x00000002
{
data = I2CSlaveDataGet(baseAddress);

printf("\nmessage from readF temp: %d",(unsigned int)data);
}


}

thank you

  • Hi Pavankumar,

    If this is a Contiki issue, you will have to try to get support from the Contiki forums:

    For an example of using I2C with the BLE-Stack, you can look at the SimpleLink Academy Bluetooth Low Energy + Sensors BoosterPack lab. This may provide you some guidance for your I2C/Contiki implementation:
    dev.ti.com/.../