Smart test
Design and application scope of intelligent test system based on single chip microcomputer
1 Introduction
With the popularization of electronic and electrical products in social life, many domestic small and medium-sized enterprises have also begun to develop and produce such products to meet the needs of the market. However, due to the limitations of manpower and material resources of small and medium-sized enterprises, they often focus on their main experience In terms of product production, the factory inspection of the product is not perfect, resulting in a high product repair rate. From the actual situation, a large part of the fault that causes the repair can be found during the factory inspection. However, because most of the domestic small and medium-sized enterprises rely on manual testing with some instruments and meters, the testing efficiency is low, the testing area is not wide, and there are situations such as false detections and false detections.
The introduction of the intelligent test system can solve this kind of contradiction and help companies improve the efficiency of product testing. The following will take an intelligent test system for the main board of a mahjong machine as an example to fully explain the design principle.
2, SST89E58RD2 feature introduction
SST87E58RD2 is an 80C51 microcontroller, including 32KB+8KB FLASH and 256+768B data RAM. The typical feature of SST89E58RD2 is his ×2 mode option. With this feature, the designer can make the application use the traditional 80C51 clock frequency (each machine cycle contains 12 clocks) or ×2 mode (each machine cycle contains 6 Clock) running at the clock frequency.
FLASH program memory supports traditional parallel programming and serial in-system programming (ISP). ISP allows repeated programming of the devices in the finished product under software control, and SST89E58RD2 can also use in-application programming (IAP), allowing two pieces of FLASH program memory to be reconfigured at any time, even when the application is running.
SST89E58CD2 features are as follows:
80C51 processing unit;
5V working voltage, operating frequency is 0-40MHz;
64KB on-chip FLASH program memory, with ISP (in-system programming) and IAP (in-application programming) functions;
Support 12 clock (default) or 6 clock mode by software or ISP;
SPI (serial peripheral interface) and enhanced UART;
PCA (Programmable Counter Array), with PWM and capture/comparison functions;
4 8-bit I/O ports (P0-P3), 1 4-bit I/O port (P4);
3 16-bit timers/counters;
Programmable Watchdog Timer (WDT);
10 interrupt sources, 4 interrupt priority levels;
2 DPTR registers;
Low EMI mode (ALE disabled);
compatible with TTL and CMOS logic levels;
power failure detection;
low power consumption mode (power-down mode, external interrupt wake-up, idle mode).
3, the principle of intelligent test system
11.png
This intelligent test system is based on SST89E58RD2, and its functional block diagram is shown in Figure 1, including:
SPI port line is mainly used to program and communicate with the tested motherboard;
I2C bus to read data from the external E2PROM in the tested motherboard;
RS232 circuit is used for communication with the upper computer;
The external FLASH mainly stores the program object code of the tested motherboard, and AT29C010A is selected;
Indicator circuit, each fault point is indicated by an indicator, there are 32 in total, and 4 pieces of 74HC595 are used as output drive circuits;
2 stepping buttons are used for stepping control during the test, and the control line is directly connected to the P1.1 and P1.2 port lines of SST89E58RD2;
LED display It is used for the display of test step, controlled by a 74HC595;
DI input circuit select 74HC165 logic chip, parallel input and string output;
DO output circuit selects 74HC595 logic chip, serial in and out;
Because there are many peripheral interface chips of the single-chip microcomputer, GAL16V8D is used as the control decoding circuit.
4, intelligent test system function
The test object of the intelligent test system in this article is the main board of the automatic mahjong machine. The design of the system is explained below.
The main test items of the automatic mahjong machine include:
Mainboard power supply: internal 3 block power supplies; 12 9V AC DO signals, 16 DI signals; 4 power signals; 1 main power supply and 3 branch power supplies, 1 buzzer, 1 E2PROM with I2C; One SPI port is used to communicate and program with the intelligent test system.
The main board of the mahjong machine uses AT89S52, which has the function of system programming (ISP) through the SPI port.
For these hardware functions of the mahjong machine motherboard, the intelligent test system has the following functional interfaces;
24 DO outputs are used to detect the DI signal of the tested motherboard;
16 AC/DC DI inputs are used to detect the DO signal of the tested motherboard;
An SPI bus interface is used for the program and communication of the tested motherboard;
An I2C interface is used to read and write the E2PROM of the I2C of the tested motherboard.
22.png
The test steps are as follows:
(1) Power test of the tested motherboard
The nominal value of the power supply is 5V, and the judgment condition is whether it is between 4.75 and 5.25V, which can be judged by a SHMILT comparator built by an N555, and the indicator shows whether the result is normal. If the power supply test fails, the subsequent test steps will not be performed, and a buzzer will prompt.
(2) SPI connection test and test program of the tested motherboard
Through the SPI port serial command to read the feature code of the tested motherboard CPU, and judge it as AT89S52 chip (the single-chip model selected for the mahjong machine motherboard) through identification, that is, the tested motherboard is considered to be connected. Because for the SST89E58 single-chip microcomputer, its SPI port is a complete SPI port, but the SPI port of the AT89E52 single-chip microcomputer is used for the ISP function of FLASH. When the feature code is read correctly, it indicates that the SPI port is connected normally. At this time, the test system The test program will be tested on the tested motherboard. The code of the test program will be placed in the space where the FLASH address of SST89E58RD2 is 0X7000-0X7FF. After completion, the tested host will be able to cooperate with the intelligent test system for testing.
(3) DI function test of the tested motherboard
Divide the 16-point DI of the tested motherboard into two groups, one set of 8 points, which are connected to the DO port of the test system. After the DO signal is output by the test system and sampled by the tested motherboard, the sampled data is read back through the SPI port communication for comparison. The similarities and differences between the output signal and the sampled signal, determine whether there is an abnormality in the channel, if there is an abnormality, it will be displayed by the fault indicator.
(4) DO function test of the tested motherboard
Divide the 12 DOs of the tested mainboard into 2 groups, an 8-point group and a 4-point group, connect to the DI port of the test system, and communicate commands through the SPI port to allow the tested mainboard to output a specific state, and the test system will sample through DI , Compare the similarities and differences between the sampled data and the output characteristic data, determine whether there is a channel abnormality, if there is an abnormality, it will be displayed by the fault indicator.
(5) Power-off data saving test of the tested motherboard
Because the tested motherboard has another very important power-off data saving function, this function enables the CPU to store some characteristic data in the external E2PROM within a limited time once the power detection circuit inside the tested motherboard detects the loss of power. (AT24C64). For this function, the test system will directly read the data inside the E2PROM through the I2C bus to determine whether the power-off data saving is valid, and indicate it through the indicator.
(6) Check the fault indicator and complete the test
After the above 5 steps are completed, if there is no indicator indicating a fault, you can press the button to transfer the program of the mahjong machine main board to AT89S52 to complete the whole test. If you find that there is still a fault, press the back button to test again in order to confirm the fault.
5, the key program code of the intelligent test system
6. Conclusion
The intelligent test system implemented in this design has been applied to a manufacturer of automatic mahjong machines and has achieved good application results. In the past, the factory's products used manual inspection mode. It took 20 minutes to complete the inspection, and the scope of the inspection was limited to the main indicators; after the introduction of this intelligent inspection system, it only takes 2 minutes to complete the inspection of the product. And the scope of detection covers most of the functions. When encountering products that cannot pass the detection, you can quickly and accurately find the source of the fault according to the prompts of the intelligent detection system, which greatly improves the production efficiency.
The intelligent test system can also be further developed:
(1) At present, many electronic products need to undergo live aging test before leaving the factory, but only live and no-load. If the intelligent test system is introduced into the aging test to simulate the work load of the product, the product will work at full load during the aging test. Products that can pass the aging test will show more stable and reliable performance in practical applications.
(2) Electronic products need to be marked with the serial number and the version number of the product before they leave the factory. How to effectively control the product entity, serial number and version number has always been a thorny issue for many manufacturers. If the intelligent test system is introduced into the factory The serial number and version number management of the product will also be very effective. Use the extended function of the upper computer of the intelligent test system to connect to the computer through RS232. The intelligent test system has obtained the version number of the product before testing the product program, and then The factory serial number is calculated according to a series of attributes such as the date of the day and the factory order. When the product passes the test, the intelligent test system sends the serial number and version number to the upper computer, and the special software in the computer stores the serial number and version number. Enter the database and mark the serial number on the product.
At present, the intelligent test system realized by this design is undergoing the second phase of development. It is planned to introduce the intelligent test system into aging test and factory serial number management. After the successful development, it will greatly improve the performance of the system and increase the scope of application of the system.