imxieyi / esp32-i2c-mpu6050

ESP32 I2C MPU6050 driver for esp-idf
31 stars 16 forks source link

Only two sensors on the same chip with different I2C port number??? #3

Open rtek1000 opened 6 years ago

rtek1000 commented 6 years ago

README.md ESP32 I2C MPU6050 driver for esp-idf

It uses hardware I2C port. So you can at most connect two sensors on the same chip with different I2C port number.

Datasheet says:

Auxiliary I2C Serial Interface The MPU-60X0 has an auxiliary I2C bus for communicating to an off-chip 3-Axis digital output magnetometer or other sensors. This bus has two operating modes:

  • I2C Master Mode: The MPU-60X0 acts as a master to any external sensors connected to the auxiliary I2C bus
  • Pass-Through Mode: The MPU-60X0 directly connects the primary and auxiliary I2C buses together, allowing the system processor to directly communicate with any external sensors.
imxieyi commented 6 years ago

Well... I just ported the code from the driver of another chip. ESP32 only has two hardware I2C ports. In theory one I2C master can connect to any number of I2C slaves as long as their addresses are different. Also, putting MPU6050 in master mode is also a idea worth trying.

rtek1000 commented 6 years ago

Yes, it would be great to have a library that can work with the auxiliary I2C port, although it is something simple I did not find any example of using this auxiliary port.

rtek1000 commented 6 years ago

Is there an example with the MPU operating with a DS3231 or DS1307?

The DS1307 has the same address as the MPU, so it is interesting to use the auxiliary I2C port.