STM32F407 Disc: Problem with I2C in MPU9205

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
nikhiledutech
Posts: 118
Joined: Wed Dec 27, 2017 8:52 am

STM32F407 Disc: Problem with I2C in MPU9205

Post by nikhiledutech » Fri Apr 20, 2018 6:34 am

Hello,

I have just started using this MPU9250 module from Peter Hinch. I have connected MPU9250 to I2C interface and used i2c.scan() it gives me [104, 119].

I am facing problem in the following line.

imu = MPU9250('1')

It throws an error of I2C(1) doesn't exist. But i can use I2C(1).

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: STM32F407 Disc: Problem with I2C in MPU9205

Post by pythoncoder » Fri Apr 20, 2018 9:54 am

The preferred way of using these drivers is to pass an initialised I2C object. This enables the bus to be shared with other devices.

If you do pass a string, the string is target-dependent. On a Pyboard it should be 'X' or 'Y' being the sides of a Pyboard but your target may expect something different. At the REPL learn how to instantiate an I2C. Then either do it in code and pass the I2C instance, or pass the string you used at the REPL and the driver will instantiate it for you.

I'm puzzled at the addresses you report. An MPU9250 should be on 104, 12 (the latter being the magnetometer). Your 119 suggests a different chip which won't work with this driver. You may be able to get accel and gyro measurements only by using the MPU6050 driver.
Peter Hinch
Index to my micropython libraries.

nikhiledutech
Posts: 118
Joined: Wed Dec 27, 2017 8:52 am

Re: STM32F407 Disc: Problem with I2C in MPU9250

Post by nikhiledutech » Mon Apr 23, 2018 8:45 am

Hey,

I have MPU-9250 at addr 0x68 and BMP280 at addr 0x77 (119) in my IMU10DOF module.
x = I2C(1, I2C.MASTER, baudrate = 115200)
imu = MPU9250(x)
it gives me error of Invalid I2C instance.
And from terminal if use x.scan it give me address of [104,119].


How to solve this issue ?

Post Reply