AnsweredAssumed Answered

Problem Writing values to Magnetometer FXOS8700CQ

Question asked by Luke Lynch on Jul 2, 2015
Latest reply on Jul 7, 2015 by Luke Lynch

Hello,

 

I have a couple of questions regarding writing to the:

  • M_OFF_Z_MSB(0x43), M_OFF_Z_LSB (0x44) registers
  • M_THS_Z_MSB (0x58), M_THS_Z_LSB (0x59) registers

 

With the offset register it says in the datasheet: "For example, to correct for an offset of 60 uT, a value representing 60 uT (= 60 uT / 0.1 uT/LSB= 600 LSB), which is 0x0258 in 15-bit two's complement representation, should be written to the offset registers following a left-shift for proper alignment (0x0258<<1 = 0x04b0)".  What happens if i want to correct for an offset of -60uT (which is -60uT/0.1uT/LSB=-600LSB), which is 0x7DA8 in 15-bit two's complement representation,  0x7DA8<<1 =0xFB50, it this what i would write to the offset register to correct for a negative offset?

 

With writing to the magnetometer threshold register. I want to set an offset of -1000 counts or does it have to be +1000 as its a absolute number. Can it be wrote to the threshold register as -1000 (FC18). Does it need to be wrote as 15 bit or 16 bit 2's complement?

 

I am having some trouble, I take a reading (with the north pole, negative side of a magnet) facing at the magnetometer along the +z-axis and for example my reading out is 0xFC18. I then write this reading as ,0xFC to the M_THS_Z_MSB and 0x18 to the M_THS_Z_LSB. But when i move my magnet closer and reading increases (0xFC18 is = -1000 so it goes pass -1000 to -2000, 0xF830). my interrupt does not become set (low to indicate my threshold value on the z-axis has been exceeded). I feel i am writing the threshold value wrong, could someone help me?

if it make a difference i am taking a reading with no magnet in place and setting it as my offset so with no magnet in place i am getting a reading of  zero.

 

I have no problem setting a positive threshold (same as above but with the south pole, positive side facing the magnetometer), take a reading, set its as my threshold and when i move the magnet closer my interrupt becomes set.

 

Any help would be great,

Luke.

Outcomes