Page 1 of 1

[SOLVED]I2C2 issue

Posted: Sun Dec 01, 2013 7:49 am
by wwfiney
Hi,
I'm developing a mini quadcopter using crazyflie firmware.
The hardware is same:
CPU: STM32F103CB
Sensor: MPU6050

The FreeRTOS is working and I can run LED sequence normally.
Motor PWM driver is working.

But MPU6050 I2C communication driver has some issue. (I have used GPIO to simulate I2C and can get right data, so the HW is OK)
My MPU6050 is connected to I2C2(PB10, PB11) which is different from crazyflie orginal design. And AD0 is connected to GND.
So I modify function "imu6Init":

Code: Select all

i2cdevInit(I2C2);
mpu6050Init(I2C2);
And function "mpu6050Init":

Code: Select all

devAddr = MPU6050_ADDRESS_AD0_LOW;
The issue is I2C2 can not get any valid data from MPU6050. "mpu6050GetDeviceID" get all 0

So anyone know if the I2C2 driver in crazyflie firmware can work? And if I omit someting to config?

HMC5883 and MS5661 are removed from the code.

Code: Select all

//#define IMU_ENABLE_MAG_HMC5883
//#define IMU_ENABLE_PRESSURE_MS5611
//#define IMU_MPU6050_DLPF_256HZ

Code: Select all

mpu6050SetI2CBypassEnabled(FALSE);
Thanks.


--------------------------------------------------------------------------
I2C2 driver not ready in source code:
1 Add I2C2 event interrupt handler
2 Add Handler to ISR
3 Init I2C2 event interrupt

Re: I2C2 issue

Posted: Tue Dec 03, 2013 8:12 am
by marcus
Hi,

The problem might be that some code is missing from the I2C2 implementation. If you have a look in the i2croutines.c file there's some implementation that is there for I2C1 but not for I2C2.

Re: I2C2 issue

Posted: Tue Dec 03, 2013 9:14 am
by wwfiney
marcus wrote:Hi,

The problem might be that some code is missing from the I2C2 implementation. If you have a look in the i2croutines.c file there's some implementation that is there for I2C1 but not for I2C2.
thanks marcus, I'll debug it.

I found that there was even no I2C2 interrupt handler. lol