Other Parts Discussed in Thread: HDC1080
Dear experts,
I was using a patched version of the I2CMSP432E4 driver for a while, see related post .
Now I thought it is on the time to upgrade to SimpleLink 4.10. But I have trouble with the new driver and need help.
We have a HDC1080 connected to the MSP432E411Y via a connector. This connection might get disconnected and connected again. The I2C communication should recover after reconnection and it did with the patched driver. With the new driver I get a strange behavior:
- Start uC with Sensor connected -> transmission status 0 -> OK
- disconnect sensor -> transmission status -1
- reconnect sensor -> transmission status -8
I can repeat steps 2 and 3 multiple times and status is reproducible, but not OK.
Then I set a break point in line 963 of I2CMSP432E4 .c. (I copied I2C.c and I2CMSP432E4 .c into my project to get debugging information.)
I step trough the code while the sensor is connected (key F6). The return value and transmission status become 0 -> OK.
I let the program run again. Now it works fine:
- disconnect sensor -> transmission status -5
- reconnect sensor -> transmission status 0
I can repeat steps 1 and 2 multiple times and status is reproducible and OK.
I use the following code to open the dirver:
I2C_Params i2cParams; I2C_Params_init(&i2cParams); i2cParams.transferMode = I2C_MODE_BLOCKING; i2cParams.bitRate = I2C_100kHz; /* check I2C for being open already - * I2C already might got opened by another HAL module, e.g. * BOARD_LHC04_I2C8 by expansion board or MAC address storage driver */ I2C_SENSOR_ASSERT(i2cIdx < I2C_count); I2CMSP432E4_Object *i2cObjPtr = I2C_config[i2cIdx].object; if (i2cObjPtr->isOpen) { objPtr->i2cHandle = (I2C_Handle)&(I2C_config[i2cIdx]); /* check for right settings */ I2C_SENSOR_ASSERT(i2cObjPtr->transferMode == i2cParams.transferMode); I2C_SENSOR_ASSERT(i2cObjPtr->bitRate == i2cParams.bitRate); } else { // I2C_open clears AMSEL bit via GPIOPadConfigSet(), thus no more ADC input objPtr->i2cHandle = I2C_open(i2cIdx, &i2cParams); } I2C_SENSOR_ASSERT(objPtr->i2cHandle != NULL);
The code to transmit data:
static bool HDC1080config(I2C_SensorObject *self) { /* configure HDC1080 for combined temperature and humidity measurement, 14bit resolution each */ uint8_t writeBuffer[] = { HDC_CONFIG, // write to HDC1080 configuration register (setting of pointer register) 0x10, 0x00 // MSB first, bit 12 = 1 only: combined temperature and humidity measurement, high precision }; // I2C_Transaction i2cTransaction; // i2cTransaction.slaveAddress = I2C_ADR_HDC1080; // i2cTransaction.writeBuf = writeBuffer; // i2cTransaction.writeCount = sizeof(writeBuffer); // i2cTransaction.readBuf = NULL; // i2cTransaction.readCount = 0; // return (I2C_transfer(self->i2cHandle, &i2cTransaction)); self->i2cTransaction.slaveAddress = I2C_ADR_HDC1080; self->i2cTransaction.writeBuf = writeBuffer; self->i2cTransaction.writeCount = sizeof(writeBuffer); self->i2cTransaction.readBuf = NULL; self->i2cTransaction.readCount = 0; self->i2cTransaction.status = I2C_STATUS_SUCCESS; return (I2C_transfer(self->i2cHandle, &(self->i2cTransaction))); }
Could you try to reproduce the issue and solve it?