hello everyone,
Currently i'm working with the BRKT-STBC-AGM01 BREAKOUT BOARD. Where i'm communicating with a FXOS8700cq chip through I2C with my Atxmega microcontroller.
I have set up the IC to getting only magnetic values on 200Hz samples rate.
But after a while i don't new data from the chip anymore. I thought that it might have been the sleep mode. But i disabled that one. As far as i know. Is there something else that i overlooked?
Hereby my setup code :
TWI_Write(FXOS8700CQ_SLAVE_ADDR,FXOS_CTRL_REG1,0x00);
TWI_Write(FXOS8700CQ_SLAVE_ADDR,FXOS_CTRL_REG2,0x09);
//TWI_Write(FXOS8700CQ_SLAVE_ADDR,FXOS_XYZ_DATA_CFG,0x00);
TWI_Write(FXOS8700CQ_SLAVE_ADDR,FXOS_M_CTRL_REG1,0x05);
TWI_Write(FXOS8700CQ_SLAVE_ADDR,FXOS_M_CTRL_REG2,0x49);
TWI_Write(FXOS8700CQ_SLAVE_ADDR,FXOS_M_CTRL_REG3,0xA0);
TWI_Write(FXOS8700CQ_SLAVE_ADDR,FXOS_CTRL_REG1,0x15);
Did i forget something with the initialisation?
Thanks in advance,
Hello Rens,
Please be aware about the M_CTRL_REG2. You do not need to set the auto-increment mode due to you are using the magnetometer mode only.
You may use the following configuration in order to initialize the FXOS8700QC:
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG2, 0x40); // Reset all registers to POR values, Standby mode
Delay(); // ~1ms delay
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, XYZ_DATA_CFG_REG, 0x00); // +/-2g range with 0.244mg/LSB
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, M_CTRL_REG1, 0x1D); // Magnetometer mode, max OSR
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG2, 0x02); // High Resolution mode
I2C_WriteRegister(FXOS8700CQ_I2C_ADDRESS, CTRL_REG1, 0x15); // ODR = 200Hz, Reduced noise, Active mode
Please let me know if this configuration helps.
In case it is useful for you, you may refer to the FX0S87OOCQ - Bare metal example project.
https://community.freescale.com/docs/DOC-101073
I hope this information will be useful for you.
If I misunderstood your question or you still have concerns, feel free to let me know. I will be glad to help.
Have a great day.
David Diaz.
Note: If this post answers your question, please click the Correct Answer button. Thank you!
thank for the reply,
Have been away for a bit. That's why i couldn't reply earlier. But it seems with the setting you send to me. The same problems occurs. After a while it just stops giving new data. And only gives Zero's back from the registers. Could it be i'm missing something or is the chip maybe broken ?
Greetings,
Rens
I just found out that the magnetometer goes in to standby mode at a random moment.
With every sample i take i read that Sysmod register to see if the chip is still active. And there it stated that it had gone into standby mode.
Is there something that i forgot that could cause the chip to go into standby more or could it really be broken? I do have the reset line set to ground.
Greetings,
Rens