A few tips to teach you how to solve the endless problems of microcontroller reset

Publisher:朱颜素韵Latest update time:2023-01-31 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In the use of microcontrollers, we often come into contact with the reset circuit, which is an important component of the smallest system of microcontrollers. It is also a very important part.


Reset is to make the microcontroller run again from the initialization state, that is, the program is executed from the beginning. The quality of the reset circuit design directly affects whether the entire system is stable and reliable. The reset circuit is connected to the RESET/NRST pin of the microcontroller. Taking the STM32 series microcontroller as an example, when the system is working normally, if the RESET pin voltage is lower than a certain threshold, the microcontroller enters the reset state. The reset of the microcontroller can be divided into low-level reset and high-level reset. This is determined by the manufacturer. You can see the data manual for the distinction. The reset chapter in the manual will clearly state what level reset is. The reset of the microcontroller can be divided into: power-on reset, power-off reset, software reset, external manual reset, etc.


Power-on reset: Each time the microcontroller is powered on, it will give a reset signal to the RESET pin, allowing the microcontroller to restart working from the same fixed state;

Power-down reset: When the reset pin voltage of the microcontroller is lower than a certain threshold potential, the microcontroller enters the reset state.

Software reset: The programmer executes a specific reset instruction to reset the microcontroller, or controls the microcontroller to reset through a watchdog circuit when the program loses response for a certain period of time.

External manual reset can re-run a crashed or runaway program through a reset button.

Let's take a look at several common reset circuits.

61afb962-378a-11ec-82a8-dac502259ad0.jpg

Figure 1 Figure 1 is the most common low-level power-on reset schematic diagram. Let's analyze this process. The voltage across the capacitor is 0 before power-on. After powering on, the current flows from 3.3V through the resistor and capacitor to ground. Since the voltage at both ends of the capacitor cannot change suddenly, the voltage on the RESET pin is also zero at the moment of powering on and remains low for a short period of time. During this period, the microcontroller is triggered. Reset; as time goes by, the voltage across the capacitor is too high to exceed a certain threshold potential, and the reset is completed. The value of this resistor and capacitor affects the rise time of the reset pin level (the charging time of the capacitor).

62135580-378a-11ec-82a8-dac502259ad0.jpg

figure 2

Figure 2 Schematic diagram of manual button reset. A button is connected between GND and RESET for manual button reset. When the button is pressed manually, the RESET pin will be pulled low by GND, causing the microcontroller to enter the reset state. If the hand is not released, it will remain in the reset state until the reset pin level is restored.


The reset waveform inside the ST microcontroller. When powering on, VDD is greater than Vpor and lasts for a certain period of time. The microcontroller leaves the reset state. When powering off, the Vdd voltage is lower than the Vpdr voltage, and the microcontroller resets.


There are two types of software reset. We can use the reset command to directly reset the microcontroller. The other is to use the built-in watchdog of the microcontroller, configure the startup watchdog, and refresh the watchdog at certain intervals in the main loop program. Commonly known as feeding the dog. If the dog is not fed for a certain period of time, it can be considered that the program has run away, and the watchdog module will reset the microcontroller. The built-in watchdog is divided into window watchdog and independent watchdog. The differences are as follows:

Different clocks 1. Independent watchdog: The independent watchdog uses an internal dedicated 40Khz low-speed clock and does not need to enable clock operation. 2. Window watchdog: The window watchdog uses the clock of PCLK1, and the clock needs to be enabled before use.


Different interrupts 1. Independent watchdog: The independent watchdog has no interrupt and is directly reset when timeout occurs. 2. Window watchdog: The window watchdog can perform function operations before resetting during interrupts, such as reporting some data errors, etc.


Different usage scenarios 1. Independent watchdog: Independent watchdog is generally used to avoid program runaway or infinite loop. 2. Window watchdog: The window watchdog prevents the program from not executing according to the predetermined logic, such as completing before the ideal environment or timing out after the limit time.


Of course, the circuit forms derived from reset may be more than the above two, but they are basically transformed around the above circuit. Finally, I emphasize that the shorter the RESET trace, the better. The reset circuit must be as close as possible to the MCU, because the reset The wiring from the circuit to the microcontroller may introduce interference from other external factors, causing the microcontroller to be in an unstable state. The content about reset is shared with you here. Have you ever encountered some problems caused by reset?


Reference address:A few tips to teach you how to solve the endless problems of microcontroller reset

Previous article:Detailed explanation of the function and design of the microcontroller reset circuit
Next article:Solution to the problem of under-voltage reset of single-chip microcomputer

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号