Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:multiasm:piot:chapter_4_12 [2025/05/31 10:01] marcinen:multiasm:piot:chapter_4_12 [2026/01/19 15:16] (current) marcin
Line 8: Line 8:
   * Extended Standby   * Extended Standby
  
-To enter any of the sleep modes, the Sleep Enable bit in the Sleep Mode Control Register (SMCR.SE) must be written to '1' and a SLEEP instruction must be executed. Sleep Mode Select bits (SMCR.SM[2:0]) select which sleep mode (Idle, Power-down, Power-save, Standby, or Extended Standby) will be activated by the SLEEP instruction. Sleep options shown are from ATmega328PB.+To enter any of the sleep modes, the Sleep Enable bit in the Sleep Mode Control Register (SMCR.SE) must be written to '1' and a SLEEP instruction must be executed. Sleep Mode Select bits (SMCR.SM[2:0]) select which sleep mode (Idle, Power-down, Power-save, Standby, or Extended Standby) will be activated by the SLEEP instruction. The sleep modes shown in Fig. {{ref>avr_sleepmodes}} are for the ATmega328PB. 
 +<figure avr_sleepmodes> 
 +{{:en:multiasm:piot:sleep_mode_register.svg?400|ATmega328PB MCU sleep modes}} 
 +<caption>ATmega328PB MCU sleep modes</caption> 
 +</figure>
  
-{{:en:multiasm:piot:sleep_modes.png?400|}}+ 
 +^  SM2, SM1, SM0  ^  Sleep Mode        ^ 
 +|  000            |  Idle              | 
 +|  001            |                    | 
 +|  010            |  Power-down        | 
 +|  011            |  Power-save        | 
 +|  100            |  Reserved          | 
 +|  101            |  Reserved          | 
 +|  110            |  Standby           | 
 +|  111            |  Extended Standby  |
  
 **Idle Mode** **Idle Mode**
  
-When the SM[2:0] bits are set to '000', the SLEEP instruction puts the MCU into Idle mode, stopping the CPU but allowing peripherals like SPI, USART, Analog Comparator, 2-wire Serial Interface, Timer/Counters, Watchdog, and interrupts to continue operating. This mode halts the CPU and Flash clocks but keeps other clocks running. The MCU can wake up from both external and internal interrupts.+When the SM[2:0] bits are set to '000', the SLEEP instruction puts the MCU into Idle mode, stopping the CPU but allowing peripherals like SPI, USART, Analogue Comparator, 2-wire Serial Interface, Timer/Counters, Watchdog, and interrupts to continue operating. This mode halts the CPU and Flash clocks but keeps other clocks running. The MCU can wake up from both external and internal interrupts.
  
 **Power-Down Mode** **Power-Down Mode**
Line 26: Line 39:
 **Standby Mode** **Standby Mode**
  
-When the SM[2:0] bits are set to '110' and an external clock option is selected, the SLEEP instruction puts the MCU into Standby mode, similar to Power-Down but with the oscillator running. The device wakes up in six clock cycles.+When the SM[2:0] bits are set to '110'and an external clock option is selected, the SLEEP instruction puts the MCU into Standby mode, similar to Power-Down but with the oscillator running. The device wakes up in six clock cycles.
  
 **Extended Standby Mode** **Extended Standby Mode**
  
-When the SM[2:0] bits are set to '111' and an external clock option is selected, the SLEEP instruction puts the MCU into Extended Standby mode, similar to Power-Save but with the oscillator running. The device wakes up in six clock cycles.+When the SM[2:0] bits are set to '111'and an external clock option is selected, the SLEEP instruction puts the MCU into Extended Standby mode, similar to Power-Save but with the oscillator running. The device wakes up in six clock cycles.
  
 +^ Layer                ^ What it does              ^ Your interaction        ^
 +| HAL (Arduino + avr-libc) | Sets SMCR bits for you     | Easy, high-level        |
 +| Assembly (sleep)         | Executes sleep instruction | Uses SMCR settings      |
 +| Hardware (SMCR register) | Controls sleep mode        | Hidden unless accessed manually |
  
  
