Hi, my ADXL362 is working In fact, it is ADXL363
However, I have one doubt. Please see my code.
// activity detection: event fired when acc. remains over threshold during specified time
WRITE_REGISTER_ADXL362(0x20,0xFA); // activity THRESH_ACT_L, bits 7-0
WRITE_REGISTER_ADXL362(0x21,0x00); // activity THRESH_ACT_H, bits 10-8
WRITE_REGISTER_ADXL362(0x22,0x1E); // activity time TIME_ACT (ex: 1E = 30 samples ~ 5s)
// inactivity detection: event fired when acc. remains below threshold during specified time
WRITE_REGISTER_ADXL362(0x23,0x96); // inactivity THRESH_INACT_L, bits 7-0
WRITE_REGISTER_ADXL362(0x24,0x00); // inactivity THRESH_INACT_H, bits 10-8
WRITE_REGISTER_ADXL362(0x25,0x1E); // inactivity time TIME_INACT
// activity and inactivity detection can be used when the accel-erometer is in either measurement mode or wake-up mode.
WRITE_REGISTER_ADXL362(0x27,0x3F); // in/activity control register, p.29, 0x3_ = loop mode, 0x_F = inactivity & activity enabled, reference modes
WRITE_REGISTER_ADXL362(0x2B,0x30); // INTMAP2, p.32, [5:4]INACT:ACT IRQ
WRITE_REGISTER_ADXL362(0x2C,0x13); // FILTER_CTL, p.33 [2:0](0=0.125, 2=0.02s, 3=0.01s, >101=0.0025s)
WRITE_REGISTER_ADXL362(0x2D,0x0E); // MODE control register, p.34 [5:4]noise, wake-up mode,  autosleep, [1:0] = 00 standby, 10 measurement
If the last register (0x2D) is written with 0x0E, I can see in my logic analyzer the activity detection and inactivity detection that is nice.
However, if I write 0x06, so I disable wake-up mode, the activity IRQ fires but not the inactivity IRQ does not fire. Why?
Anyway, I thought wake-up and measurement mode where mutually exclusive. Which is the one operating if you set both? Wake-up mode and then measurement mode upon waking up? But this way, you may be suffering false positives, so I guess it's safer to disable wake-up mode, but then I do not detect inactivity! Maybe I'm not going into auto-sleep?
Hehe, so you can see my problem: I want to safely detect activity and inactivity, even if I require more current. How could I be aware of the inactivity event?
Please let me know what am I understanding wrong! Have the nicest day.
The reason might be that you are running in LOOP mode. Try LINKED mode (2F with your settings I suppose).
According to this thread the act / inact bits clear after 20 µs,so you have to rely on the AWAKE bit, which is 1 when active, and 0 when inactive. That means you need a toggle type IRQ.
I don't know, but now it works when in LOOP mode
I think I was doing one very stupid error and setting the last 0x2D register to 0x03 instead of monitoring 0x02
Have a nice day!