LIS3MDL external compass not detected

I have a 3DR PX4 board. Following the instructions from here:

I am able to connect to it the external GPS + compass module from 3DR and calibrate it correctly on Mission Planner.

Now I try to use the LIS3MDL magnetometer as the external compass. The magnetometer is mounted on the STEVAL-MKI137V1 board, which has an I2C interface.

Unfortunately, the LIS3MDL is not detected by the PX4.

Firmware version I am using: APM:Copter V3.4.6

I am powering the magnetometer with 3.3V from an external source, and connecting the grounds of the source and Pixhawk together. I checked the wiring, and it seems to be ok.

This magnetometer seems to be supported in the firmware repo to be connected on the I2C:

Thanks a lot, any help will be appreciated

Hi Toni,

Several points:

  • your last link points to a file unrelated to ArduPilot
  • your first link points to a file in ArduPilot master (development) branch, not in the 3.4 one
  • with Copter 3.5 or even master we aren’t checking yet that a device using that driver is present externally (the driver is in tree but presently unused)

Hi Francisco,

thanks a lot for your reply. I have been digging into the code and now I understand what you mean. AP_Compass_LIS3MDL.h library doesn’t exist at master, and is desactivated at 3.5.

Do you have any idea if there are plans to support this magnetometer in the near future at the “stable” branch (or at least in “develop”)? I will also ask in the github forum about that.

Otherwise, could you please suggest which magnetometers are supported by Ardupilot connected to the I2C? I chose the LIS3MDL because, as far as I know, it was the only one that appeared in the repository that wasn’t deprecated. We are building a low-cost, accurate GNSS receiver for UAVs, and want it to have a compass as well, but we are having troubles choosing the right one.

Many thanks,

P.D: I removed already the silly link to PX4 repo, sorry about that!

I can’t give any timeline or anything, but I suppose we will support it since we already have the driver. We usually add drivers for sensors once there is some ArduPilot-compatible equipment using it - in this case there is a GPS from a partner that has one of this sensors but there is apparently a mistake in the datasheet and that is why it got disabled.

If you have the skills to do a custom build, it should be quite easy to enable this driver. Let me know if you don’t and I’ll try to do a custom build for you.

Oh there was no need to remove it, it is fine. But a lot of people confuse the two and I just wanted you to be aware that repository is now unrelated to ArduPilot.

I already did a custom build by uncommenting the couple of lines in libraries/AP_Compass/AP_Compass.cpp that were disabling the LIS3MDL (in Copter-3.5). But still, connecting it to Pixhawk with this firmware version doesn’t show anything in Mission Planner. I will conduct further investigations and share the results.

On the other hand, do you think you could share the name of the GPS device mounting the LIS3MDL on it?

Ok, finally I managed to do it! Had to uncomment as well the lines referring to HAL_MINIMIZE_FEATURES. Thanks a lot for the support!

It is written in the comment there :slight_smile:

Old topic, but looks the situation still same. Here’s one example device having LIS3MDL which is perfectly fine with some other flight stacks. Arducopter just needs special build. When enabling with Ardu, did you found any issues?