Recently i bought NEO M8N gps module with integrated HCM5883L compass. It's hard to find real HMC chip, the most are QMC on single compass module. The good news is, if you Buy NEO M8n module with integranted compass it will be real HMC chip on it.
The most of this modules works with my program prefectly. But nowaday i get some that not work with my code. I am debugging it, and find out, that the module works, got 0x1E i2C address (that meant its HMC) but its measuring wrong. If i do a 360degree turn, it will return only 5, 94,272 values.... I figured out, that its beacuse the wrong calibration.
I used jarzebski's HCM5883L libraray. If i upload the calibration program there are measured numbers at the X axis, but nothing just 0 in Y axis... If i manually offset the Y axis with a random number (100, or 200) then i can read headingdeegrees perfectly! But in this way i cannot calibrate the compass
I got 5 piece from this type of GPS+Compass module, and the same problem on all of them.
No measure from Y axis....
How can i solve this, how can i get readings from Y axis?
Maybe the Y axis regitser address different on this model?
EDIT: with the ADAFRUIT libraray the compass works, but i cannot use this library (there is no offset, etc) but its a good starting point to see, how it address the registers...
Sadly its a running project. There was many device sold previously with the use of jarzebski's HCM5883L libraray. I don't want to change, rewrite code becouse this odd working compass. I want unified solution, that i can use with the good working compass, and the odd working compass...
Yesterday i did it to work: in my code i repalce the jarzebski's compass code to Adafruit one, wroted in a calibration function. Now it's working, but now i have two program version. One for each compass type.
I want to know what's the different between this two libraray... This and This one...
I think it's becaouse the wrong register addressess. Maybe the odd working compass got different register address... Or uses 7bit vs 8bit addresses. But as i see both libraray uses the same register addresses. Dunno whats the different. Why it's work with Adafruit libraray, and why its isnt working with the
jarzebski's, that i used well before...
Maybe the working compass HMC5883L, the not working HMC5883 (without "L")? Is there any differencies?
Honeywell discontinued the HMC5883L awhile ago around 2015/2016. Shortly after, the chip continued to be manufactured as the QMC5883L revsion A by QST.
The QMC5883L revision A functioned identically to the HMC5883L, except that there was a hardware bug in the silicon, which meant (and I kid you not) that the status register didn't work. It's still possible to work with the chip, but some libraries written for the HMC5883L that (not unreasonably) check the status register, require a workaround.
Just to add to the confusion QST then released the QMC5883L revision B, that's internally a completely different device from the HMC5883L/QMC5883L revision A. Revision B operates in accordance with QST's QMC5883L datasheet.
The situation is also complicated by the fact that some vendors still market devices sold with the QMC5883L as the HMC5883L.
The QMC5883L revision A devices had the chip number DA5883, whereas the revision B had DB5883.
If your magnetometer's registers respond to the I2C address 0x1E, then it's closer to the HMC5883L, but the library might need to add a delay before reading the results register, instead of polling the status register.
If your magnetometer responds to the I2C address 0x0D then it will require the QMC5883L library instead.
The problem is that changes to this device are undocumented by QST.
@jan5650 It looks like the jarzebski library by default runs the HMC5883L in continous mode at 15Hz (66ms period) and doesn't attempt to time the reading of the X, Y, Z axes data registers to status register's RDY flag bit going high. Acutally, jazebski's library doesn't use the status register at all.
In this case, the library should work with a QMC5883L revision A as is, since your 500ms time interval code far exceeds the 66ms continuous sample rate.