I am trying to read from gyro data on a bmi055 using an STM32F4. The gyro is on I2C2 and I have followed the example in testhal and pored over the troubleshooting guide but when I call i2cMasterTransmitTimeout() it always times out, and if I do just i2cMasterTransmit() it never returns.
Here is my setup:
Code: Select all
palSetPadMode(GPIOF, 1, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SCL */
palSetPadMode(GPIOF, 0, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); /* SDA */
i2cStart(&I2CD2, &i2cfg2);
with the config:
Code: Select all
/* I2C interface #2 */
static const I2CConfig i2cfg2 = {
OPMODE_I2C,
400000,
FAST_DUTY_CYCLE_2,
};I was previously implementing this with libopencm3 and I used 100KHz as the speed but when I use that here it just breaks.
Here is where I am doing the read:
Code: Select all
static uint8_t data_out[8]; // tx_buf
static uint8_t rx_buf[8];
static i2cflags_t errors = 0;
static const uint8_t id_register = 0x00;
#define bmi055_addr 0b1101001
systime_t tmo = MS2ST(500);
msg_t status;
// Query GYRO "CHIP_ID" register
data_out[0] = id_register;
i2cAcquireBus(&I2CD2);
status = i2cMasterTransmitTimeout(&I2CD2, bmi055_addr, data_out, 1, rx_buf, 1, tmo);
i2cReleaseBus(&I2CD2);
if (status != RDY_OK) {
if (status == RDY_RESET) {
errors = i2cGetErrors(&I2CD2);
}
if (status == RDY_TIMEOUT) {
_printf("Timeout occurred");
palTogglePad(GPIOA, 1);
}
}Do you see anything I'm doing inherently wrong here? Thank you in advance.