AnsweredAssumed Answered

accelerometer vector magnitude

Question asked by Meir SUDRY on Aug 7, 2015
Latest reply on Aug 12, 2015 by Meir SUDRY

Hi i encounter an odd response when trying to use the A_VECM feature in FXOS8700.

i have the following piece of code:

MMA865x_Standby();

IIC_RegWrite(CTRL_REG4,0x02); //Disable Data Ready interrupts, enable A_VECM interrupts

IIC_RegWrite(A_VECM_THS_MSB,0x80);   //update MSB THS, reset when condition fails

print_string("A_VECM_THS_MSB= ",16); print_hex(IIC_RegRead(A_VECM_THS_MSB)); WaitPrintBuffer();

IIC_RegWrite(A_VECM_THS_LSB,Acc_THS);   //update LSB THS

print_string("A_VECM_THS_LSB= ",16); print_hex(IIC_RegRead(A_VECM_THS_LSB)); WaitPrintBuffer();

IIC_RegWrite(A_VECM_CNT,Acc_COUNT); //update counter

print_string("A_VECM_CNT= ",13); print_hex(IIC_RegRead(A_VECM_CNT)); printENTER; WaitPrintBuffer();

IIC_RegWrite(A_VECM_CFG,0x78); //0111 1000  Latch enable, A_VECM_INIT, don't update reference when event

IIC_RegWrite(M_CTRL_REG1,((IIC_RegRead(M_CTRL_REG1))&(~0x03))); //Enable Accelerometer_Only

Data_Mode= Accelerometer_Only; //notify EX0 interrupt to read Accelerometer data

IIC_RegWrite(M_CTRL_REG2,((IIC_RegRead(M_CTRL_REG2))&(~0x20))); //Disable autoincrement mode

//    IntSource=IIC_RegRead(TRANSIENT_SRC); //Read 0x1E TRANSIENT_SRC register to clear the interrupt

MMA865x_Active(); //ACTIVATE THE SENSOR

 

with this code the program works fine and every time i move the device A_VECM is asserted.

in this stage i decided to delete the print_string() lines.

after i did that the A_VECM is asserted once and not asserted anymore.

i tried to replace the print_string() lines with simple delay: for(i=0; i<60000; i++);

with this line, again A_VECM is asserted with no problems.

i can read CNTR_REG4 and it is set to 0x02. nevertheless the A_VECM is not asserted.

any idea what is the reason for that?

 

thanks

Outcomes