Automatic test method for MCU (Microprogrammed Control Unit)
By integrating the main MCU chip on the peripheral circuit, the problem of program repeated configuration loading in MCU testing is solved, and an automated test process is realized, which significantly improves the MCU testing efficiency.
Patent Information
- Application Number
- CN202411313448.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-09-20
AI Technical Summary
The existing MCU testing methods require multiple write and erase operations to the MCU, which leads to time-consuming and cumbersome testing processes and low testing efficiency.
A master MCU chip is integrated on the peripheral circuit, which is used to connect to the test machine and the MCU to be tested for configuration loading. The master MCU to be tested will be burned into different programs and then tested accordingly.
It realizes that no external manual intervention is required during the MCU testing process, and the repeated configuration loading and testing verification of the program is controlled by the test machine throughout the process, and the chip test verification process is optimized, greatly improving the efficiency of MCU testing and verification.
Smart Images

Figure CN119597565A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of MCU testing, and more specifically, relates to an MCU automatic testing method. Background Art
[0002] Currently, MCU has been widely used in various fields such as smart home, especially MCU with Cortex-M core, which accounts for a very large proportion. There are different testing methods for MCU at each different stage from production to packaging and shipment. The existing testing method requires multiple write and erase operations on MCU. Write vector to test a certain function of MCU, then erase vector and write new vector to test other functions. MCU testing requirements are also high, but one of the difficulties in the current MCU testing process is the problem of code stream loading.
[0003] Usually when testing digital circuits, the test machine gives corresponding stimuli according to their corresponding functions, observes the output response and performs the test. However, when testing MCUs, it is not possible to test by giving stimuli, and different module functions need to be called through programming before testing.
[0004] The MCU has three BOOT modes when it leaves the factory. The first one is to boot from the chip's built-in SRAM, the second one is to boot from the chip's built-in FLASH, and the third one is to boot from a Bootloard reserved in the system memory.
[0005] In the application and routine testing of MCU, we usually need to use an external emulator to configure the MCU to load the program. The current mainstream testing method is to burn the compiled BIN file into the internal FLASH of the MCU through the host PC connected to the emulator, and configure the functions of different modules by writing programs to test and verify the functions of related modules. Since MCU integrates many peripherals and interfaces, if you want to improve the test coverage, you need to configure the program multiple times. Using conventional configuration methods is very time-consuming and cumbersome during the test process, and the efficiency of MCU test verification is low.
[0006] In the invention patent application published on April 5, 2024, with publication number CN117826743A and titled "An Embedded MCU Test System and Test Method", it includes: a chip to be tested and a functional module, a function detection module, and a performance detection module connected to the chip to be tested; in this application, the function of the chip to be tested is detected by the function detection module, and the performance detection module detects the performance of the chip to be tested by the performance detection module; the function detection and performance detection are detected separately, and the performance detection is performed only after the function detection, so that the function detection of the chip to be tested is more comprehensive, ensuring that the life of the chip to be tested is longer. This invention patent application only makes improvements in terms of functional performance detection and does not involve the MCU configuration loader.
[0007] In the invention patent application with publication number CN117434430A and titled “MCU test circuit and MCU test method” published on January 23, 2024, the MCU test circuit includes a main control MCU, an MCU to be tested, an LDO circuit, a voltage adjustment circuit and a voltage acquisition circuit. The main control MCU has an ADC input pin, a DAC input / output pin, a general input pin and a general output pin. The main control MCU is used to adjust the output voltage of the LDO circuit through the DAC input / output pin and the voltage adjustment circuit, and to collect the output voltage of the LDO circuit through the ADC input pin and the voltage acquisition circuit, thereby performing closed-loop control on the LDO circuit to achieve high-precision testing of the PMU of the MCU to be tested. This solution can improve the test efficiency of the PMU monitoring and processing function of the MCU to be tested. The invention adds a main control MCU for testing the MCU to be tested, but the invention only achieves high-precision testing of the PMU of the MCU to be tested. Summary of the invention
[0008] The purpose of the present invention is to overcome the deficiencies of the prior art and provide an MCU automated testing method to optimize the MCU testing and verification process and improve the efficiency of MCU testing and verification.
[0009] To achieve the above-mentioned object of the invention, the MCU automatic testing method of the present invention is characterized by comprising the following steps:
[0010] (1) A main control MCU chip is integrated in the peripheral circuit to connect with the test machine and the MCU chip to be tested to configure the loading program. The test machine controls the main control chip to burn different programs into the MCU chip to be tested and then perform corresponding tests;
[0011] (2) Preparation before testing: Parse the FLM file corresponding to the MCU chip to be tested, i.e., the FLM download algorithm. Convert the debugged X function codes, i.e., the compiled X BIN files, and the parsed FLM download algorithm into a script file of binary data that can be burned into FLASH through a script on the PC. Store it into the main control MCU chip through the JTAG protocol. The main control program of the main control MCU chip receives the command of the test machine through polling to control the reading and writing of the FLASH of the MCU chip to be tested.
[0012] (3) The test machine controls the configuration program of the main control MCU chip: The test machine sends instructions to control the main control MCU chip to configure different function codes to the MCU chip under test to test the internal resources of the MCU chip;
[0013] (4) Main control MCU chip configuration program: The main control MCU chip is connected to the SWDIO / SWCLK pin of the MCU chip under test, and the function code is configured into the MCU chip under test by sending a data stream through the SWD protocol. The debug port DP of the MCU chip under test realizes the physical connection between the debug interface of the main control MCU chip and the MCU chip under test, and the access port AP of the MCU chip under test realizes the access to the kernel resources. After the configuration is successful, the main control MCU chip sends a configuration success message to the test machine;
[0014] (5) Start the execution program: After the test machine receives the configuration success information sent by the main control MCU chip, it configures the MCU chip under test to start the execution program from the internal FLASH;
[0015] (6) Test and verification: The test machine performs tests and verifications on the MCU chip to be tested, including AC and DC parameter tests and peripheral function verification;
[0016] (7) Determine whether the test is finished, that is, whether all X function codes have been configured to the MCU chip to be tested. If finished, the MCU test is completed. If not finished, return to step (3).
[0017] The object of the present invention is achieved in this way.
[0018] The MCU automated testing method of the present invention integrates a main control MCU chip on the peripheral circuit, which is used to connect with the test machine and the device to be tested to configure and load the program, and the test machine controls the main control chip to burn different programs to the MCU to be tested and then perform corresponding tests. The present invention solves the problem that the program needs to be repeatedly configured and loaded online during the MCU testing process, that is, no external manual intervention is required during the MCU testing process, and the repeated configuration loading and test verification of the program are completed by the test machine throughout the process. The present invention optimizes the chip test verification process and greatly improves the efficiency of MCU test verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a flowchart of a specific implementation method of the MCU automatic testing method of the present invention;
[0020] Figure 2 yes Figure 1 The MCU automated testing method shown corresponds to the process architecture diagram;
[0021] Figure 3 yes Figure 1 Schematic diagram of the process of preparation before testing shown;
[0022] Figure 4 yes Figure 1 The flowchart of the test machine control main MCU chip configuration program is shown;
[0023] Figure 5 yes Figure 1 The flowchart of the main control MCU chip configuration program is shown;
[0024] Figure 6 yes Figure 1 The flowchart of performing test verification is shown in FIG. DETAILED DESCRIPTION
[0025] The specific implementation of the present invention is described below in conjunction with the accompanying drawings so that those skilled in the art can better understand the present invention. It should be noted that in the following description, when the detailed description of known functions and designs may dilute the main content of the present invention, these descriptions will be omitted here.
[0026] Figure 1 It is a flow chart of a specific implementation method of the MCU automatic testing method of the present invention.
[0027] In this embodiment, if Figure 1 As shown, the MCU automatic testing method of the present invention comprises the following steps:
[0028] Step S1: Add a main control MCU chip
[0029] In this embodiment, if Figure 2 As shown, a main control MCU chip is integrated in the peripheral circuit, which is used to connect with the test machine ATE (Automatic Test Equipment) and the MCU chip to be tested to configure the loading program, and the main control chip is controlled by the test machine to burn different programs into the MCU chip to be tested before performing corresponding tests. Among them, ATE is a device that tests devices, circuit boards, subsystems, etc. through computer control, and replaces manual labor through computer programming to automatically complete the test sequence.
[0030] Step S2: Preparation before testing
[0031] In this embodiment, if Figure 2 , 3 As shown, the FLM file corresponding to the MCU chip to be tested, that is, the FLM download algorithm, is parsed, and the debugged X function codes Bin1, that is, the compiled X BIN files, and the parsed FLM download algorithm are converted into a script file of binary data that can be burned to FLASH through a script on the PC side, and stored in the main control MCU chip through the JTAG protocol, wherein the main control program of the main control MCU chip receives the command of the test machine through polling to control the reading and writing of the FLASH of the MCU chip to be tested.
[0032] The FLM file corresponding to the MCU chip to be tested, that is, the download algorithm, parses the Flash information and the required symbols and sections in turn, and then creates a binary blob script file of the algorithm program that can be executed in RAM according to the section information. In this way, the BIN or HEX file completed by the MCU debugging compiler to be tested can be converted into a script file of binary data that can be burned to the flash.
[0033] Step S3: Test the machine control main MCU chip configuration program
[0034] MCU internal resources are very rich, usually in the MCU test need to be configured multiple times to improve the MCU internal resource test coverage. Figure 2 , 4 As shown, the test machine ATE sends instructions to control the main control MCU chip to configure different function codes to the MCU chip under test to test the internal resources of the MCU chip.
[0035] Step S4: Main control MCU chip configuration program
[0036] In this embodiment, if Figure 2 , 5 As shown, the main control MCU chip is connected to the SWDIO / SWCLK pin of the MCU chip to be tested, and the function code is configured into the MCU chip to be tested by sending the data code stream through the SWD protocol. The debug port DP of the MCU chip to be tested realizes the physical connection between the debug interface of the main control MCU chip and the MCU chip to be tested, and the access port AP of the MCU chip to be tested realizes the access to the kernel resources. After the configuration is successful, the main control MCU chip sends the configuration success information to the test machine. In this embodiment,
[0037] Step S5: Start the execution program
[0038] In this embodiment, if Figure 2 , 6As shown, after the test machine ATE receives the configuration success information sent by the main control MCU chip, it configures the MCU chip to be tested to start the execution program from the internal FLASH;
[0039] Step S6: Perform test verification
[0040] In this embodiment, if Figure 2 , 6 As shown, the test machine ATE performs testing and verification on the MCU chip to be tested, including AC and DC parameter testing and peripheral function verification.
[0041] Step S7: Determine whether the test is finished, that is, whether all X function codes have been configured to the MCU chip to be tested. If finished, the MCU test is completed. If not finished, return to step S3.
[0042] Although the above describes the illustrative specific embodiments of the present invention to facilitate those skilled in the art to understand the present invention, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those of ordinary skill in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the attached claims, these changes are obvious, and all inventions and creations using the concept of the present invention are protected.
Claims
1. An MCU automated testing method, characterized in that: The following steps are involved: (1) A main control MCU chip is integrated in the peripheral circuit to connect with the test machine and the MCU chip to be tested to configure the loading program. The test machine controls the main control chip to burn different programs into the MCU chip to be tested and then perform corresponding tests; (2) Preparation before testing: Parse the FLM file corresponding to the MCU chip to be tested, i.e., the FLM download algorithm. Convert the debugged X function codes, i.e., the compiled X BIN files, and the parsed FLM download algorithm into a script file of binary data that can be burned into FLASH through a script on the PC. Store it into the main control MCU chip through the JTAG protocol. The main control program of the main control MCU chip receives the command of the test machine through polling to control the reading and writing of the FLASH of the MCU chip to be tested. (3) The test machine controls the configuration program of the main control MCU chip: The test machine sends instructions to control the main control MCU chip to configure different function codes to the MCU chip under test to test the internal resources of the MCU chip; (4) Main control MCU chip configuration program: The main control MCU chip is connected to the SWDIO / SWCLK pin of the MCU chip under test, and the function code is configured into the MCU chip under test by sending a data stream through the SWD protocol. The debug port DP of the MCU chip under test realizes the physical connection between the debug interface of the main control MCU chip and the MCU chip under test, and the access port AP of the MCU chip under test realizes the access to the kernel resources. After the configuration is successful, the main control MCU chip sends a configuration success message to the test machine; (5) Start the execution program: After the test machine receives the configuration success information sent by the main control MCU chip, it configures the MCU chip under test to start the execution program from the internal FLASH; (6) Test and verification: The test machine performs tests and verifications on the MCU chip to be tested, including AC and DC parameter tests and peripheral function verification; (7) Determine whether the test is finished, that is, whether all X function codes have been configured to the MCU chip to be tested. If finished, the MCU test is completed. If not finished, return to step (3).
2. The MCU automated testing method according to claim 1, characterized in that: The test machine is ATE (Automatic Test Equipment).
Citation Information
Patent Citations
MCU test circuit and MCU test method
CN117434430A
Embedded MCU test system and test method
CN117826743A
OTA-based intelligent water softener upgrading method and system
CN112328276A
Chip testing method and system
CN117706322A
Data processing method and device based on check algorithm and computer equipment
CN117971552A