1. Question your assumptions
Are you running the right code? is the power plug plugged in? For example, the network connection failed, is not you accidentally kicked off the cable connector? For example, if the car doesn't start, is the tank out of oil? Sometimes we see a problem, usually see the right problem in a particular location, but the problem is in the upstream or the underlying driver, but the system does not have the correct operating conditions, there is a strange performance.
2. Start from the beginning
is the memory initialized correctly? Is the power switch turned on? For example, if your program needs to initialize memory, global variables, local variables, and you do not, then the situation will be very bad, it will let you run the test itself is correct, to the customer presentation error.
3. Test the tool
Is the compiler's parameters set correctly? is the measuring tool out of power?
Actual case:
- When using the IAP Bootstrapper, the application's starting address should be set correctly in the compiler, or it will not run after the download is complete.
- In the selection of single-chip microcomputer, the model should be correct, assuming that you use the MCU memory only 8K, compile-time selection of the MCU model Memory 16K, the program actually uses 8.2K of memory, compile will not error, but run, the program may randomly crash.
- Before the use of voltage source power supply, the circuit board a power on the display current 800mA, but the system can run, but some hardware error, at first suspected of hardware problems, and later found that the power supply capacity of the voltage source is insufficient.
- The tools themselves also have bugs, such as compilers, because they are also designed by engineers, why is it more trustworthy than your software? Keil compiler itself also has a bug, before using Keil C51, where a bug to filter the program in the Chinese characters within the "0xFD", resulting in a program error, in the use of lattice Chinese characters display, I was actually encountered and must use the domestic users to provide the bug patch to solve!
Hardware and Software debugging nine method: seventh rule Check Plug