Can't run after the chip is stuck? The data in Flash is inexplicably changed or missing during use? The loss of the program may not work properly, causing the entire system to crash. Let's see what causes the data to change abnormally.
1. Incorrect operation of the user code on Flash causes the program to be lost or incorrectly rewritten.
Say good data, where have you gone?
For example, in code that has a write or erase operation to Flash, if the user accidentally calls the write or erase function or just executes the Flash erase or write function because the program is running away, this will naturally result in data loss. Or change. For the above situation, multiple variables that allow operation can be set in the program. When a write or erase operation is performed, these variables are judged, and the corresponding operations are performed only when the conditions are all satisfied. In some systems that do not require an erase or write operation, write protection or erase protection settings for the memory area can effectively prevent data from being accidentally modified. The controllability of writing or erasing can basically avoid this situation.
Figure 1 Flash protection
2, power failure
Figure 2 Power supply noise is severe
The abnormality of the power supply voltage may cause the system microcontroller system to work abnormally. For example, the output voltage is less than the minimum voltage required for the operation of the single-chip system, the output voltage is not clean, the noise is serious, etc. These are easy to cause the logic disorder of the internal circuit of the single-chip microcomputer. The read and write signals are in an unstable state. It is possible to generate write operations that satisfy Flash, which can cause serious damage to the system. For the above situation, the power monitoring chip or the power monitoring circuit of the MCU itself can be added to the system, and the operation of the Flash area is prohibited in the case of abnormal power supply.
3, the system clock is unstable
Regardless of the internal Flash or external Flash, the instability of the system clock will result in the MCU not getting reliable working timing signals, which will have unpredictable consequences when reading and writing Flash.
4. Environmental interference
There are many possible reasons for environmental interference, such as high temperature welding during production, static electricity, temperature and humidity of the use environment, strong magnetic field, etc., which may affect the stability of Flash or the entire system. There are many factors in environmental interference, so we will not discuss it here.
Other Electrical Equipment,Switch Cabinet Wall Mount,Electrical Switch Cabinet,Network Switch Cabinet Wall Mount
Shaoxing AnFu Energy Equipment Co.Ltd , https://www.sxanfu.com