I encountered a very strange i2c behaviour in my project.

I use an Adafruit Feather M0 (3.3V) as i2c master and 3 slaves (MPU6050 Gyro Sensor, DS3231 RTC, M24C01WP EEPROM) schematic below

The EEPROM works flawless, the Gyro returns 0 on all existing registers and the RTC only works in minutes and seconds. Date and Hours are always returned wrong.

Due to the Adafruit Feather M0 and the standard Arduino library, the I2C bus runs on 3.3V with 100kHz. I used 1kOhm Pullups.

All the Datasheets tell that the devices are compatible with 3.3v and 100kHz. Also the 3 devices have different i2c addresses.

I built the device twice, so i dont think that the gyro or rtc are broken.

Again the devices respond to requests. Only the values are wrong.

MPU6050: https://www.invensense.com/wp-content/uploads/2015/02/MPU-6000-Datasheet1.pdf

DS3231: https://datasheets.maximintegrated.com/en/ds/DS3231.pdf

Edit: C1 is between 3V3 and Ground, NOT scl and data i2c bus

  • \$\begingroup\$ Addition to @Olin's answer, your mpu6050 returns 0 on all registers because You are not powering it up. Check USER_CNTL or similiar register's description in the register Map pdf for MPU6050, by default MPU6050 is always in sleep mode. \$\endgroup\$ – MaNyYaCk Jun 14 '17 at 12:44
  1. 1 kΩ pullup to 3.3 V is out of spec. The maximum required current to drive either line low is 3 mA.
  2. What the heck is C1 doing there!? That's going to mess up time constants, and couple edges from one line to the other. I can't even imagine what hallucinations led to doing this.
|improve this answer|||||
  • \$\begingroup\$ 1. Which pullup value do you suggest? 2. I messed up the schematic. C1 is a decoupling capacitor between 3V3 and Ground. Not between clock and data. Sorry for that \$\endgroup\$ – Canonip Jun 14 '17 at 13:10
  • \$\begingroup\$ 4.7K would be fine \$\endgroup\$ – MaNyYaCk Jun 14 '17 at 15:30
  • \$\begingroup\$ @Cano: 1.1 kOhms would be the minimum allowed value. I'd give it a little margin and use 1.2 kOhms. \$\endgroup\$ – Olin Lathrop Jun 14 '17 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.