Method for entering test mode in MCU (Microprogrammed Control Unit) working mode
By using the VCC_IN signal and IO control in the MCU working mode, the MCU's online test mode entry is realized, which solves the problem of the MCU being unable to enter the test mode again, and achieves convenient program updates and functional mode stability.
Patent Information
- Application Number
- CN202410667882.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-08-30
AI Technical Summary
Existing MCUs cannot enter the test mode after entering the working mode, which makes the program update cumbersome. The chip needs to be removed and re-programmed, making it impossible to easily update the product in the hands of users.
By using the VCC_IN signal to send high and low level changes in the MCU working mode, latching a specific level state to enter the live test mode, using the shift register and debug_req to set up, entering the test mode, and switching to digital input/output mode through IO Perform program burning, support control signals of battery power supply and power supply mode, and realize online program update.
It realizes the online program update of MCU, eliminating the trouble of dismantling the chip and re-burning it, reducing the probability of entering the test mode by mistake, and ensuring the normal operation of the functional mode.
Smart Images

Figure CN118566696A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of chip testing technology, and in particular to a method for entering a test mode under an MCU working mode. Background Art
[0002] The existing MCU can enter the test mode for burning and debugging before the chip enters the working mode, but after the chip enters the working mode, the entrance to the test mode will be closed and it is impossible to enter the test mode;
[0003] When a product using the MCU is completed, it is impossible to enter the test mode after entering the working mode. If the program in the chip needs to be updated, the chip needs to be removed from the circuit board and then burned through the host computer to modify the program. This will make the update program very cumbersome and it is not easy to update the products that are already in use by users. Therefore, there is room for improvement. Summary of the invention
[0004] The purpose of the present invention is to solve the shortcomings of the prior art and propose a method for entering the test mode in the MCU working mode. The advantage is that the trouble of removing the chip and re-burning is saved, and the old product can be updated online, and users who already have the product can also conveniently update the finished product in their hands.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] A method for entering a test mode in an MCU working mode comprises the following steps:
[0007] Step 1: When the MCU is in working mode or sleep mode, increase VDD to make VCC_IN send a high level. The MCU detects the high level and enters the VCC level change interrupt. After an interval, VCC sends a low level. The high and low levels constitute the START bit of the command to enter the power mode.
[0008] Step 2: Send the command to enter the live test mode by changing the VCC level. If the VCC level state is maintained for 500ns to 1us and then changes, the VCC level state before the change will be latched into the live test mode command register. If the VCC state is maintained for too long or too short, the live mode command state will be exited.
[0009] Step 3: Use the shift register to latch 32'h5a5a55aa, set debug_req, enter the test mode, and perform programming or test mode operations; if three VCC_IN low levels or three high levels are latched continuously, or the command input is wrong, the live test mode command input will be exited, and the START signal needs to be sent again;
[0010] Step 4: In the test mode, the IOs related to the test mode will automatically switch to the digital input / output mode to enable the operation of CPU instructions and the reading and writing of the memory through the method of externally injecting instructions; after sending the command to exit the test mode, the test mode can be exited. After exiting, the entire system is reset, and after reloading the option, it re-enters the working mode.
[0011] The present invention is further configured such that the MCU is composed of a digital circuit and an analog circuit. The analog circuit includes an ADC module, a DAC module, an OSC module, an LDO module, a VBG module, an RST module, and an IO module to implement various functions of generating or processing different analog signals.
[0012] The present invention is further configured such that a module for detecting the charging voltage and the battery voltage VMAX is added to the digital circuit and the analog circuit. The battery voltage VMAX module outputs the comparison result of the two voltages to the digital part of the MCU through the VCC_IN signal.
[0013] The present invention is further configured such that the MCU includes a number of IO port modules. The number of IO port modules will be connected to the positions required inside the chip and will also be connected to the pins outside the chip through the package leads.
[0014] The present invention is further configured such that the MCU supports the battery power supply (VCC) mode and the power supply (VDD) mode.
[0015] The present invention is further configured such that the battery voltage VMAX module is used to compare the voltage magnitudes of the battery power supply and the power supply. When VDD > VCC, VCC_IN will output a high level; when VDD < VCC, VCC_IN will output a low level.
[0016] The present invention is further configured such that the power supply (VDD) is used to send a digital sequence to the MCU through VCC_IN. When the MCU receives a specific sequence, it enters the test mode.
[0017] The present invention is further configured such that the battery power supply (VCC) and the power supply (VDD) will send control signals vcc_in representing different power supply modes to the MCU in different modes; when vcc_in is at a high level, it represents the power supply mode, and when vcc_in is at a low level, it represents the battery power supply mode.
[0018] The beneficial effects of the present invention are:
[0019] 1. The method of entering the test mode in the MCU working mode. The MCU using this method can directly re-burn the program by updating the firmware through the chip's charging data cable, eliminating the trouble of removing the chip and re-burning. In addition, the old product can update the program online, and users who already have the product can also easily update the finished product in their hands;
[0020] 2. The method of entering the test mode under the MCU working mode. Under the MCU working mode, after the vcc_in sequence is input, the corresponding test IO can enter the state of inputting the test command, and the program can be burned with the help of this IO; and the sequence requirements of vcc_in also determine that the probability of entering the test mode from the functional mode by mistake is very low, which can ensure the normal operation of the functional mode. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A test flow diagram of a method for entering a test mode in an MCU working mode proposed by the present invention;
[0022] Figure 2 A schematic diagram of the MCU composition structure of a method for entering a test mode under an MCU working mode proposed by the present invention;
[0023] Figure 3 A schematic diagram of circuit input and output of a method for entering a test mode under an MCU working mode proposed by the present invention;
[0024] Figure 4 A schematic diagram of a signal entering a test mode in a method for entering a test mode in an MCU working mode proposed by the present invention;
[0025] Figure 5 A circuit diagram of a method for entering a test mode in an MCU working mode proposed by the present invention. DETAILED DESCRIPTION
[0026] The technical solution of this patent is further described in detail below in conjunction with specific implementation methods.
[0027] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0028] Reference Figure 1 , a method for entering a test mode in an MCU working mode, comprising the following steps:
[0029] Step 1: When the MCU is in working mode or sleep mode, increase VDD to make VCC_IN send a high level. The MCU detects the high level and enters the VCC level change interrupt. After an interval, VCC sends a low level. The high and low levels constitute the START bit of the command to enter the power mode.
[0030] Step 2: Send the command to enter the live test mode by changing the VCC level. If the VCC level state is maintained for 500ns to 1us and then changes, the VCC level state before the change will be latched into the live test mode command register. If the VCC state is maintained for too long or too short, the live mode command state will be exited.
[0031] Step 3: Use the shift register to latch 32'h5a5a55aa, set debug_req, enter the test mode, and perform programming or test mode operations; if three VCC_IN low levels or three high levels are latched continuously, or the command input is wrong, the live test mode command input will be exited, and the START signal needs to be sent again;
[0032] Step 4: When in test mode, the IO related to the test mode will automatically switch to digital input / output mode to operate CPU instructions and read and write memory through external instruction injection; after sending the exit test mode command, you can exit the test mode, and after exiting, the entire system will be reset, and reload otpion to re-enter the working mode.
[0033] The MCU that adopts this method can directly re-burn the program by updating the firmware through the chip's charging data cable, eliminating the trouble of removing the chip and re-burning. In addition, old products can update the program online, and users who already own the product can also easily update the finished product in their hands.
[0034] Reference Figure 2-5 ,MCU is composed of digital circuits and analog circuits. The analog circuits include ADC module, DAC module, OSC module, LDO module, VBG module, RST module and IO module to realize various analog signal generation or processing functions.
[0035] In this embodiment, modules for detecting charging voltage and battery voltage VMAX are added to the digital circuit and the analog circuit. The battery voltage VMAX module outputs the comparison result of the two voltages to the digital part of the MCU through the VCC_IN signal. The MCU includes several IO port modules, which are connected to the required positions inside the chip and are also connected to the pins outside the chip through the package leads. The IO port can serve as a portal for interaction between the inside and outside of the chip, and plays a vital role.
[0036] Furthermore, the MCU supports the battery-powered (VCC) mode and the power supply-powered (VDD) mode; the battery voltage VMAX module is used to compare the voltages of the battery-powered and the power supply-powered. When VDD > VCC, VCC_IN will output a high level; when VDD < VCC, VCC_IN will output a low level.
[0037] It is worth mentioning that to solve the problem that the GPIO cannot enter the jtag protocol mode, this method借助 a vcc_in control signal. The power supply (VDD) is used to send a digital sequence to the MCU through VCC_IN. When the MCU receives a specific sequence, it enters the test mode; the battery-powered (VCC) and the power supply-powered (VDD) will send control signals vcc_in representing different power supply modes to the MCU in different modes; when vcc_in is at a high level, it represents being powered by the power supply, and when vcc_in is at a low level, it represents being powered by the battery. In the MCU working mode, after the vcc_in sequence is input, the corresponding tested IO can enter the state of inputting test commands, and the program can be burned through this IO; and the sequence requirement of vcc_in also determines that the probability of accidental operation entering the test mode from the function mode is very low, which can ensure the normal operation of the function mode.
[0038] As mentioned above, only the preferred specific implementation manner of the present invention is described, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, makes equivalent substitutions or changes, and all should be covered by the protection scope of the present invention.
Claims
1. A method for entering a test mode in an MCU working mode, characterized in that: It includes the following steps: Step 1: When the MCU is in the working mode or sleep mode, raise VDD to make VCC_IN send a high level. The MCU detects the high level and enters the VCC level change interrupt. After an interval, VCC sends a low level. The high and low levels form the START bit of the command to enter the powered-on mode; Step 2: Send a command to enter the powered-on test mode through the VCC high and low changes. If the VCC level state changes after remaining for 500 ns to 1 us, the VCC level state before the change will be latched into the powered-on test mode command register. If the VCC state remains too long or too short, the powered-on mode command state will be exited; Step 3: Use the shift register to latch 32’h5a5a55aa, then set debug_req and enter the test mode, where programming or test mode operations can be performed. If three consecutive low levels or three high levels of VCC_IN are latched, or the command input is incorrect, the powered-on test mode command input will be exited and a START signal needs to be sent again; Step 4: In the test mode, the IOs related to the test mode will automatically switch to the digital input / output mode to enable the operation of CPU instructions and the reading and writing of the memory by means of externally injecting instructions. After sending the command to exit the test mode, the test mode can be exited. After exiting, the entire system is reset, and after reloading the option, it re-enters the working mode.
2. The method for entering a test mode in an MCU working mode according to claim 1, characterized in that: The MCU is composed of a digital circuit and an analog circuit. The analog circuit includes an ADC module, a DAC module, an OSC module, an LDO module, a VBG module, an RST module, and an IO module to implement various functions of generating or processing different analog signals.
3. The method for entering a test mode in an MCU working mode according to claim 2, characterized in that: A module for detecting the charging voltage and the battery voltage VMAX is added to the digital circuit and the analog circuit. The battery voltage VMAX module outputs the comparison result of the two voltages to the digital part of the MCU through the VCC_IN signal.
4. The method for entering a test mode in an MCU working mode according to claim 3, characterized in that: The MCU contains several IO port modules. The several IO port modules are connected to the positions required inside the chip and are also connected to the external pins of the chip through the package leads.
5. The method for entering a test mode in an MCU working mode according to claim 1, characterized in that: The MCU supports the battery power supply (VCC) mode and the power supply (VDD) mode.
6. The method for entering a test mode in an MCU working mode according to claim 3, characterized in that: The battery voltage VMAX module is used to compare the voltage magnitudes of the battery power supply and the power supply. When VDD > VCC, VCC_IN outputs a high level; when VDD < VCC, VCC_IN outputs a low level.
7. The method for entering a test mode in an MCU working mode according to claim 6, characterized in that: The power supply (VDD) is used to send a digital sequence to the MCU through VCC_IN. When the MCU receives a specific sequence, it enters the test mode.
8. The method for entering a test mode in an MCU working mode according to claim 7, characterized in that: The battery power supply (VCC) and the power supply (VDD) send control signals vcc_in representing different power supply modes to the MCU in different modes. When vcc_in is at a high level, it represents the power supply mode, and when vcc_in is at a low level, it represents the battery power supply mode.
