When the Vcc of the AVR chip is connected to the system power supply, the microcontroller will enter
different states according to the different levels of the RESET pin: reset state, normal working state, and programming state.
1. The RESET pin level is high
Normally, the RESET pin is connected to the system power supply through a pull-up resistor and is high level "1", see Figure 2-13. Under
this condition, once the power is turned on, the AVR will enter the power-on reset state. After a short internal reset operation, the chip
enters the normal working state (the reset caused by BOD and WDT is similar).
When the AVR is in the normal working state, there are two working modes: normal program execution working mode and sleep power saving working mode
.
z Normal program execution working mode
The normal program execution working mode is the basic working mode of the microcontroller. Since the hardware reset operation sets the program counter
to zero (PC=$0000), the execution of the program always starts from the Flash address $0000 (referring to non-BOOT LOAD mode
startup).
Sleep power saving mode
The sleep power saving mode is a mode that puts the microcontroller in low power consumption and power saving. When the microcontroller needs to
wait for an external trigger signal for a long time, and only performs corresponding processing after an external trigger, or only needs to perform processing at regular intervals
, the sleep power saving mode can be used to reduce power consumption. When the CPU is waiting (standby state)
, it can enter the sleep power saving mode. At this time, the CPU suspends work and does not execute any instructions. In the sleep power saving mode,
only part of the microcontroller's circuits are in working state, while other circuits stop working, which can save the microcontroller's power
consumption and form a power-saving standby state for the system. Once there is an external trigger signal or the waiting time is up, the CPU
is awakened from the sleep state and re-enters the normal program execution mode.
2 RESET pin level is low
After the AVR is powered on, if the level of the RESET pin is pulled low by the outside to "0", the chip will enter and be in the reset state
, see Figure 2-16 and Figure 2-17. Normally, this reset state continues until the low level of the RESET pin is cancelled.
Once RESET returns to a high level, the AVR will restart and enter the normal working state. This feature can be used to implement
manual reset or external forced reset operation of the AVR system.
In particular, it should be noted that once the level of the RESET pin is pulled low by the outside, when certain special conditions are met, the chip will
enter the programming state. For example, if the chip has an SPI interface and supports SPI serial programming, the following methods will make the chip
enter the SPI programming state: z Pull down the SCK pin of the SPI port externally, and then apply a low-level pulse
of at least 2 system cycles to the RESET pin externally ; z After a delay of 20ms, the external SPI programming instruction is sent to the chip through the SPI port of the AVR; In the Serial Downloading section of the Memory Programming chapter of the AVR device manual, the hardware connection of ISP programming using the SPI interface of the AVR, the process of entering the programming mode state, and the commands of serial programming are specifically introduced. Once the chip enters the programming state, the running code can be written into the program memory of the AVR through the SPI port, the Flash and EEPROM in the chip can be erased, data can be written (including running code), and data can be read out, and the setting of the AVR configuration fuse bit, the reading of the chip model, and the locking of the encryption bit can be realized.
Keywords:AVR
Reference address:AVR microcontroller working status
different states according to the different levels of the RESET pin: reset state, normal working state, and programming state.
1. The RESET pin level is high
Normally, the RESET pin is connected to the system power supply through a pull-up resistor and is high level "1", see Figure 2-13. Under
this condition, once the power is turned on, the AVR will enter the power-on reset state. After a short internal reset operation, the chip
enters the normal working state (the reset caused by BOD and WDT is similar).
When the AVR is in the normal working state, there are two working modes: normal program execution working mode and sleep power saving working mode
.
z Normal program execution working mode
The normal program execution working mode is the basic working mode of the microcontroller. Since the hardware reset operation sets the program counter
to zero (PC=$0000), the execution of the program always starts from the Flash address $0000 (referring to non-BOOT LOAD mode
startup).
Sleep power saving mode
The sleep power saving mode is a mode that puts the microcontroller in low power consumption and power saving. When the microcontroller needs to
wait for an external trigger signal for a long time, and only performs corresponding processing after an external trigger, or only needs to perform processing at regular intervals
, the sleep power saving mode can be used to reduce power consumption. When the CPU is waiting (standby state)
, it can enter the sleep power saving mode. At this time, the CPU suspends work and does not execute any instructions. In the sleep power saving mode,
only part of the microcontroller's circuits are in working state, while other circuits stop working, which can save the microcontroller's power
consumption and form a power-saving standby state for the system. Once there is an external trigger signal or the waiting time is up, the CPU
is awakened from the sleep state and re-enters the normal program execution mode.
2 RESET pin level is low
After the AVR is powered on, if the level of the RESET pin is pulled low by the outside to "0", the chip will enter and be in the reset state
, see Figure 2-16 and Figure 2-17. Normally, this reset state continues until the low level of the RESET pin is cancelled.
Once RESET returns to a high level, the AVR will restart and enter the normal working state. This feature can be used to implement
manual reset or external forced reset operation of the AVR system.
In particular, it should be noted that once the level of the RESET pin is pulled low by the outside, when certain special conditions are met, the chip will
enter the programming state. For example, if the chip has an SPI interface and supports SPI serial programming, the following methods will make the chip
enter the SPI programming state: z Pull down the SCK pin of the SPI port externally, and then apply a low-level pulse
of at least 2 system cycles to the RESET pin externally ; z After a delay of 20ms, the external SPI programming instruction is sent to the chip through the SPI port of the AVR; In the Serial Downloading section of the Memory Programming chapter of the AVR device manual, the hardware connection of ISP programming using the SPI interface of the AVR, the process of entering the programming mode state, and the commands of serial programming are specifically introduced. Once the chip enters the programming state, the running code can be written into the program memory of the AVR through the SPI port, the Flash and EEPROM in the chip can be erased, data can be written (including running code), and data can be read out, and the setting of the AVR configuration fuse bit, the reading of the chip model, and the locking of the encryption bit can be realized.
Previous article:ATMEGA16 controls 74LS164 to drive digital tube display
Next article:AVR microcontroller power failure detection function
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
MoreDaily News
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
Guess you like
- [Sipeed LicheeRV 86 Panel Review] Debian Python + Serial Communication
- What is the 5G battle about?
- Zero-based development of WIFI devices
- A detailed description of the development history of Bluetooth technology from 1.0 to 5.0
- Fundamentals of mmWave Sensors (mmWave Training Series)
- Tuya Smart Module SDK Development Course Series - 2. Introduction to Tuya IoT Platform
- C2000 Software Serial Interface (SCI) Implementation Method
- Differences between different versions of TI's ZigBee protocol stack
- Studying Things to Gain Knowledge 05: Dimensions and Elementary Functions
- How much does it cost to build a TMR magnetoresistive switch from development to manufacturing?