In the process of single-chip microcomputer development, from hardware design to software design, almost all of them are completed by the developer himself according to the characteristics of the system. Although this can reduce system costs and improve system adaptability, the debugging of each system takes up 2/3 of the total development time, which shows that the workload of debugging is relatively large. The hardware debugging and software debugging of the single-chip microcomputer system cannot be separated. Many hardware errors are discovered and corrected during software debugging. However, it is usually necessary to eliminate obvious hardware faults first, and then combine with software debugging to further eliminate the faults. It can be seen that hardware debugging is the foundation. If the hardware debugging fails, software design cannot be started. This article discusses the skills of hardware debugging based on the author's experience in the process of single-chip microcomputer development.
When the hardware design is completed from wiring to welding and installation, it enters the hardware debugging stage. The debugging is generally divided into the following steps.
1 Hardware static debugging
1.1 Eliminate logical failures
This type of failure is often caused by process errors during the design and processing of the board. It mainly includes wrong wiring, open circuit, and short circuit. The method to eliminate it is to first carefully compare the processed printed circuit board with the schematic diagram to see if the two are consistent. Special attention should be paid to the power system inspection to prevent power short circuit and polarity errors, and focus on checking whether the system bus (address bus, data bus and control bus) is short-circuited with each other or with other signal lines. If necessary, use the short-circuit test function of the digital multimeter to shorten the troubleshooting time.
1.2 Eliminate component failure
There are two reasons for this type of error: one is that the components are broken when they are purchased; the other is that the components are burned out due to installation errors. You can check whether the components are consistent with the model, specifications and installation requirements of the design. After ensuring that the installation is correct, use the replacement method to eliminate the error.
1.3 Eliminate power failure
Before powering on, be sure to check the amplitude and polarity of the power supply voltage, otherwise it is easy to damage the integrated circuit. After powering on, check the potential of the pins on each plug-in. Generally, check the potential between VCC and GND first. If it is between 5V and 4.8V, it is normal. If there is high voltage, the emulator will be damaged during online emulator debugging, and sometimes the integrated circuit in the application system will be heated and damaged.
2 Online simulation debugging
Online simulation must be done with the help of simulation development devices, oscilloscopes, multimeters and other tools. These tools are the most basic tools for single-chip microcomputer development.
The signal line is the link between 8031 and external devices. If the signal line is connected incorrectly or the timing is incorrect, it will cause read and write errors in the peripheral circuit. The signal lines of the 51 series microcontrollers are generally divided into several categories, such as read and write signal lines, chip select signal lines, clock signal lines, external program memory read select signal (PSEN), address latch signal (ALE), reset signal, etc. Most of these signals are pulse signals. It is difficult to observe pulse signals with the help of an oscilloscope (here refers to a general oscilloscope) using conventional methods, and certain measures must be taken to observe them. This should be achieved using software programming methods. For example, for the chip select signal, running the following small program can detect whether the decoded chip select signal is normal.
MAIN:MOVDPTR,#DPTR
; Send the address to DPTR
MOVXA,@DPTR
; Send the contents of RAM outside the decoded address to ACC
NOP; appropriate delay
SJMPMAIN; loop
After executing the program, you can use an oscilloscope to observe the chip select signal pin of the chip (use an oscilloscope scanning time of 1μs/each grid). At this time, you should see a negative pulse waveform with a period of several microseconds. If you cannot see it, it means that there is an error in the decoding signal.
It is easier to observe level signals. For example, you can directly use an oscilloscope to observe the reset signal. When the reset button is pressed, you can see that the reset pin of 8031 will become high level; once it is released, the level will become low.
In a word, for pulse trigger signals, we need to use software to cooperate, and compile the program into an infinite loop, and then observe it with an oscilloscope; for level trigger signals, you can directly observe it with an oscilloscope.
The following is an explanation of the debugging process of the keyboard and display part in the automatic batching control system. The keyboard and display parts in this system are expanded from the parallel port chip 8155. 8155 is a programmable device, so it is difficult to divide hardware and software. Often during debugging, even if the circuit is installed correctly, there is no certain instruction to direct it to work, and it is impossible to find hardware failures. Therefore, some simple debugging programs should be used to determine whether the hardware is assembled correctly and whether the functions are complete. In this system, the display is debugged first, and then the keyboard is debugged.
(1) Debugging of the display part In order to make the debugging go smoothly, first separate the 8155 from the LED display, so that the LED display can be tested first with a static method, and the specified level is added to the pins that control the digital tube segment and the bit display to see if the digital tube display is consistent with the theory. Inconsistency is generally caused by poor contact of the LED display. The fault must be found and eliminated before testing whether the 8155 circuit works normally. When programming and debugging the 8155, there are two steps: first, after initializing it (that is, writing the command control word, it is best to define it as output mode), send #0FFH to the three ports PA, PB, and PC respectively. At this time, you can use a multimeter to test the bit voltage of each port to be about 3.8 V. If #00H is sent, the bit voltage of each port should be 0.03 V; second, combine the 8155 with the LED, and debug it by compiling a program (preferably using an "8" word loop program) with the help of a development machine. If the debugging passes, you can compile an application program.
(2) Keyboard debugging Generally, after the display debugging is passed, keyboard debugging is relatively simple, and you can use the display to debug the program. Use the development device to set breakpoints for the program. Through the breakpoints, you can check the changes in the key values before and after the breakpoints, so that you can know whether the keyboard is working normally.
The above discusses methods of debugging MCU hardware with the help of simple tools. If these methods are used well, the development cycle of MCU can be greatly shortened.
Baidu Button BEGIN
Previous article:MCU program running encryption
Next article:Single chip multi-channel data acquisition assembly source program
Recommended ReadingLatest update time:2024-11-16 10:50
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Samsung closes another factory in China! N+5 compensation higher than national standards
- Summary of msp430 built-in functions __bic_SR_register(), __delay_cycles(x)
- IMX6-A9 series: display function test
- Flathead RVB2601 board ultrasonic ranging
- Gifts redeemed
- Let’s talk about creativity with the contestants
- The square wave filters out the third harmonic distortion. What is the cause of the distortion? How to improve it? Please help.
- USB Memory Stick Development Kit for TMDX5535EZDSP Series
- STLINK V3SET cannot emulate STM32H750
- Summary of knowledge points for getting started with STM32 microcontrollers