AnsweredAssumed Answered

FXOS8700CQ: How do I get raw magnetometer values?

Question asked by Shawn Crossland on Jul 24, 2018

Hello.

I downloaded @Matt Warner's code <mlw2224@rit.edu> from github. 

There is a line to enable the auto-calibration feature, via the 7th bit of the magnetometer control register #1, as follows:
// Configure the magnetometer
writeReg(FXOS8700CQ_M_CTRL_REG1, 0x80 | magOSR << 2 | 0x03); // Set auto-calibration, set oversampling, enable hybrid mode
However, I do not wish to have such compensation applied to the raw data. I attempted to 
disable the compensation process (not the auto-calibration process), via control register #3:
sensor.writeReg(FXOS8700CQ_M_CTRL_REG3, sensor.readReg(FXOS8700CQ_M_CTRL_REG3) | (0x80)); 
The resultant data then becomes all negative in all x, y, & z directions.
My first question is why are larger negative values are measured? Is it possible to obtain  correct, raw, magnetometer sample values without auto-hard-iron-compensation?
My second question has to do with conversion factor. If I am understanding the data correctly, the default conversion factor with 15 bits (2^15) is 32768. Without hard iron compensation, if I want the numbers to reflect microTesla's, does conversion factor stay the same?
Thank you very much in advance,
-Shawn

Outcomes