idle mode ARM CORTEX M0+ - Page 1
Forum section: electronics / general

author: newbie_here
author_rank: Newbie
timestamp: August 25, 2016, 10:12:12 am
content: Hello everyone,Currently I would like to make a small test program that allows me to see the reduction in consumption of SAMD10 microcontroller using the tool Data Visualizer.For this, I turn on an LED, and I want to activate the standby mode on the card.So if standby card was held the LED off (Subsequently the ?C wake from sleep with an action button that generaI interruption).But it turns out that I do not understand the manipulation of functions dedicated to standby on this evaluation board. On the internet I cannot find a concrete example on standby MCU mode.Here are the only two links found in connection with the setting in standby mode:http://www.atmel.com/Images/Atmel-42472-Peripheral-Power-Consumption-in-Standby-Mode-for-SAM-D-Devices_ApplicationNote_AT6490.pdfhttp://asf.atmel.com/docs/3.16.0/samd21/html/group__asfdoc__sam0__system__group.htmlSo, I like to know if someone has programming examples to help me.There are not many registers in which I can put the µC in idle mode:PM->SLEEP.reg = SYSTEM_SLEEPMODE_IDLE_0; PM->SLEEP.reg = SYSTEM_SLEEPMODE_IDLE_0;Hoping someone can help me, thank you

author: hans
author_rank: Super Contributor
timestamp: August 26, 2016, 08:40:18 am
content: Your question is a bit vague. Have you got experience with MCU's sleeping before? It sounds like not.Without looking into the specifics of the datasheet, the ASF page seems to describe a pretty generic sleep module.There is usually a sleep() function that activates the sleep mode of the MCU. The MCU will stop execution at that instruction, and wait for a trigger to resume execution. There is also a mode select function that chooses how deep of a sleep state should be entered.What the exact properties of each deep sleep state is, is written up in the datasheet and varies between MCU families and devices.The main factor is what clocks are left running, and what you can still do with those clocks to wake the MCU up at some point. There may be several wake up sources of interest.Usually MCU's will have an idle mode and deep sleep modes, possibly also several of both.Idle usually turns of the CPU clock and keeps peripherals running. This is usually not any ultra-low power state by any means, but can shave off some power consumption if the MCU is primarily waiting for I/O transfers (like a peripheral interrupt or a DMA transfer). In idle mode the MCU can usually wake up from any interrupt source.In the deeper sleep modes peripheral clocks are also turned off, meaning you can only wake up the MCU by specialized timers like watchdog, real-time counter or real-time clock/calendar peripheral. That is because usually the primary oscillator is turned off to save power. Additionally, you may need to take into account waking up from these deep sleep modes requires extra time, because the primary oscillator needs to be restarted. This is a trade-off between response-time (e.g. for ultra low power peripheral interrupts) and power consumption.By looking at the ASF page, these 2 functions are of primary interest to you:system_set_sleepmode(const enum system_sleepmode sleep_mode)system_sleep(void)Additionally you will need to set up peripherals in such a way that they will wake up the MCU when you need to, e.g. a watchdog timer that frequently wakes the MCU, or a RTC, or maybe even an external interrupt from an user button.

author: Lajon
author_rank: Contributor
timestamp: August 26, 2016, 01:24:29 pm
content: The doc in the first link refers to an example that is available in Atmel Studio (not for D10 but D11, close enough). The example is called "SAM Sleepwalking Voltage Monitor Application"./Lars