Hi westfw,
The boards are powered by the native USB port, but I'm not using Serial/SerialUSB.
I'm using some test code that puts the processor into deep sleep using the __WFI() function. Bringing pin A1 to HIGH wakes up the processor and triggers the ISR to switch on the LED on D13.
After 1 second delay the LED is turned off in the loop() and the processor goes into deep sleep oncemore.
On the SAMD21 this works perfectly, the processor goes to sleep on executing the __WFI() function. The SAMD51 on the other hand appears to ignore it and just continues round the loop() seeming without pausing. (I tested this by toggling another digital output pin not shown in the code below).
Perhaps (not for the first time) I'm missing something obvious?
// Put the CPU core into deep sleep and awake with a logic HIGH interrupt on analog pin A1
void setup()
{
pinMode(13, OUTPUT); // Set digital pin 13 to an output
pinMode(A1, INPUT_PULLDOWN); // Set analog pin A1 to an input with an internal pull-down resistor
attachInterrupt(A1, interrupt, HIGH); // Set up an interrupt on analog pin A1 on a logic HIGH level
//SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // Set up the SAMD21 to enter low power STANDBY mode
PM->SLEEPCFG.bit.SLEEPMODE = 0x4; // Set up SAMD51 to enter low power STANDBY mode
while(PM->SLEEPCFG.bit.SLEEPMODE != 0x4); // Wait for it to take
}
void loop()
{
delay(1000); // Wait for 1 second
digitalWrite(13, LOW); // Set D13 output to logic LOW
__DSB(); // Complete data memory operations
__WFI(); // Put the SAMDx1 into deep sleep Zzzzzzz....
}
void interrupt() // Interrupt Service Routine (ISR)
{
digitalWrite(13, HIGH); // Set D13 output to logic HIGH
}