Part Number: CC3220
Hi,
I am trying to interface and access HDC1080 sensor to my CC3220MODASlaunchpad.
I am done with reading the read only registers like manufacturer Id and Device Id with out issue.
The same I am repeating to read the Temperature sensor from address 0x00 and getting the I2C Bus Fault.
As per data sheet of My HDC1080 sensor (attached), the dealy of 6.5ms is need to read the data after write. So I am looking enter the delay between command code write and data read from My Slave. I am not getting the pointer function calling in the I2C.h of "i2ctmp006 example project from SDK2.3"
Pleas any one help me resolve my issue, as of my knowledge I need to enter delay before read. Please see the attached data sheet and the my code below:
txBuffer[0] = 0x00; i2cTransaction.slaveAddress = 0x40; i2cTransaction.writeBuf = txBuffer; i2cTransaction.writeCount = 1; i2cTransaction.readBuf = rxBuffer; i2cTransaction.readCount = 2; while(1){ if (I2C_transfer(i2c, &i2cTransaction)) { temperature = rxBuffer[0]; temperature = (temperature << 8)|rxBuffer[1]; float newtemperature = (((float)temperature/65536) * 165)-40; Display_printf(display, 0, 0, "Temperature = %f ('C)\n", newtemperature); } else { Display_printf(display, 0, 0, "I2C Bus fault\n"); } /* Sleep for 5 second */ sleep(5); } /* Deinitialized I2C */ I2C_close(i2c); Display_printf(display, 0, 0, "I2C closed!\n"); return (0);
Please let me know what is happening here:
/*! * @brief A function pointer to a driver-specific implementation of * I2C_transfer(). */ typedef bool (*I2C_TransferFxn) (I2C_Handle handle, I2C_Transaction *transaction);
Thank you