I’ve recently been trying to add a compass to my flight controller, and am having some issues with it not being read/found by Ardupilot. I’m using the FC and GPS/Compass module listed in the post description and have tried all the configuration options in the parameters that I can think would affect this, as well as the physical connections to the flight controller, but nothing seems to be working. Can anyone help me figure this out? Much appreciated!
Matek F405 - SE Compass Issue.param (18.3 KB)
Logfile with LOG_DISARMED set to Enabled (1)
9 12-31-1979 5-00-00 PM.bin (344 KB)
Photo of Wiring - wires on RH side of photo with same color correspondence as the diagram from Matek’s site found below.
Is the LED beside the front arrow coming on when you power it up?
How are you powering the board? Some of the Mateks will only power the 5v from a battery, not USB.
I can’t remember which LED came on, but I know it was lit up red, and you’re right, it wouldn’t power up without lipo/battery power applied, so I was using that, but the weird thing was the GPS was working and even seemed to be getting a decent fix indoors. But the compass just did nothing, like there wasn’t even one connected in Mission Planner. None appear on the compass calibration page. I’m befuddled.
There’s no COMPASS_DEV_ID in that parameter file, so the board isn’t even seeing it. To me that says wire problem or there’s an issue with the M8Q-5883. Have you got another you can test fit in there to see if it shows up?
Tested an identical GPS/Compass module, and the same behavior appears. All I can think of now is the wiring. I had a friend point out that in the Matek documentation it is labeled that the SDA on the GPS should go to DA2, and the SCL should go to CL2. I have these attached to DA1 and CL1 respectively, but the way I understood i2c bus was that it should not matter which pads, if they’re all on the same bus. Am I incorrect here? Or perhaps only one set of the i2c pads was defined in the hwdef for this board? I’m not sure how to tell on the hwdef ardupilot/hwdef.dat at master · ArduPilot/ardupilot · GitHub
Here’s a long shot: I notice you have COMPASS_EXTERN2 and …EXTERN3 both set to 1. Maybe set those back to 0. Also COMPASS_USE2 and …USE3, should go back to 0.
If that doesn’t work then maybe try moving to CL2/DA2, but I would have said that doesn’t matter.
I tried changing the parameters you mentioned, but no luck. So I finally just tried the CL2/DA2, and bingo - worked like a charm. I don’t really understand this. I would think it was something in the hwdef, but then why would Matek have it in their general documentation photo going to CL2/DA2…they don’t really give an explanation for this that I can find. I do with the CL1/DA1 would work - physically is makes a lot more sense on that side for my build.
Follow on question though - if I want to connect more i2c devices to this board in addition to the compass, I should be able to splice out of the CL2/DA2 additional connectors for other hardware because it functions as a bus, correct?
Wow, I’m glad you got it working but I’m confused by the fix. Like you, I didn’t think it would matter and I find it hard to believe that I’ve got it right every time because I’ve never run into this.
DId you notice if you had any barometer errors when the compass was connected to CL1/DA1?
Well, I’m going to eat my words here, because getting the compass recognized does not seem to be repeatable in any fashion. I have two of the MQ8’s and have been testing them to see if it’s a hardware issue. But during the course of switching the MQ8’s as well as continuing to try the CL1/DA1 pads along with the CL2/DA2 pads, I’ve only gotten the compass recognized maybe 3 times out of at least 2 dozen power cycles. It either continues to not find any compasses attached, or it only finds that I have a compass that is missing and gives me the warning “compass configuration has changed” in Mission Planner. If I remove the missing compass and reboot, it then continues to find a missing compass until I changed the COMPASS_PRIO1_ID to 0 at which point it stopped finding the missing compass, but now does not find any compasses. I’m at a loss here, I know this should be much more straightforward.
I didn’t notice any barometer errors with connection made to CL1/DA1, but I wasn’t paying any attention to that at the time. What would that look like? Large swings in altitude on the HUD? Do you think that would have something to do with the compass issue?
I don’t like the fact it’s intermittent. That’s not a good sign. Is that the wire harness that came with the GPS module? Can you swap out the entire harness?
It’s funny you mention that because I just finished testing one of the MQ8’s I’ve been using with a different F405 - SE and a different wiring harness that I haven’t used yet. I tried CL2/DA2 first, worked! I tried CL1/DA1 and it WORKED!
So then I moved this same MQ8 and harness back to the original MATEK F405-SE, and it worked as well on CL1/DA1. I can’t believe it. I tried the other MQ8 with the same harness and it also worked.
I feel rather foolish, as it comes down to the hardware (again). I was very confident in my soldering, or else I wouldn’t have jumped on the forum in the first place. I could’ve still goofed up there, or maybe QA missed a defect in the harness from the factory? I did braid the wiring harness that seems to be causing the issue, and didn’t braid the one that was working - I wonder if I caused some bad interference by doing that.
I guess I did learn a lot more about the COMPASS params from this adventure, if there was anything else to be gained besides a healthy reminder to check the hardware first.
Thanks so much for your time and trouble on this, @Allister. I sure appreciate it, and apologize for the wild goose chase.