Skip to content

SLEEP_MODE_IDLE return without entering sleep #113

@chansheunglong

Description

@chansheunglong

Everything works fine with Standby and Power-Down, the device goes to sleep forever without waking up

void loop() {
  SLPCTRL.CTRLA |= SLPCTRL_SMODE_PDOWN_gc; //SLEEP_MODE_PWR_DOWN
  sleep_enable();
  sleep_cpu();
  sleep_disable();

  Serial.println("ERROR"); //If you see this there is an error
  Serial.flush();
}

But I would like to have millis() running since I need to keep track of the time
I change to SLEEP_MODE_IDLE (SLPCTRL.CTRLA |= SLPCTRL_SMODE_STDBY_gc;)to have the main clock running
However, after that, the device just exits sleep mode immediately. And output "ERROR" to the terminal

Two question that need help:

  1. Is there any config I need to do for the MCU to go to IDEL mode and enter sleep?
  2. While in STANDBY and PWR_DOWN, is there anyway to keep millis() active?

Thanks all!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions