Thanks. I have done more rebooting and checking mag values, last time I can see all three are zeros and are not changing after several minutes. No camera is attached currently. GPS/compass wires are 15 cm long and are close to the FC, and a BEC. I shall try connecting the compass with shorter wires keeping them away of the other components.
I have replaced the cable and did not put it inside the copter frame, keeping away from any other components.
The compass is detected, but the data received from the compass is almost constant: mx=29, my=127, mz=100 with a variance of about ±4. Interestingly, these values are close to compass offsets: 30, 110, 82. These offsets were obtained when Pixhawk’s internal compass was calibrated while the external one was disabled. I have power-cycled copter multiple times and mag values were remaining the same.
Live calibration of the QMC compass in MP is always getting only 6 samples. All of the white dots are displayed at zero coordinates.
The results are same with Chibios and Nuttx 3.6.7.
I believe internal compasses are still working and logged even you have “use this compass” unchecked in MP.
So constant mx, my may be for one of your internal compass.
If you have two internal compasses then the external one will be mx2, my2
This should not be the case, as I have disabled all compasses except the QMC using COMPASS_TYPEMASK, Arducopter is only seeing one compass with DEV_ID of 855305.
With mag offsets reset to 0, 0, 0 mx, my and mz are varying in a range from -1 to 1.
Looking at the QMC5883L driver there are several checks on compass initialization step that requires r/w operations on i2c bus. If these operations failing then compass will not be detected at all (did you had such cases?). It looks to me like i2c bus on your FC is good but the compass sensor is faulty.
No, the compass ID is always detected when connected and wired properly.
Me too, unfortunately. I think I must buy another TS100, I like its form-factor and GPS performance.
Thank you so much for you reply.When the QMC5883L stop updataing,I used a logic analyzer to catch the I2C Bus data.I can read data,so the I2C bus didn’t block(I think).The picture below is the I2C data I read.According the QMC5883L datasheet,when the QMC5883L_REG_STATUS is 0x04,this means ODR is 1 but DRDY is 0.what I did is soft-reset after I probe 0x04.
@xiefengxiyu thats interesting.
So how do you think is that line correct in Ardupilot driver? https://github.com/ArduPilot/ardupilot/blob/a8a71db25871003fc7fcd06b43cba16d808ad94e/libraries/AP_Compass/AP_Compass_QMC5883L.cpp#L173
There driver expects for 0x04 value.
And after you have sent soft-reset command to compass it started working normally then?
If the I2C is blocked the logic analyzer cant read data like above data. One more thing when the last time I met the QOMC5883L didnt updata phenomenon,I didnt shut down the flight control and I connected another flight control to the I2C bus,and surprisely I found the ‘“broken" flight control can get QMC5883 data,that is why I think reset is the solution.and the picture below is the I2C data I read when the QMC5883L is normal.As you can see when you can read correct Mag data the QMC5883L_REG_STATUS(register address is0x06) is 0x05. This is match to the program,and the another picture is the code that I add to QMC5883L.cpp.One embrassing thing is that I cant test my solution!
Hi, can you build a firmware which I could upload to my FC and test? Best if based on stable copter 3.6.7.
UPDATE: I have got a new TS100 and I’ve got it working but only sometimes, about 1 time of 3 tries. No matter whether I reboot FC or power cycle the copter. Same behavior on Nuttx and Chibios. On successful tries the FC is getting mag data, the values are noticeably changing when I rotate the compass. On unsuccessful tries the FC is seeing only the COMPASS_DEV_ID value, while mx, my and mz values are all zeros. When the compass is disconnected, COMPASS_DEV_ID is obviously zero.
So, there is definitely a software problem. Looks like compass is not getting initialized. A timing issue?
UPDATE 2: It is very weird, the compass is not failing anymore. I have rebooted the copter more than 20 times so far and the compass is still working flawlessly. I was able to calibrate it, though in the middle of red zone. A hardware issue? Losing contact somewhere? Maybe temperature influence?
Here is the QMC5883L.cpp,you can change it on you copter 3.6.7.I’m not sure if we met the same problem.You can try it,hope it can help you.Have you tried to shorten the connection line, too long line seems to have some bad influence.If you have any progress,please let me know.
AP_Compass_IST8308.cpp (6.5 KB)
Sorry, I am not very technical, I don’t know how to compile Arducopter firmware.
I have checked compass of my new TS100 again this morning, it is working well. Booted 3 times, all fine. The old compass is definitely dead, sending mx, my, mz values in a range from -1 to 1. I tend to think that I was having some sort of a hardware issue with the new TS100 yesterday. No idea why it was working in only about 1/3 of the numerous attempts and no idea how it was fixed. Maybe due to firmware re-flashing, or maybe there is a loose contact somewhere. I will keep posting if I find anything interesting.
Yesterday I had met the same problem,and the way I mentioned above it was useful.
Do you mean sending a restart command to the compass did the trick?
Yes,It is useful in my copter
I am also having troubles with a Matek M8Q-5883 which has the SAM-M8Q gps and the QMC5883L compass. I switched from a different compass (BN-880N) to this one, and I also had a LIDAR module plugged in to the I2C at the same time, and now I’m having similar weird compass hangs as described in this thread. Using a Matek F765-wing FC.
I disconnected the LIDAR. When I boot, MP sees the compass, but doesn’t receive any readings from it so far as I can tell. When I try to calibrate, I get no green bar, no response. At some point, the compass goes missing and MP no longer sees it. When I reboot everything, the compass is easily discovered again, but the same issues repeat. I tried two identical compass modules, so I’m pretty sure the problem is not a faulty module.
Was any resolution discovered? This seems to be a problem with my arducopter settings somehow.
Same Module and FC on my mini copter. Works with no problem on any firmware since the issue was fixed (I believe somewhere in 2019).
Another cause may be a wires length or ground line is connected wrongly.
I’m beginning to think it’s my Lidar, which is a Teraranger EVO 60. When the lidar is disconnected, the gps/compass works fine, so I know my wiring for that is fine.