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.

CC1350STK: Unable to access data of onboard Light sensor OPT3001, I2C using Sensor Controller

Part Number: CC1350STK

Hi

I am trying to read the LIGHT SENSOR data from CC1350STK using Sensor Controller but the variable I2C_status shows 1 always and the output is zero always. The execution code is as follows:

SCL = DIO6
SDA = DIO5

SCL frequency = 400 kHz
SCL stretch timeout = 10us

U16 value = 0;

//Partial write operation to set address of slave register from which the data has to be read. Slave address = 0X45. Left shifted slave address = 1000101 << 1 = 0001011 = A. Slave register address to read data from = 0X00.

i2cStart();

i2cTx(0xA | I2C_OP_WRITE);

i2cTx(0x00);

i2cStop();

fwDelayUs(100000, FW_DELAY_RANGE_100_MS);

// If successful ...

if (state.i2cStatus == 0x0000) {

// Read register values

i2cRepeatedStart();

i2cTx(0xA | I2C_OP_READ);

i2cRxNack(value);

}

i2cStop();

output.lux = value;

if(value > 500){

state.threshold = 1;

fwGenAlertInterrupt();

}

// Schedule the next execution

fwScheduleTask(1);

It would be highly appreciated if anyone can provide help regarding the same.

Thanks