ADXL362 Firmware issues

Hi, I’m using the example posted by here https://github.com/rickkas7/AccelWake for my Particle Electron. I can’t find a way to make it work in Deep sleep mode. How do I adjust

  System.sleep(ACCEL_INT_PIN, RISING, 86400);

so that the Electron enters Deep sleep and will still wake up if there’s input from the INT pin (and wake up by default once every day)?

  System.sleep(ACCEL_INT_PIN, RISING, SLEEP_MODE_DEEP);

parses correctly, however the following does not:

  System.sleep(ACCEL_INT_PIN, RISING, SLEEP_MODE_DEEP, 86400);

@Vitesze, for deep sleep, you can’t specify a wakeup pin. The only way to wake the Electron from deep sleep is a rising edge on the WKP pin or a timeout. The example you referred to uses a “stop” sleeping mode which can be awakened from any pin.

Sorry, I should have mentioned I also tried

System.sleep (WKP, RISING, DEEP_MODE_SLEEP, 86400)

which gave me a call of overloaded functions.

@Vitesze, when specifying deep sleep you only specify the timeout. The WKP pin and RISING are assumed since the STM32 is designed that way. The correct format is (check out the docs!):

System.sleep(SLEEP_MODE_DEEP, seconds);

Thanks, Ill have a look at it tomorrow. Im just unsure how to attach the accelerometer output to WKP. I remember in the LIS3DH code it said something like LIS3DH (SPI, D2, WKP), but for the ADXL I cant add more than 2 arguments there

With the following code though, my sensor will not wake up when it is moved. It should be the default example for the sensor.

https://go.particle.io/shared_apps/59b03420dcd628eb1c00070e

EDIT: Found out that when I connect the CS pin on the accelerometer to the WKP pin on the Electron it does seem to work correctly.

Just in case another newbie comes across this and wonders the same: connect INT to WKP to make it work.