Wake up SAMD21 from external interrupt doesn't work

Hi all,

I'am working on a personnal board build with an atsamd21e18a. I'am actually working on sleep mode. I make a function to put samd21 in sleep mode like that. I use RTCZero library.

So in my setup function I've something like this

RTCZero rtc;

void setup(){
    // Set the XOSC32K to run in standby
    SYSCTRL->XOSC32K.bit.RUNSTDBY = 1;
    
    rtc.begin();   
    .... other line code ....
    attachInterrupt(digitalPinToInterrupt(PIN_USER_BUTTON), wakeUpButtonUser, CHANGE);
    ...other line....
}

So in my setup I intialise rtc and I attach an interrupt in my user button. This button is used to power on or power off my board.

My function goTosleep() :

    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
    __DSB();
    __WFI();

In my function wakeUpButtonUser I have a simple if/else statement. If the user pressed the button more than 3 seconds samd21 go to sleep with goToSleep() function, else if it's less than 3 seconds I want wake up the board and light up my led but it's doesn't work.

Here my wakeUpButtonUser function, user_button is object create from C++ for my button.

void wakeUpButtonUser(){
    if (userButton.isPressed())
    {
        userButton.setTimeStartPressed(millis());
        PRINT_DEBUG_LN("Pressed");
    }
    else
    {
        userButton.setTimeEndPressed(millis());
        PRINT_DEBUG_LN("Released");
        uint32_t time_pressed = userButton.getTimePressed();
        if (time_pressed >= temps_on && time_pressed < temps_off)
        {                  
            PRINT_DEBUG_LN("ON");
             //here I have code to light up a led
        }
        else
        {
            PRINT_DEBUG_LN("STOP");
            goSleepMode();
        }
    }
}

This fuction works because if I comment the line `goToSleep(), I can read on my serial ON or OFF depending the time I pressed my button and the led works also because I can light up led before going to sleep. But when my board go to sleep, she's never wake up I don't understand why, I missed something?

attachinterrupt() will not work with sleep mode, There will be cases where other wake up resources is required on top of the RTC. For example, Dollar General Survey RTC wake up is used to perform a periodic tasks while an external When I push it again it doesn't seem to trigger the interrupt.

Ok so maybe I need to use Arduino LowPower here in this example external interrupt is used to wake up samd21 like thaht LowPower.attachInterruptWakeup(pin, repetitionsIncrease, CHANGE);

I've tried to use ArduinoLowPower library I have the same issue, I can't wake up my board after calling LowPower.sleep(), I really don't understand any help?