inputmodule-rs
inputmodule-rs copied to clipboard
Optimize Power Consumption (Sleep)
- [ ] Sleeping
- [ ] Hard sleep (host sleeping) When SLEEP# is pulled low. WFI until interrupt on this pin and pulled high
- [ ] Turn off RAM banks
- [ ] Disable USB termination
- [ ] Turn off clocks
- [x] Soft sleep
- [x] User isn't using it currently (timeout)
- [x] Manually go to sleep by command
- [ ] Go dormant and wake from SLEEP# pin: https://github.com/raspberrypi/pico-playground/blob/master/sleep/hello_dormant/hello_dormant.c#L28
- [ ] Hard sleep (host sleeping) When SLEEP# is pulled low. WFI until interrupt on this pin and pulled high
Steps:
- Try deep-sleep
- Measure power with only LEDs, no USB
- Try interrupt based USB. Can USB wake us from dormant or sleep?
Sleep/Dormant
System sleep mode is entered automatically when both cores are in sleep and the DMA has no outstanding transactions. In system sleep mode, the clock enables described in the previous paragraphs are switched from the WAKE_EN registers to the SLEEP_EN registers. The intention is to reduce power consumed in the clock distribution networks when the chip is inactive. If the user has not configured the WAKE_EN and SLEEP_EN registers then system sleep will do nothing.
RP2040 enters the SLEEP state when all of the following are true: • Both processors are asleep (e.g. in a WFE or WFI instruction) • The system DMA has no outstanding transfers on any channel RP2040 exits the SLEEP state when either processor is awoken by an interrupt.
Clocks
The clock generators select from the clock sources and optionally divide the selected clock before outputting through enable logic which provides automatic clock disabling in SLEEP mode (see Section 2.11.2).
The chip has an ultra-low power mode called DORMANT (see Section 2.11.3) in which all on-chip clock sources are stopped to save power. External sources are not stopped and can be used to provide a clock to the on-chip RTC which can provide an alarm to wake the chip from DORMANT mode. Alternatively the GPIO interrupts can be configured to wake the chip from DORMANT mode in response to an external event.
If an external clock or the XOSC is used then the ROSC can be stopped to save power. However, the reference clock generator and the system clock generator must be switched to an alternate source before doing so.
The XOSC is not affected by SLEEP mode. It is automatically stopped and restarted in the same configuration when entering and exiting DORMANT mode.
The PLLs are not affected by SLEEP mode. If the user wants to save power in SLEEP mode then all clock generators must be switched away from the PLLs and they must be stopped in software before entering SLEEP mode. The PLLs are not stopped and restarted automatically when entering and exiting DORMANT mode. If they are left running on entry to DORMANT mode they will be corrupted and will generate out of control clocks that will consume power unnecessarily. This happens because their reference clock from XOSC will be stopped. It is therefore essential to switch all clock generators away from the PLLs and stop the PLLs in software before entering DORMANT mode.