Hi all,
I am using the FXOS8700CQ six axis sensor, and can read the (x,y,z) accelerometer measurements and (x,y,z) magnetometer measurements without issue from their dedicated registers.
The data sheet also references complementary/companion registers that hold accelerometer readings that are time-aligned with the magnetometer values. However, if I query these registers (at 0x39 et seq), the values are always zero.
Any pointers on procedures or special setup steps that need to be taken to get meaningful values from these registers?
Thanks
Solved! Go to Solution.
Hi Jeffrey,
After taking a closer look at this behavior and trying several ODR and OSR options, I realized that specific OSR settings is important to get meaningful values from the CMP_X/Y/Z registers which actually makes sense as these registers contain time-aligned accelerometer data. I was able to get nonzero values if the accelerometer OSR (set using mods [1:0] bits) is equal or higher than the magnetometer OSR (set using m_os [2:0] bits). The OSRs can be found in Table 37 for the accelerometer and in Table 201 for the magnetometer.
As for the (5) superscript at the CMP_X/Y/Z registers in Table 15, it is indeed incorrect and will be corrected in the next data sheet revision. Thanks for pointing it out.
I hope it helps.
Regards,
Tomas
Hi Jeffrey,
In order to read the accelerometer measurements from the CMP_X/Y/Z registers (0x39 – 0x3E), the FXOS8700CQ needs to operate in hybrid mode (m_hms [1:0] = 0b11), so make sure you set these two bits during initialization of the device.
Attached you can find my example code where I am using burst mode to read 12 bytes of both accelerometer and magnetometer measurements. Both burst readings from registers 0x33 – 0x3E or 0x01 – 0x38 (when hyb_autoinc_mode = 1) work fine.
Let me know whether or not this helps, or if you have any other questions.
Regards,
Tomas
PS: If my answer helps to solve your question, please mark it as "Correct" or “Helpful”. Thank you.
Hi Tomas,
Thank you for the comprehensive reply. The detailed remarks and the code sample were especially useful.
My code was using the hybrid mode, but zero-valued data for the time-aligned accelerometer values were always returned with a burst read.
Looking through the device configuration steps in your initialization functions for the six-axis sensor, I note the following register-write statement, which I did not have in my setup. Empirically, this seems to affect whether I get zero or nonzero valued data for the time-aligned accelerometer measurements.
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG2, 0x02); | // High Resolution mode |
Is it a proper conclusion that having the accelerometer OSR mode in normal is not compatible with the specification of 8x oversampling for the magnetometer, and thus I get zero valued data for the time-aligned accelerometer measurements?
As an aside, Table 15 of the data sheet (FXOS8700CQ.pdf) has a (5) superscript for the CMP_X_MSB ... CMP_Z_LSB registers. This indicates that "Modification of the register's contents can only occur when device is in Standby mode ...". Is this really the case for these registers?
Many thanks,
Jeffrey
Hi Jeffrey,
After taking a closer look at this behavior and trying several ODR and OSR options, I realized that specific OSR settings is important to get meaningful values from the CMP_X/Y/Z registers which actually makes sense as these registers contain time-aligned accelerometer data. I was able to get nonzero values if the accelerometer OSR (set using mods [1:0] bits) is equal or higher than the magnetometer OSR (set using m_os [2:0] bits). The OSRs can be found in Table 37 for the accelerometer and in Table 201 for the magnetometer.
As for the (5) superscript at the CMP_X/Y/Z registers in Table 15, it is indeed incorrect and will be corrected in the next data sheet revision. Thanks for pointing it out.
I hope it helps.
Regards,
Tomas
Hi Tomas,
Thanks for the confirmation; the behavior you describe makes sense.
Jeffrey