How can I wake up Sodaqv2 with LS3DE interruption?

Hello,

I would be interesting on knowing how I can wake up Sodaqv2 when an interruption of LS3DE rises up. Is there any example that I may use?

Thanks in advance,

regards

Any external pin interrupt will wake the board (the Arduino core configures the EIC to generate a wake interrupt). However, the default setup only supports the interrupt modes HIGH and LOW. The modes CHANGE, RISING and FALLING require an active clock signal on the EIC when in sleep mode. This is not configured by default and so the clock powering the EIC is also disabled when entering sleep mode.

Is it possible to configure so? Where can I see an example of such a setting?

Then should I have to add something like this configuration for my EIC configuration in the ?

EIC->CONFIG[1].bit.FILTEN1 = 1; // D3=eic9
EIC->WAKEUP.vec.WAKEUPEN = (1<<9);

It is a bit more complicated than that.

What you have done above is enabled the filtering (which may help with bounce issues) and set the EIC as a wakeup source. Arduino already enables the wake up part.

The CHANGE time interrupts require changes to how the EIC’s source clock is configured.

I have provided a working solution for this here:
http://forum.arduino.cc/index.php?topic=410699

1 Like

Thanks @GabrielNotman

I have incorporated your solution into my initialisation of the movement detection as this

void initMovementDetected()
 {
 accelerometer.enable(true, LIS3DE::NormalLowPower10Hz, LIS3DE::XYZ, LIS3DE::Scale2g, true);
 sodaq_wdt_safe_delay(100);
 accelerometer.enableInterrupt1(LIS3DE::XHigh | LIS3DE::XLow | LIS3DE::YHigh | LIS3DE::YLow | LIS3DE::ZHigh | LIS3DE::ZLow,
gPercentage * 2.0 / 100.0, accDuration, LIS3DE::MovementRecognition);

  pinMode(ACCEL_INT1, INPUT);
  attachInterrupt(ACCEL_INT1, movementDetectedHandler, CHANGE);

   //Anti-bouncing
   EIC->CONFIG[1].bit.FILTEN1 = 1; // D3=eic9

   // Set the XOSC32K to run in standby
   SYSCTRL->XOSC32K.bit.RUNSTDBY = 1;
   
   // Configure EIC to use GCLK1 which uses XOSC32K
   // This has to be done after the first call to attachInterrupt()
   GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID(GCM_EIC) |
   GCLK_CLKCTRL_GEN_GCLK1 |
   GCLK_CLKCTRL_CLKEN;
}