Issues in using MPU9250 with Fusion in async method

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
nikhiledutech
Posts: 117
Joined: Wed Dec 27, 2017 8:52 am

Issues in using MPU9250 with Fusion in async method

Post by nikhiledutech » Mon Apr 30, 2018 11:19 am

Hey,

I am using async method to display data of roll, pitch, heading on LCD. Currently the Fusion module is created using MPU9150. I have used fusion.py in sync method with MPU9250 and it works fine.

But in async method, it gives me error of MPU9250 don't have mag_trigger. In 9150, mag_reading is used Initiate a mag reading.


So what if i replace mag_reading with "" imu.mag.xyz "".

Code: Select all

async def read_coro():
    imu.mag.xyz
    await asyncio.sleep_ms(20)  # Plenty of time for mag to be ready
    return imu.accel.xyz, imu.gyro.xyz, imu.mag.xyz



When i replace the above code, it give me data but its not getting updated after one reading.

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

Re: Issues in using MPU9250 with Fusion in async method

Post by pythoncoder » Tue May 01, 2018 9:40 am

The two chips are different. The MPU9250 takes readings continuously so the driver for it doesn't need a mag_trigger function. The older MPU9150 needs to be triggered to take a reading. So you must use the right driver for the chip in use.

From your description it's not clear what is causing this error. It would help if you gave code and the exact error message you're getting.
Peter Hinch

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

Re: Issues in using MPU9250 with Fusion in async method

Post by nikhiledutech » Tue May 01, 2018 9:55 am

Sorry was using wrong driver file. :oops:

Post Reply