i2c hitting debug panic
Posted: Wed Mar 05, 2014 5:29 pm
Trying to read register from LIS3DH Accelerometer, and the code keeps hitting this Assert, where i2ccp->state is I2C_LOCKED ?
Device is a STM32F417IGH6
chDbgAssert(i2cp->state == I2C_READY,
"i2cMasterTransmitTimeout(), #1", "not ready");
Device is a STM32F417IGH6
chDbgAssert(i2cp->state == I2C_READY,
"i2cMasterTransmitTimeout(), #1", "not ready");
Code: Select all
/*
* I2C Config
*/
static const I2CConfig acccfg = {
OPMODE_I2C,
400000,
FAST_DUTY_CYCLE_2,
};
while(TRUE)
{
chThdSleepMilliseconds(500);
txbuf[0] = 0x0F; // who am i reg, its fixed at 0x33;
i2cAcquireBus(&I2CD1);
status = i2cMasterTransmitTimeout(&I2CD1, 0x18, txbuf, 1, rxbuf, 2, tmo);
i2cReleaseBus(&I2CD1);
if(status == RDY_OK)
{
chprintf((BaseSequentialStream*)&SD6, "0x%.2X", rxbuf[0]);
}
}