-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mpu9250: fix mag spikes on fmu-v4pro #13353
Conversation
@Tony3dr please collect a log just on the bench like done in #13294 (comment) and check if the mag spikes are still happening. |
This should fix spikes in the mag data on MPU9250 found inside Drotek Pixhawk 3Pro. The problem turned out to be that we are not checking the DRDY bit before reading the data. We presumably threw away most of the stale data by doing a duplicate check, however, sometimes we might have run into a race where the mag data was already being updated in the chip while still being read.
90b4e02
to
994d609
Compare
Tested on Pixhawk v4pro |
This PR looks good, but separately I think we need to review that test vehicle. |
@dagar I could not reproduce the spikes that are plotted above, not sure how to do that. |
@julianoes These look like real data (the magnetic field actually changing) and affect multiple sensors on multiple buses synchronously. I suspect its the exact wiring / power setup of that vehicle that you need to create that. |
@LorenzMeier you're right. We already ruled out ESCs/motors because the noise was still present disarmed. |
This should fix spikes in the mag data on MPU9250 found inside Drotek Pixhawk 3Pro.
The problem turned out to be that we are not checking the DRDY bit before reading the data. We presumably threw away most of the stale data by doing a duplicate check, however, sometimes we might have run into a race where the mag data was already being updated in the chip while
still being read.
Before merging we should make sure this doesn't break other boards or external GPS/mag with MPU9250.
This was the spikes I could see:
![Selection_066](https://user-images.githubusercontent.com/1419688/68040318-6802fe80-fcce-11e9-829a-3e977481ccfb.png)
I'm not sure if this is related to the mag values seen in this log:
https://review.px4.io/plot_app?log=49829594-e88e-4f85-8740-6b2f7bf87c47&fbclid=IwAR1vs4sYoGntIlDX6kiA_58IYzI2y26o6n-Zo_7NfdaaunZl9lXonkU9zls