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.

CCS/CC2650: Cannot obtain values for temperature and humidity using CC2650 launchpad with sensor SHT21 when calling func. I2C

Part Number: CC2650
Other Parts Discussed in Thread: HDC1000

Tool/software: Code Composer Studio

Hello, 

I've developed in CC2650 launchpad using project (SensorTag ).

and use ble_cc26xx_2_00_00_42893 version sdk.

C:\ti\simplelink\ble_cc26xx_2_00_00_42893\Components\ti-rtos\boards\sensortag\Devices\sensor_sht21.c

Pin assignment below,

SCL -> DIO6

SDA -> DIO5

Getting values for temperature and humidity using simple code named 'sensor_sht21.c'.
I called the function for getting values as below:

// Spi & I2c Enabled
bspI2cInit();

sensorSht21Init();

sensorSht21StartTempMeasure();
delay_ms(100);
sensorSht21LatchTempMeasure();
delay_ms(100);
sensorSht21StartHumMeasure();
delay_ms(100);
sensorSht21LatchHumMeasure();
delay_ms(100);
sensorSht21Read(&rawTemp, &rawHum);

Initial Setting:

void bspI2cInit(void)
{
Semaphore_Params semParamsMutex;

// Create protection semaphore
Semaphore_Params_init(&semParamsMutex);
semParamsMutex.mode = Semaphore_Mode_BINARY;
Semaphore_construct(&mutex, 1, &semParamsMutex);

// Reset the I2C controller
HapiResetPeripheral(PRCM_PERIPH_I2C0);

I2C_init();
I2C_Params_init(&i2cParams);
i2cParams.bitRate = I2C_100kHz;
i2cHandle = I2C_open(Board_I2C, &i2cParams);

// Initialise local variables
slaveAddr = 0xFF;
interface = BSP_I2C_INTERFACE_0;

if (i2cHandle == NULL)
{
Task_exit();
}
}

Unfortunately, it can't return the values, and I found a problem when tracing code

bool sensorSht21Init(void)
{
if (!SENSOR_SELECT())
return false;

// Set 11 bit resolution
success = sensorReadReg(SHT21_CMD_READ_U_R,&usr,1); // Always return false HERE
if (success)
{
usr &= USR_REG_RES_MASK;
usr |= USR_REG_11BITRES;
success = sensorWriteReg(SHT21_CMD_WRITE_U_R,&usr,1);
}
SENSOR_DESELECT();

return success;
}

I cannot get values for temperature and humidity when calling function I2C using CC2650 SensorTag.

Besides, tried to use a module HDC1000 when calling I2C, and it works.

Can you help me for cairlfy where is the problem?

Thank you very much!