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/CC2640R2F: SensorI2C with custom board

Part Number: CC2640R2F

Tool/software: Code Composer Studio

Hi,

I would like to interface the BQ32002DR (RTC) with CC2640R2F. I try to use the SensorI2C.h. 

I write:

SensorI2C_open();
SensorI2C_select(0, 0xD0);

the SensorI2C_select is ok, if I modify the code with:

if(SensorI2C_select(1, 0xD0)){

System_printf("true\n");
System_flush();


} else {


System_printf("false\n");
System_flush();


}

I get true on console.

but the instructions: 

SensorI2C_writeReg or SensorI2C_readReg return false.

Can I modify the instructions in SensorI2C.h to adapt them my purposes?

Are there other function that allow a good and easy interfacing or have I to do them?

Thanks.

Best regards.

Giuseppe

  • Hello Giuseppe_pe,

    I looked at the source for this sensorI2C file, and from what I see it should work. Things that might be worth checking would be,

    Is the sensor powered on?
    Is that the correct address of the sensor?

    If after checking this, you cannot make it work, you can use the I2C driver instead of the sensorI2C driver.

    Regards,
    AB
  • Hi,
    Yes, the sensor is power on.
    I set the address to 0xD0 as it is write on the datasheet.

    Thanks.
    Giuseppe
  • I noticed that in the "SensorI2C_select(1, 0xD0)" where the 0xD0 is the slave address I write "SensorI2C_select(1, 0xYY)" , where 0xYY is random,
    the result is success anyway.
    I don't know why.

    Best regards.
    Giuseppe
  • Hi,
    ok, I solved.
    The slave address is 0x68. On the datasheet there is write:
    11010000 if write mode
    or 11010001 if read mode
    but with the function in the SensorI2C I use "7 bits address" with SensorI2C_select.
    Best regards.
    Giuseppe