Hi,
I'm working on the I2C1 for a LTC2945 component on the STM32F4 discovery board and I'm facing a similar issue.
You wrote that you modified the board.h file concerning the IC21, what did you modified to get it working ?
How can I ensure that I don't have 2 pins assigned to the same alternate function ? (eg. audio DAC)
For the moment I have this config (not working):
Code: Select all
const I2CConfig i2c1_cfg =
{
OPMODE_I2C,
400000,
STD_DUTY_CYCLE,
};
chThdSleepMilliseconds(50);
i2cStart(&I2CD1, &i2c1_cfg);
palSetPadMode(GPIOB, 8, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SCL */
palSetPadMode(GPIOB, 9, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SDA */
And here the part of the code for reading the desired register:
Code: Select all
msg_t status = RDY_OK;
systime_t timeout = MS2ST(50);
i2cflags_t error = 0;
uint8 buff_Tx_ui8 = 0;
uint8 buff_Sense_Rx_ui8[2] = {0,0};
uint8 buff_Volt_Rx_ui8[2] = {0,0};
uint16 dVSense_ui16 = 0;
buff_Tx_ui8 = LTC2945_DELTA_SENSE_MSB_REG;
i2cAcquireBus(&I2CD1);
status = i2cMasterTransmit(&I2CD1, LTC2945_ADDR, buff_Tx_ui8, 1, buff_Sense_Rx_ui8, 2);
i2cReleaseBus(&I2CD1);
if (status != RDY_OK)
{
error = i2cGetErrors(&I2CD1);
chprintf((BaseSequentialStream*) &SD3, "I2C1 DELTA_SENSE_MSB_REG error : %x \r\n", error);
}
And I get the following error code : I2CD_ACK_FAILURE 0x04
Thanks in advance