-AVR® 8-bit microcontrollers include several sleep modes to save power. The AVR device can also lower power consumption by shutting down the clock for select peripherals via a register setting. That register is called the Power Reduction Register (PRR).+Summary Table: SMCR Differences Across AVR Families 
 + 
 +^ Feature              ^ tinyAVR          ^ megaAVR         ^ XMEGA             ^ 
 +| Register name        | SMCR             | SMCR            | SLEEP.CTRL        | 
 +| Sleep enable bit     | Yes (SE)         | Yes (SE)        | No                | 
 +| Mode bits            | SM1:SM0 (sometimes SM2) | SM2:SM0   | SLEEPMODE1:     | 
 +| Number of modes      | 3–4              | 5–6             | 4                 | 
 +| Power save mode      | Rare             | Yes             | Yes               | 
 +| Standby mode         | Some models      | Yes             | Yes               | 
 +| Extended Standby     | Rare             | Yes             | Yes               | 
 +| Architecture         | Simple           | Standard        | Advanced          | 
 + 
 + 
 + 
 + 
 +AVR® 8-bit microcontrollers include several sleep modes to save power. The AVR device can also lower power consumption by shutting down the clock for select peripherals via a register setting. That register is called the Power Reduction Register (PRR), as presented in Fig{{ref>avr_prrdetails}}. The Power Reduction Register (PRR) is another place where AVR families differ quite a bit — sometimes even more than SMCR. If SMCR controls how deeply the CPU sleeps, then PRR controls which peripherals are powered at all. 
 + 
 +<figure avr_prrdetails> 
 +{{:en:multiasm:piot:extended_sleep_mode.svg?400|PRR application details}} 
 +<caption>PRR application details</caption> 
 +</figure>
  
-{{:en:multiasm:piot:sleep_modes_details.png?400|}} 
    
-The PRR provides a runtime method to stop the clock to select individual peripherals. The current state of the peripheral is frozen, and the I/O registers cannot be read or written. Resources used by the peripheral when stopping the clock will remain committed. Hence, the peripheral should, in most cases, be disabled before stopping the clock. Waking up a module, which is done by clearing the bit in PRRputs the module into the same state as before shutdown. +The PRR provides a runtime method to stop the clock to select individual peripherals. The peripheral is currently frozen, and the I/O registers cannot be read or written. Resources used by the peripheral when stopping the clock will remain committed. Hence, the peripheral should, in most cases, be disabled before stopping the clock. Waking up a module by clearing the bit in PRR puts it back into the state it was in before shutdown. 
-PRR clock shutdown can be used in Idle mode and Active mode to significantly reduce the overall power consumption. In all other sleep modes, the clock is already stopped.+The PRR clock shutdown can be used in Idle and Active modes to significantly reduce overall power consumption. In all other sleep modes, the clock is already stopped. 
 + 
 +PRR Differences Across AVR Families 
 + 
 +^ Feature              ^ tinyAVR                         ^ megaAVR                     ^ XMEGA                                   ^ 
 +| PRR exists           | Sometimes                       | Yes                         | No (replaced by PR.* registers)         | 
 +| Number of registers  | 0–1                             | 1–2                         | Many                                    | 
 +| Peripheral coverage  | Very limited                    | Full                        | Very granular                           | 
 +| Architecture         | Simple                          | Standard                    | Advanced                                | 
 +| Arduino support      | Partial                         | Full                        | None (Arduino doesn’t support XMEGA)   |
  
-Tips to Minimize Power Consumption +Tips to Minimise Power Consumption. 
-  * Analog to Digital Converter (ADC): Disable the ADC before entering sleep modes to save power. +  * Analogue to Digital Converter (ADC): Disable the ADC before entering sleep modes to save power. 
-  * Analog Comparator: Disable the Analog Comparator in Idle and ADC Noise Reduction modes if not used.+  * Analogue Comparator: Disable the Analogue Comparator in Idle and ADC Noise Reduction modes if not used.
   * Brown-Out Detector (BOD): Turn off the BOD if not needed, as it consumes power in all sleep modes.   * Brown-Out Detector (BOD): Turn off the BOD if not needed, as it consumes power in all sleep modes.
-  * Internal Voltage Reference: Disable it if not needed by the ADC, Analog Comparator, or BOD.+  * Internal Voltage Reference: Disable it if not needed by the ADC, Analogue Comparator, or BOD.
   * Watchdog Timer: Turn off the Watchdog Timer if not needed, as it consumes power in all sleep modes.   * Watchdog Timer: Turn off the Watchdog Timer if not needed, as it consumes power in all sleep modes.
-  * Port Pins: Configure port pins to minimize power usage, ensuring no pins drive resistive loads.+  * Port Pins: Configure port pins to minimise power usage, ensuring no pins drive resistive loads.
   * On-chip Debug System: Disable the On-chip debug system if not needed, as it consumes power in sleep modes.   * On-chip Debug System: Disable the On-chip debug system if not needed, as it consumes power in sleep modes.
  
en/multiasm/piot/chapter_4_12.1748674882.txt.gz · Last modified: by marcin
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0