AnsweredAssumed Answered

ADXL345 activity & inactivity issue - detection on all axes not working

Question asked by pentelone on Dec 31, 2014
Latest reply on Jan 3, 2015 by neilzhao

@Hello,

on the begining i want to give my regards to AD engineers meet at Electronica 2014, hope some of you guys reading this forum:)

 

I'm experiencing issues with ADXL345 specifficaly with activity and inactivity function. I've setup properly - i hope, and i notice that inactivity and activity function is not working properly when all axis (xyz) are participating in detection. Thresh registers for inactivity and activity are set for 0x02 and 0x04 and inact time register is set to 0x02 - and function desn't work - i only got activity interupt once. When i moved both activ and inactiv threshold to 0x09 and 0x12 it works quite ok, but big force must be used to wake accelerometer up. BUT! when i setup only X axis to participate in activity and inactivity detection and decrease their thresholds 0x04 0x02 respectively, function works properly and adxl345 go sleep ("go home";)).   I thougth that noise on all axis is really big, but i can see maximum change of 5 lsb, when not moving adxl345. I hope you can help me to face this problem. Here is my config, maybe i missed sth. Created functions verify stored value in registers by reading them after value is sent so i think that we can skip problem with uC.

 

EDIT: I noticed one more thing, ADXL345 form time to time set int_source register as 0111 0001 so it means single tap, double tap and activity interrupt were detected. So to test it i disable the single and double tap and left only data ready inactiv and activ interrupt. Problem still exist. And it's really strange. Should i  start thinking that adxl345 is broken?

 

ADXL345_READ(ADXL345_DEVID_REG ,&flush);

    if (flush&&0xE5){

    ADXL345_WRITE_AND_VERIFY(POWER_CTL,0x00);

    ADXL345_WRITE_AND_VERIFY(ADXL345_INT_ENABLE_REG  ,0x00);// go home

    ADXL345_WRITE_AND_VERIFY(FIFO_CTL,0x00);     // turn off fifo

    ADXL345_WRITE_AND_VERIFY(BW_RATE, 0x0B);     // set rate

    ADXL345_WRITE_AND_VERIFY(DATA_FORMAT, 0x08);// set data format

 

    //////////////////// tap config////

    ADXL345_WRITE_AND_VERIFY(ADXL345_DUR_REG ,0x14);

    ADXL345_WRITE_AND_VERIFY(ADXL345_LATENT_REG,0x20);

    ADXL345_WRITE_AND_VERIFY(ADXL345_WINDOW_REG,0x50);

    ADXL345_WRITE_AND_VERIFY(ADXL345_TAP_AXES_REG ,0x0F);

    ADXL345_WRITE_AND_VERIFY(ADXL345_THRESH_TAP_REG,0x30);

 

    ////////////////// inactivity & activity set //////

    ADXL345_WRITE_AND_VERIFY(ADXL345_THRESH_ACT_REG,0x4);

    ADXL345_WRITE_AND_VERIFY(ADXL345_THRESH_INACT_REG,0x02);

    ADXL345_WRITE_AND_VERIFY(ADXL345_TIME_INACT_REG,0x02);

    ADXL345_WRITE_AND_VERIFY(ADXL345_ACT_INACT_CTL_REG,0x44); //ff

    ////////////////// FIFO /////////////////////////

    //ADXL345_WRITE_AND_VERIFY(ADXL345_FIFO_CTL,0x90); //90 int1 // b0 int2 - stream mode 16 samples

 

    //////////////////////// adxl345 int enable /////////////

 

    ADXL345_WRITE_AND_VERIFY(ADXL345_INT_ENABLE_REG  ,0xB8);

    //////////////////////////////////////////////////////

    ADXL345_WRITE_AND_VERIFY(POWER_CTL, 0x39);

    }

    else {

        UARTprintf("ACCEL NOT CONNECTED");

    }

thanks for your help

Outcomes