Post Go back to editing

adxl367 loop mode

Category: Hardware

I've used the adxll362 in loop mode for several years -- typically with active/inactive thresholds of 0.35g in reference mode.  I have been unable to duplicate this setup with the adxl367.  In particular, I am unable to reduce the inactive threshold below ~1.25g and have the part ever sleep.  There are some cryptic comments in the datasheet --

When using the referenced configuration, it is important to note that the device still uses the absolute thresholds when it first enters measurement mode. This becomes important if an inactivity threshold ​< 1g is desired. In this case the device must enter measurement mode with a threshold greater than 1g.  The inactivity threshold can then be lowered to the desired level (while still in measurement mode).

Sounds simple right?  It doesn't work.  Or more specifically, I haven't found the magic incantation that works.  I've tried waiting after the other setup before making a change, but that does not work.

Here's how I'm initializing things (no attempt to lower the threshold here) which works, but doesn't meet my inactivity threshold goals.  Any advice?  -- another unrelated gripe -- why switch from little endian to big endian from adxl362 to adxl367 ?  Just super annoying!

// set adxl range/rate; 2g, 25hz

#define RANGE_VAL ADXL367_FILTER_I2C_HS | ADXL367_ODR_25HZ

ADXL367_SetRegisterValue(RANGE_VAL,ADXL367_REG_FILTER_CTL, 1);

// interrupt -- caused by AWAKE going active

ADXL367_SetRegisterValue(ADXL367_INTMAP1_AWAKE_INT1 , ADXL367_REG_INTMAP1_LWR, 1);

// Timer Control Register -- 6 samples/second

ADXL367_SetRegisterValue(1<<6, ADXL367_REG_TIMER_CTL,1);

// set inactivity level maximum 4500 = 1.125g for 2G range

ADXL367_SetRegisterValue(UINT16SWAP(4500<<2),ADXL367_REG_THRESH_INACT_H,2);
// set inactivity count to 15
ADXL367_SetRegisterValue(UINT16SWAP(15),ADXL367_REG_TIME_INACT_H,2);

// set activity threshold to 500mg -- see p22 ADXL367 data sheet

ADXL367_SetRegisterValue(UINT16SWAP((2000<<2)),ADXL367_REG_THRESH_ACT_H,2);

// turn on referenced loop mode

#define LOOPMODE ((3<<4) | (3<<2) | 3)

ADXL367_SetRegisterValue(LOOPMODE, ADXL367_REG_ACT_INACT_CTL, 1);

// set power to measurment mode AUTOSLEEP|MEASUREMENT

#define POWERCTL (ADXL367_POWER_CTL_AUTOSLEEP | ADXL367_OP_MEASURE)

ADXL367_SetRegisterValue(POWERCTL, ADXL367_REG_POWER_CTL, 1);
Parents
  • Sadly the example code provided doesn't fully work.  It took a while to figure things out since it lacked any comments and no symbolic constants.    There is at least one bug -- your code sets the inactive threshold below 1g.    But ultimately, the problem is that in reference mode, inactivity isn't reliably detected -- I can put the adxl at an angle and it stays awake.   Also, the inactivity timer doesn't work correctly -- I can set it to more than one second and inactivity detection will be significantly less than 1 second.

  • The code works, but maybe not for your specific use case. The objective of the example code was to give you guidance for the implementation on your end. 

    Anyway, please look at the datasheet page 21 for details on when the reference is updated based on the ODR and timer setting. 

  • My use case is simple -- and works well with the adxl362, but not with the adxl367:

    1)  Loop/reference mode

    2) Inact threshold  350mg

    3) Act threshold  250mg

    4) Inact timer  0.5 seconds

    Here's what I see 

    1) inact timer isn't respected

    2) Inact threshold in reference mode below 1g leads to instances where the adxl367 gets "stuck" awake -- this is easy to demonstrate by rotating the test board vertically and leaving it propped up.

    I don't believe the code you sent has been tested in any serious manner.

Reply
  • My use case is simple -- and works well with the adxl362, but not with the adxl367:

    1)  Loop/reference mode

    2) Inact threshold  350mg

    3) Act threshold  250mg

    4) Inact timer  0.5 seconds

    Here's what I see 

    1) inact timer isn't respected

    2) Inact threshold in reference mode below 1g leads to instances where the adxl367 gets "stuck" awake -- this is easy to demonstrate by rotating the test board vertically and leaving it propped up.

    I don't believe the code you sent has been tested in any serious manner.

Children