MMC5983MA compass not getting detected

Hi everyone

I am trying to use a external compass with arducopter but it is not getting detected.
This compass is connected to the i2c bus of the pixhawk 2.4.8

This is the third compass on the vehicle, and the second compass is connected to the same i2c bus.

Both sensors have their sda and scl connected in parallel.

The compass is mmc5983ma on a breakout board. This board is getting power and led turns on.

I have flashed a custom build including this compass model (mmc5xx3) for copter 4.6.3

It doesn’t appear in the hw id tab and neither in the compass tab.

Please help
Thank you

Have you checked that both devices have different addresses?

Thank you for your response

Both devices have different addresses.

The hmc5883 compass has decimal 30 address, and still works.

The mmc5983ma has hex 0x30 which is decimal 48

This is further verified by the hmc5883 still working and getting detected normally

I have also tested swapping the sda and scl of the compass module, but it did not work.

Can it be related to not using an i2c splitter?

Pull-up resistors are present in the pixhawk and on the sensor module (likely) so it shouldn’t be an problem

Remove the hmc5883 and test with only the mmc5983ma.

Thank you for your response.

Unfortunately, the hmc5883 was included in the gps module and it comes with a shielded cable and it is not possible to remove the hmc5883. The exposed was already very short and had to be further shortened to connect the third compass (mmc5983ma) and now there is no more wire of the hmc5883 and this is why I am unable to remove the HMC5883 from the system.

I still don’t understand, why it is impossible to disconnect the HMC5883 just for a quck test. For such a small test you don’t need a GPS at all so you can remove the GPS and the HMC5883.

Also on I2C bus it is not a good idea to have on ALL nodes pull-up’s. Only one pair of pull-up’s is on so short systems recommended. If more pull-up’s are used, they are all in parrallel. So the the pull-up resistor is decreasing and the node signal current is increasing. This can destroy either destroy the output stage or overload the signal current source.

I will disconnect the gps and test without the hmc5883.

I know there should not be pull ups on all i2c devices but there is nothing I can do since they are smd type resistors.

One pair is in pixhawk inside and other pair is in gps module

Tried with the HMC5883 removed.

It did not work :pensive_face:.

At this point I suspect a broken wire since arducopter is usually not the issue. I will test all wiring and report back asap

Edit: wiring has been tested there is proper continuity between the compass sda and scl and the i2c port.

This suggests that the either the compass is defective or there is some software error. The chances of the compass being defective are very thin since it powers on and doesn’t heat up and is also brand new.

Voltage for compass is 3.29v
It accept 3.3v and has never been given 5v

Is there some i2c scanner that can run on this autopilot…

I took some help from ai and in the hwdef of pixhawk1 it says probe for two mags and there isn’t and definition for the mmc5983ma compass. According to ChatGPT, this means that the driver won’t be compiled into the firmware. I don’t know if this is true but if this is true then how do I fix it?

What value do you have in COMPASS_DISBLMSK ?

This shows the compasses available in the default Pixhawk build:

I added the MMC5xx3 compasses and produced a new build. Download your new firmware from this link:

If you need any other options like bdshot or other drivers, you’ll have to learn how to use the custom firmware builder. It’s incredibly easy.
https://custom.ardupilot.org/
and click the Docs link at top right.

I have already used the custom firmware builder. I added the mmc compass. Built the firmware yesterday and flashed it to the pixhawk

I used pixhawk1 board and added ibus telem which I also needed.

I disabled many other not needed compass models using the compass disable mask in params, but did not disable mmc5xx3 and the other mmc3 series and ist8310 and ist8308 and HMC qmc family compasses

Would using fmuv3 instead of pixhawk1 make a difference? is it possible?

is the hwdef issue possible or it cannot cause this?

Hardware is ruled out and hence it has to be a software error.

I saw the code “AP_COMPASS.CPP” and it includes the mmc5983ma library in the dronecan compass section. does this mean that dronecan needs to be enabled for the compass.cpp to include the mmc5983ma driver?

If yes, how to enable dronecan?

If you can build the firmware then make the necessary changes as mentioned in below and build.

1 Like

Where to make these changes?

I would extremely grateful if you or some other dev can build the firmware. I have zero experience with coding in this stm language and thus it would be very difficult for me to do so.
If possible, please include ibus- telem feature too.
The board is a pixhawk1. I need copter 4.6
3

I understand this a volunteer comunity and everyone’s time is very valuable.

Thank you for considering my request

Also, is the modification needed only in my case or is this an issue that would come up with every mmc5983ma compass?

If the latter is the case, should there be a pull request for this?

Update: the hardware is now 100% verified

I used mavproxy with some devop module and it responds properly.

The who am I register reads correctly for mmc5983ma sensor. This suggests that the sensor is alive and is responding

I tried to compile and I was on last step - ./waf copter

Unfortunately it gave compilation error regarding ADD_BACKEND

With my little knowledge, I thought it should be changed to add backend in lowercase as that was visible everywhere else

However, chatgpt suggested adding this snippet on top:

#ifndef ADD_BACKEND
#define ADD_BACKEND(driver, backend) add_backend(driver, backend)
#endif

There is no need to do the above changes in copter 4.6.3 and the snipped given by @Nischith_Raj has to be added in compass.cpp

However, in 4.7.0 dev version the above snipped also needs to be added

The compass is getting detected now!

Thank you everyone