Tool/software: Code Composer Studio
Hii,
I am trying to read humidity and temperature sensor data from cc350STK using sensor controller but the variable I2C_status shows always 1 and the output is zero always.
SCL = DIO6
SDA = DIO5
SCL frequency = 400 kHz
SCL stretch timeout = 10us
Below is the execution code of that.
U16 tem_resH = 0;
U16 tem_resL = 0;
U16 hum_resH = 0;
U16 hum_resL = 0;
//Humidity sensor configuration
i2cStart();
i2cTx((0x40<<1) | I2C_OP_WRITE);
i2cTx(0x02);
i2cTx(0x10);
i2cTx(0x00);
i2cStop();
fwDelayUs(100000, FW_DELAY_RANGE_100_MS);
//triggering measurment for temp 0x00
i2cStart();
i2cTx((0x40<<1) | I2C_OP_WRITE);
i2cTx(0x00);
i2cStop();
fwDelayUs(100000, FW_DELAY_RANGE_100_MS);
//if (state.i2cStatus == 0x0000) {
i2cStart();
i2cTx((0x40<<1) | I2C_OP_READ);
i2cRxAck(tem_resH);
i2cRxAck(tem_resL);
i2cRxAck(hum_resH);
i2cRxNack(hum_resL);
i2cStop();
//}
output.tempH = tem_resL;
output.tempL = tem_resH;
output.humH = hum_resH;
output.humL = hum_resL;
if(hum_resL > 0x00){
fwGenAlertInterrupt();
}
// Schedule the next execution
fwScheduleTask(1);