Ram module detection method, device and storage medium based on single-chip microcomputer

By subdividing the RAM module into buffer, general-purpose, and stack areas and detecting them during the microcontroller's operation intervals, the problem of unsuitable detection frequency in existing technologies is solved, enabling real-time and continuous detection of the RAM module and improving device safety and reliability.

CN116259356BActive Publication Date: 2026-05-08QINGDAO HAIER AIR CONDITIONER GENERAL CORP LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
QINGDAO HAIER AIR CONDITIONER GENERAL CORP LTD
Filing Date
2023-01-11
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

The current technology does not have an appropriate testing frequency for RAM modules, which cannot effectively guarantee the normal status of the air conditioner RAM modules after they are sold, thus posing a safety hazard.

Method used

The RAM module is divided into a buffer area, a general area, and a stack area. Based on the microcontroller's operating speed and the program runtime threshold, it is further subdivided into multiple sub-areas. These are then detected sequentially during the program's execution intervals, generating abnormal alarm information and stopping the detection.

Benefits of technology

It enables segmented, time-division, and cyclical continuous detection of RAM modules, increasing the detection frequency, ensuring device safety, and without increasing additional device hardware circuitry and configuration costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116259356B_ABST
    Figure CN116259356B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of household appliance control, and particularly relates to a RAM module detection method based on a single-chip microcomputer, equipment and a storage medium. The method comprises the following steps: obtaining a detection running duration according to the running rate of the single-chip microcomputer and a program running duration threshold; dividing the buffer area, the general area and the stack area into a plurality of buffer sub-areas, a plurality of general sub-areas and a plurality of stack sub-areas respectively according to the detection running duration; detecting each sub-area in each area in turn, and generating and playing alarm information and stopping the detection when an abnormal result is detected. The method of the application utilizes the equipment program running gap, does not additionally increase the power-on running duration of the equipment, realizes the segmented, time-sharing and cyclic uninterrupted detection of the RAM, the detection process accompanies the entire life cycle of the equipment, is more reliable, does not increase the additional equipment hardware circuit, and thus does not increase the equipment configuration cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of home appliance control technology, specifically relating to a method, device and storage medium for detecting RAM modules based on a microcontroller. Background Technology

[0002] The main control component in a variable frequency air conditioner is a microcontroller unit (MCU). The MCU's storage modules include read-only memory (ROM) and random access memory (RAM). The RAM module is the internal memory that directly exchanges data with the MCU and is used constantly during air conditioner operation. Furthermore, after a period of use, if the MCU's RAM module suffers partial damage from external force or aging, it will affect the MCU's original control logic. Starting the air conditioner under these circumstances may cause abnormal operation, potentially leading to serious consequences such as short circuits and fires, or other unpredictable problems.

[0003] Based on this, existing technologies require testing the RAM module to determine its functionality. This testing primarily includes: 1) Testing the MCU before it leaves the factory, using wafer testing, packaging testing, etc., to ensure the RAM module is functioning correctly; 2) Testing the air conditioner before it leaves the factory, using whole-machine functional testing, whole-machine reliability testing, etc., to ensure the RAM module used in the air conditioner is working properly; 3) Testing the air conditioner when it is powered on (when the user closes the main power switch), to ensure the RAM module of the inverter board's main control MCU is functioning correctly when the air conditioner is first powered on; 4) Testing during compressor downtime, to ensure the RAM module of the inverter board's main control MCU is functioning correctly each time the compressor starts.

[0004] Of the methods mentioned above, the first two are only suitable for testing before the air conditioner leaves the factory and cannot guarantee the functionality of the RAM module after the air conditioner is sold. The third method increases the interval between each power-on cycle, and for users who don't disconnect the power for extended periods, it may prevent timely testing of the RAM module, posing a safety hazard. The fourth method utilizes the compressor's shutdown protection period for testing, but since the interval between each compressor start-up and shutdown is not fixed, the testing frequency is also inconsistent, still presenting certain risks. In summary, all the existing testing methods described above have the problem of unsuitable testing frequency for the RAM module. Summary of the Invention

[0005] This application provides a method, device, and storage medium for detecting RAM modules based on a microcontroller, in order to solve the technical problem of unsuitable detection frequency for RAM modules in the prior art.

[0006] This invention provides a method for detecting RAM modules based on a microcontroller. The RAM module is divided into a buffer area, a general area, and a stack area. The method includes:

[0007] The detection runtime of the RAM module is determined based on the program runtime threshold of the running program when the microcontroller is normally executing the device task.

[0008] Based on the operating speed of the microcontroller, the number of bytes of the RAM module area that can be tested each time the RAM module is called is determined. Then, combined with the detection runtime, the buffer area, general area and stack area are divided into multiple buffer sub-areas, multiple general sub-areas and multiple stack sub-areas respectively.

[0009] Each buffer sub-region within the buffer area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped.

[0010] After the buffer area detection is completed, each general sub-area within the general area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped.

[0011] After the general area detection is completed, each stack sub-area within the stack area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped.

[0012] One possible design also includes:

[0013] Monitor whether any programs are currently running;

[0014] After dividing the buffer area, general area, and stack area into multiple buffer sub-regions, multiple general sub-regions, and multiple stack sub-regions respectively according to the detection runtime, the method further includes:

[0015] The detection begins when no program is currently running.

[0016] In one possible design, the step of sequentially detecting each buffer sub-region within the buffer region, generating and playing an alarm message and stopping detection when an abnormal result is detected includes:

[0017] Test values ​​are written sequentially into each buffer sub-region of the buffer region;

[0018] Obtain the read value of the buffer sub-region;

[0019] Determine whether the test value is equal to the read value. If not, generate and play an alarm message and stop detection. If yes, continue detecting the next buffer sub-region until the buffer region detection is completed.

[0020] In one possible design, after the buffer area detection is completed, each general sub-region within the general area is sequentially detected, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped, including:

[0021] After the buffer area detection is completed, each general sub-region within the general area is backed up to the buffer area in sequence to obtain a general sub-region backup;

[0022] Write the test value into the general sub-region and obtain the read value of the general sub-region;

[0023] Determine whether the test value is equal to the read value. If not, generate and play an alarm message and stop detection. If yes, restore the general sub-region backup to the general sub-region and continue to detect the next general sub-region until the general region detection is completed.

[0024] In one possible design, after the detection of the general area is completed, each stack sub-region within the stack area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped, including:

[0025] After the general area detection is completed, a temporary stack area is created in the buffer area to replace the stack area being tested;

[0026] The tested stack sub-region is backed up to the buffer area to obtain the stack sub-region backup;

[0027] Write the test value into the tested stack sub-region;

[0028] Obtain the read value of the tested stack sub-region;

[0029] Determine whether the test value is equal to the read value. If not, generate and play an alarm message and stop detection. If yes, restore the stack sub-region backup to the stack sub-region under test, delete the temporary stack region, and continue to detect the next stack sub-region until the stack region detection is completed.

[0030] In one possible design, the RAM module is divided into a buffer area, a general area, and a stack area according to its function.

[0031] Secondly, this application provides a RAM module testing device based on a microcontroller, wherein the RAM module is divided into a buffer area, a general area, and a stack area, and the device includes:

[0032] The acquisition module is used to determine the detection runtime of the RAM module based on the program runtime threshold of the running program when the microcontroller is normally executing the device task.

[0033] The partitioning module is used to determine the number of bytes of RAM module area that can be tested each time the RAM module is called, based on the operating speed of the microcontroller. Then, in combination with the detection runtime, the buffer area, general area and stack area are divided into multiple buffer sub-areas, multiple general sub-areas and multiple stack sub-areas respectively.

[0034] The detection module is used to sequentially detect each buffer sub-region within the buffer area, and generate and play alarm information and stop detection when an abnormal result is detected; after the buffer area detection is completed, it sequentially detects each general sub-region within the general area, and generates and plays alarm information and stops detection when an abnormal result is detected; after the general area detection is completed, it sequentially detects each stack sub-region within the stack area, and generates and plays alarm information and stops detection when an abnormal result is detected.

[0035] Thirdly, this application provides a microcontroller, including: a processor, and a memory communicatively connected to the processor, the memory including a RAM module and a ROM module;

[0036] The ROM module is used to store computer-executed instructions;

[0037] The processor executes the computer execution instructions stored in the ROM module to implement a microcontroller-based RAM module detection method.

[0038] Fourthly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0039] The memory stores computer-executed instructions;

[0040] The processor executes computer execution instructions stored in the memory to implement a microcontroller-based RAM module detection method.

[0041] Fifthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement a microcontroller-based RAM module detection method.

[0042] Those skilled in the art will understand that the microcontroller-based RAM module detection method, device, and storage medium provided by the present invention obtain the detection runtime based on the microcontroller's operating speed and program runtime threshold; based on the detection runtime, the buffer area, general area, and stack area are respectively divided into multiple buffer sub-areas, multiple general sub-areas, and multiple stack sub-areas; each buffer sub-area within the buffer area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped; after the buffer area detection is completed, each general sub-area within the general area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped; after the general area detection is completed, each stack sub-area within the stack area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped. This achieves segmented, time-divisional, and cyclical uninterrupted detection of the RAM module. This detection process accompanies the entire life cycle of the device, has a high detection frequency, and is therefore more reliable, and does not add additional device hardware circuitry, thus not increasing device configuration costs. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 A schematic diagram of the microcontroller's composition structure provided in the embodiments of this application;

[0045] Figure 2 A flowchart illustrating the microcontroller-based RAM module detection method provided in this application embodiment. Figure 1 ;

[0046] Figure 3a A flowchart illustrating the microcontroller-based RAM module detection method provided in this application embodiment. Figure 2 ;

[0047] Figure 3b A schematic flowchart of the RAM module detection method based on a microcontroller provided in this application embodiment is shown in Figure 3.

[0048] Figure 4 A schematic diagram of the structure of a microcontroller-based RAM module testing device provided in an embodiment of this application;

[0049] Figure 5 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0050] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.

[0051] Figure 1 This is a schematic diagram of the microcontroller's structure provided in an embodiment of this application. Figure 1 As shown, the microcontroller unit 10 (MCU) includes a processor 101 and a memory 102. The processor 101 and the memory 102 are communicatively connected. The memory 102 includes two storage partitions: a read-only memory 1021 (ROM) module and a random access memory 1022 (RAM) module. The RAM module serves as the main data storage module of the internal memory and participates in the data exchange function of the MCU, while the ROM module serves as the instruction storage module of the internal memory and stores various fixed programs and data of the MCU.

[0052] Current smart home appliances all require microcontrollers to realize various intelligent functions. RAM modules, as the main data storage modules, are especially needed in the use of variable frequency smart home appliances such as variable frequency air conditioners, variable frequency refrigerators, and variable frequency washing machines. However, with the long-term use of RAM modules, if they are partially damaged by external force or fail due to aging, it will affect the control logic of the original program of the microcontroller. If the device is started normally under such circumstances, it may cause abnormal operation of the device, and in severe cases, it may cause serious consequences such as short circuits and fires. Therefore, it is necessary to monitor the status of RAM modules frequently.

[0053] Existing methods for testing the functionality of RAM modules mainly include: pre-shipment testing of microcontrollers, pre-shipment testing of smart home appliances, and testing when smart home appliances are powered on. The first two methods cannot provide long-term testing for smart devices, especially for aging issues, and cannot provide continuous monitoring. Currently, long-term monitoring mainly utilizes the power-on or compressor shutdown protection time. However, the testing time for these two methods is not fixed, and the long testing time will occupy the normal usage time of the device. Moreover, there is a possibility that the device will not be tested for a long time, thus posing a safety hazard.

[0054] The RAM module detection method based on a microcontroller provided in this application obtains the detection runtime of the microcontroller by measuring its operating speed and a program runtime threshold. Then, based on the detection runtime, the buffer area is divided into multiple buffer sub-regions, the general area into multiple general sub-regions, and the stack area into multiple stack sub-regions. Then, all sub-regions within each region are detected sequentially in a cyclical order of buffer area, general area, and stack area. Since the division of sub-regions is determined based on the detection runtime, which is related to the microcontroller's operating speed and the program runtime threshold, the detection runtime is kept within the program execution interval after the area to be detected is subdivided. Therefore, the RAM module can be detected in real time without affecting the normal operation of the program, aiming to solve the above-mentioned technical problems of the prior art.

[0055] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0056] Figure 2 A flowchart illustrating the microcontroller-based RAM module detection method provided in this application embodiment. Figure 1 .like Figure 2 As shown, the method includes:

[0057] S201. Determine the detection runtime of the RAM module based on the program runtime threshold of the running program when the microcontroller is normally executing the device task.

[0058] Specifically, to ensure that the microcontroller's program runs without errors when executing device tasks, RAM module detection needs to be staggered from the microcontroller's program execution. That is, when RAM module detection is performed, the microcontroller must stop all programs except for RAM module detection. However, for intelligent variable frequency equipment such as variable frequency air conditioners, the execution interval of many control commands during operation is very short. Therefore, the RAM module detection time cannot be too long to ensure that the detection does not affect the normal operation of the equipment. Therefore, the maximum allowable runtime of RAM module detection, i.e., the detection runtime, is determined based on the program runtime threshold.

[0059] S202. Determine the number of RAM module region bytes that can be tested each time the RAM module is called based on the operating speed of the microcontroller. Then, in combination with the detection runtime, divide the buffer region, general region and stack region into multiple buffer sub-regions, multiple general sub-regions and multiple stack sub-regions respectively.

[0060] Specifically, since no program interruption other than the reset signal is allowed during the RAM module detection process, otherwise the data in the RAM module will become unknown, posing a potential risk to the device, it is necessary to subdivide the large area detection into multiple small areas, thereby splitting the detection time of the whole area into multiple very short detection times. This makes it easier to avoid being disturbed by other programs during the detection process and to avoid occupying the normal program running time of the device.

[0061] The number of bytes of RAM module area that can be tested in each RAM module call is determined based on the operating speed of the microcontroller. Then, combined with the detection runtime, each area is further divided into multiple sub-areas.

[0062] S203. Sequentially detect each buffer sub-region within the buffer area, and generate and play alarm information and stop detection when an abnormal result is detected.

[0063] Specifically, during the interval after the normal operation of the device ends, the RAM module detection program is executed. First, the buffer area is detected. The buffer sub-areas are detected one by one according to the pre-divided buffer sub-areas. Each buffer sub-area is detected according to the same detection process, that is, write the test value, read the output value after writing, and then compare whether the test value is equal to the read value.

[0064] If they are equal, it indicates that the buffer sub-region is in normal condition and the next buffer sub-region can be detected. Alternatively, the detection of the buffer region can be paused when the device program needs to start running, and the detection of the next buffer region can continue after the device program finishes running.

[0065] If they are not equal, it indicates that the buffer sub-area is in an abnormal state. In order to avoid a larger accident, in addition to alarm prompts, it is also necessary to control the equipment to perform a shutdown operation when an abnormality is detected, and restart the equipment after confirming and repairing the abnormal state.

[0066] S204. After the buffer area is detected, each general sub-area within the general area is detected in sequence, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped.

[0067] Specifically, after the detection of each buffer sub-region within the buffer region is completed in sequence, and no abnormal results are found for each buffer sub-region within the buffer region, the detection of the general sub-regions within the general region begins in sequence, using a method similar to that for the buffer sub-regions.

[0068] Preferably, lossy testing can be used for the buffer area, which does not require backup and then restoration, while non-destructive testing can be used for the general area, which requires backup. Therefore, before testing each general sub-area, the general sub-area to be tested needs to be backed up to the buffer area. After the test result is judged to be normal, the backup in the buffer area is restored to the general sub-area to be tested before the next general sub-area is tested.

[0069] S205. After the detection of the general area is completed, each stack sub-area within the stack area is detected in turn, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped.

[0070] In this embodiment, after sequentially performing the detection of each general sub-region within the general area, and confirming that no abnormal results are found in each general sub-region, the stack sub-regions within the stack area are sequentially detected. Optionally, before detecting each stack sub-region, a temporary stack region needs to be created in the buffer area to replace the stack sub-region to be tested. Additionally, non-destructive testing can also be used for the stack region, therefore backup is also required. The stack sub-region to be tested is backed up to the buffer area, and after the detection result is determined to be normal, the backup in the buffer area is restored to the stack sub-region to be tested before starting the detection of the next stack sub-region.

[0071] It should be noted that if an abnormal result is detected during the detection of each of the above sub-regions, the detection will be stopped, and no further detection will be carried out even if there are still undetected regions and / or sub-regions.

[0072] The method provided in this embodiment obtains the detection runtime based on the microcontroller's operating speed and program runtime threshold; based on the detection runtime, the buffer area, general area, and stack area are divided into multiple buffer sub-areas, multiple general sub-areas, and multiple stack sub-areas, respectively; each buffer sub-area within the buffer area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection stops; after the detection of the buffer area is completed, each general sub-area within the general area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection stops; after the detection of the general area is completed, each stack sub-area within the stack area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection stops. By utilizing the device program execution gaps and without increasing the device's power-on runtime, segmented, time-sharing, and cyclical uninterrupted detection of the RAM module is achieved. This detection process accompanies the entire life cycle of the device, thus making it more reliable, and without adding additional device hardware circuitry, thereby not increasing device configuration costs.

[0073] The following detailed description of the microcontroller-based RAM module detection method of this application is based on a specific embodiment.

[0074] Figure 3a A flowchart illustrating the microcontroller-based RAM module detection method provided in this application embodiment. Figure 2 , Figure 3b Flowchart 3 illustrates the RAM module detection method based on a microcontroller provided in this application embodiment. Figure 3a and 3b As shown, the method includes:

[0075] S301. Based on the functions of the RAM module, the RAM module is divided into a buffer area, a general area, and a stack area.

[0076] Specifically, there are various ways to divide the RAM module into regions. This application uses the most important functions as the basis for division and divides the RAM module into a buffer region, a general region, and a stack region.

[0077] S302. Determine the detection runtime of the RAM module based on the program runtime threshold of the running program when the microcontroller is normally executing the device task.

[0078] Specifically, to ensure that the microcontroller's program runs without errors when executing device tasks, RAM module detection needs to be staggered from the microcontroller's program execution. That is, when RAM module detection is performed, the microcontroller must stop all programs except for RAM module detection. However, for intelligent variable frequency equipment such as variable frequency air conditioners, the execution interval of many control commands during operation is very short. Therefore, the RAM module detection time cannot be too long to ensure that the detection does not affect the normal operation of the equipment. Therefore, the maximum allowable runtime of RAM module detection, i.e., the detection runtime, is determined based on the program runtime threshold.

[0079] S303. Determine the number of RAM module region bytes that can be tested each time the RAM module is called based on the operating speed of the microcontroller. Then, in combination with the detection runtime, divide the buffer region, general region and stack region into multiple buffer sub-regions, multiple general sub-regions and multiple stack sub-regions respectively.

[0080] Specifically, the number of bytes of RAM module area that can be tested each time the RAM module is called is determined based on the operating speed of the microcontroller. Then, combined with the detection runtime, each area is further divided into multiple sub-areas.

[0081] S304. Monitor whether any programs are currently running. If no programs are currently running, begin the detection.

[0082] Specifically, when testing each area, the most important principle is to avoid affecting the normal operation of the equipment. Therefore, before each test, it is necessary to confirm that no other programs are currently running. By monitoring the program's running status, gaps in program operation can be identified in a timely manner, allowing for prompt execution of the testing program.

[0083] S305. Write the test value into each buffer sub-region of the buffer area in sequence, and obtain the read value of the buffer sub-region.

[0084] Specifically, the test sub-region is judged to be normal by writing known test values ​​and reading the output values.

[0085] S306. Determine whether the test value is equal to the read value. If not, execute S307. If yes, execute S308.

[0086] S307. Generate and play alarm information and stop detection.

[0087] S308. Continue to detect the next buffer sub-region until the detection of the buffer region is completed.

[0088] Specifically, each buffer sub-region is tested one by one according to the pre-divided buffer sub-regions. The same testing process is followed for each buffer sub-region: write the test value, read the output value after writing, and then compare whether the test value is equal to the output value.

[0089] S309. After the buffer area is detected, each general sub-area in the general area is backed up to the buffer area in sequence to obtain the general sub-area backup.

[0090] Specifically, since the buffer area is a lossy detection area and does not require backup and then restoration, while the general area is a non-destructive detection area and requires backup, before testing each general sub-area, the general sub-area to be tested needs to be backed up to the buffer area. After the test result is judged to be normal, the backup in the buffer area is restored to the general sub-area to be tested before the next general sub-area is tested.

[0091] S310. Write the test value into the general sub-region and obtain the read value of the general sub-region.

[0092] Specifically, the test sub-region is judged to be normal by writing known test values ​​and reading the output values.

[0093] S311. Determine whether the test value is equal to the read value. If not, execute S312; if yes, execute S313.

[0094] S312, Generate and play alarm information and stop detection.

[0095] S313. After the backup of the general sub-region is restored to the general sub-region, continue to detect the next general sub-region until the detection of the general region is completed.

[0096] Specifically, the detection and judgment process is the same as that of the buffer area described above, and will not be repeated here. After determining that the sub-region to be tested is in normal condition, the backup sub-region needs to be restored to achieve non-destructive testing.

[0097] S314. After the detection of the general area is completed, a temporary stack area is created in the buffer area to replace the stack area being tested.

[0098] S315. Back up the stack sub-region under test to the buffer area to obtain the stack sub-region backup.

[0099] Specifically, before testing each stack sub-region, a temporary stack region needs to be established in the buffer area to replace the stack sub-region to be tested. Since stack region testing is also a non-destructive test, it needs to be backed up. Therefore, the stack sub-region to be tested is backed up to the buffer area.

[0100] S316. Write the test value to the tested stack sub-region and obtain the read value of the tested stack sub-region.

[0101] Specifically, the test sub-region is judged to be normal by writing known test values ​​and reading the output values.

[0102] S317. Determine whether the test value is equal to the read value. If not, execute S318; if yes, execute S319.

[0103] S318. Generate and play alarm information and stop detection.

[0104] S319. After backing up and restoring the stack sub-region to the stack sub-region under test, and deleting the temporary stack region, continue to test the next stack sub-region until the test of the stack region is completed.

[0105] Specifically, the detection and judgment process is the same as that of the buffer area described above, and will not be repeated here. After determining that the stack sub-region under test is in normal condition, the backup sub-region needs to be restored to achieve non-destructive testing.

[0106] The method provided in this embodiment divides the RAM module into a buffer area, a general area, and a stack area according to its functional usage; obtains the detection runtime based on the microcontroller's operating speed and program runtime threshold; and further divides the buffer area, general area, and stack area into multiple buffer sub-areas, multiple general sub-areas, and multiple stack sub-areas based on the detection runtime. It monitors whether a program is currently running, and starts detection when no program is currently running, thus achieving real-time and continuous detection of the RAM module. This increases the number of detections without affecting the normal operation of the device.

[0107] By sequentially writing test values ​​into each buffer sub-region of the buffer area, obtaining the read value of the buffer sub-region, and determining whether the test value equals the read value, if not, generating and playing an alarm message and stopping the detection; if yes, continuing to detect the next buffer sub-region until the entire buffer area is detected, each sub-region within the buffer area is detected one by one, without needing to pay attention to the detection order. It can be paused and started at any time until all sub-regions are detected. When an anomaly is detected, it can immediately prevent the device from running forcibly through alarms, improving product safety. It does not require additional circuit support and does not increase the additional hardware cost of the device. It is suitable for most smart home appliances with microcontrollers and has strong versatility.

[0108] After the detection in the buffer area is completed, each general sub-area within the general area is backed up to the buffer area in sequence to obtain a general sub-area backup; a test value is written to the general sub-area, and the read value of the general sub-area is obtained; it is determined whether the test value is equal to the read value. If not, an alarm message is generated and played and the detection stops. If yes, the general sub-area backup is restored to the general sub-area, and the detection of the next general sub-area continues until the detection of the general area is completed. In addition to detecting each sub-area within the general area, the method of backing up and restoring each sub-area avoids damage to the original data in the general area, thereby eliminating the impact on the data during the detection of each sub-area.

[0109] After the detection in the general area is completed, a temporary stack area is created in the buffer area to replace the stack area under test; the stack sub-area under test is backed up to the buffer area to obtain a stack sub-area backup; a test value is written to the stack sub-area under test; the read value of the stack sub-area under test is obtained; it is determined whether the test value is equal to the read value. If not, an alarm message is generated and played and the detection stops. If yes, the stack sub-area backup is restored to the stack sub-area under test, and the temporary stack area is deleted before continuing to detect the next stack sub-area until the detection of the stack area is completed. In addition to detecting, backing up and restoring the stack area, a temporary area is also opened in the buffer area for alternative detection, which further eliminates the trace influence of the detection on the data, while not affecting the normal reading and writing of other data.

[0110] In this embodiment of the invention, electronic devices or main control devices can be divided into functional modules according to the above method examples. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional module. It should be noted that the module division in this embodiment of the invention is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.

[0111] Figure 4 This is a schematic diagram of the microcontroller-based RAM module testing device provided in this application. Figure 4 As shown, the device 40 includes:

[0112] The acquisition module 401 is used to determine the detection runtime of the RAM module based on the program runtime threshold of the running program when the microcontroller is normally executing the device task.

[0113] The partitioning module 402 is used to determine the number of bytes of RAM module area that can be tested each time the RAM module is called based on the operating speed of the microcontroller, and then, in combination with the detection runtime, divide the buffer area, general area and stack area into multiple buffer sub-areas, multiple general sub-areas and multiple stack sub-areas respectively.

[0114] The detection module 403 is used to sequentially detect each buffer sub-region within the buffer area, and generate and play alarm information and stop detection when an abnormal result is detected; after the detection of the buffer area is completed, it sequentially detects each general sub-region within the general area, and generates and plays alarm information and stops detection when an abnormal result is detected; after the detection of the general area is completed, it sequentially detects each stack sub-region within the stack area, and generates and plays alarm information and stops detection when an abnormal result is detected.

[0115] Specifically, the partitioning module 402 is used to divide the RAM module into a buffer area, a general area, and a stack area according to the functions of the RAM module.

[0116] Specifically, the detection module 403 is used to: monitor whether a program is currently running;

[0117] Based on the detection runtime, after dividing the buffer region, general region, and stack region into multiple buffer sub-regions, multiple general sub-regions, and multiple stack sub-regions respectively, the method further includes:

[0118] The detection begins when no program is currently running.

[0119] The system sequentially checks each buffer sub-region within the buffer area, and generates and plays an alarm message and stops checking when an abnormal result is detected, including:

[0120] Write the test value into each buffer sub-region of the buffer region in sequence;

[0121] Get the read value of this buffer sub-region;

[0122] Determine if the test value is equal to the read value. If not, generate and play an alarm message and stop detection. If yes, continue detecting the next buffer sub-region until the detection of the buffer region is completed.

[0123] After the buffer area is detected, each general sub-area within the general area is detected sequentially. When an abnormal result is detected, an alarm message is generated and played, and the detection is stopped. This includes:

[0124] After the buffer area is detected, each general sub-area within the general area is backed up to the buffer area in sequence to obtain the general sub-area backup;

[0125] Write the test value into the general sub-region and retrieve the read value from the general sub-region;

[0126] Determine if the test value is equal to the read value. If not, generate and play an alarm message and stop detection. If yes, restore the backup of the general sub-region to the general sub-region and continue to detect the next general sub-region until the detection of the general region is completed.

[0127] After the detection in the general area is completed, each stack sub-area within the stack area is detected sequentially. When an abnormal result is detected, an alarm message is generated and played, and the detection is stopped. This includes:

[0128] After the detection of the general area is completed, a temporary stack area is created in the buffer area to replace the stack area being tested;

[0129] The tested stack sub-region is backed up to the buffer area to obtain the stack sub-region backup;

[0130] Write the test value into the tested stack sub-region;

[0131] Obtain the read value of the tested stack sub-region;

[0132] Determine if the test value is equal to the read value. If not, generate and play an alarm message and stop detection. If yes, restore the backup of the stack sub-region to the stack sub-region under test, delete the temporary stack region, and continue to detect the next stack sub-region until the detection of the stack region is completed.

[0133] The microcontroller-based RAM module detection device provided in this embodiment can execute the microcontroller-based RAM module detection method of the above embodiment. Its implementation principle and technical effect are similar, and will not be described again here.

[0134] In the aforementioned specific implementation of the microcontroller-based RAM module detection device, each module can be implemented as a processor. The processor can execute computer execution instructions stored in the memory, thereby enabling the processor to execute the aforementioned microcontroller-based RAM module detection method.

[0135] This embodiment also provides a microcontroller, including: a processor, and a memory communicatively connected to the processor, the memory including a RAM module and a ROM module;

[0136] This ROM module is used to store computer-executed instructions;

[0137] The processor executes the computer execution instructions stored in the ROM module to implement a microcontroller-based RAM module detection method.

[0138] The microcontroller provided in this embodiment can execute the microcontroller-based RAM module detection method of the above embodiment. Its implementation principle and technical effect are similar, and will not be described again in this embodiment.

[0139] Figure 5 A schematic diagram of the structure of the electronic device provided in this application. Figure 5 As shown, the electronic device 50 includes at least one processor 501 and a memory 502. The electronic device 50 also includes a communication component 503. The processor 501, memory 502, and communication component 503 are connected via a bus 504.

[0140] In the specific implementation process, at least one processor 501 executes the computer execution instructions stored in the memory 502, causing at least one processor 501 to execute the microcontroller-based RAM module detection method executed on the electronic device side as described above.

[0141] The specific implementation process of processor 501 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0142] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0143] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage.

[0144] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0145] The above description of the functions implemented by electronic devices and main control devices has introduced the solutions provided by the embodiments of the present invention. It is understood that, in order to implement the above functions, the electronic device or main control device includes hardware structures and / or software modules corresponding to the execution of each function. By combining the units and algorithm steps of the various examples described in the embodiments of the present invention, the embodiments of the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the technical solutions of the embodiments of the present invention.

[0146] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described microcontroller-based RAM module detection method.

[0147] This method is widely used in whole-house intelligent digital control application scenarios such as smart home, smart home appliances ecosystem, and intelligence house ecosystem.

[0148] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network.

[0149] The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network; the aforementioned wireless network may include, but is not limited to, at least one of the following: WIFI (Wireless Fidelity), Bluetooth.

[0150] Terminal devices are not limited to: PCs, mobile phones, tablets, smart air conditioners, smart range hoods, smart refrigerators, smart ovens, smart stoves, smart washing machines, smart water heaters, smart washing equipment, smart dishwashers, smart projectors, smart TVs, smart clothes racks, smart curtains, smart audio-visual equipment, smart sockets, smart speakers, smart speakers, smart fresh air systems, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaners, smart window cleaning robots, smart mopping robots, smart air purifiers, smart steam ovens, smart microwave ovens, smart water heaters, smart air purifiers, smart water dispensers, smart door locks, etc.

[0151] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0152] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in an electronic device or a host device.

[0153] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0154] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting RAM modules based on a microcontroller, characterized in that, The RAM module is divided into a buffer area, a general area, and a stack area, and the method includes: Based on the program runtime threshold of the running program when the microcontroller is normally executing the device task, the detection runtime of RAM module detection is determined; based on the operating speed of the microcontroller, the number of bytes of RAM module area that can be tested each time RAM module detection is called is determined, and then, combined with the detection runtime, the buffer area, general area and stack area are respectively divided into multiple buffer sub-areas, multiple general sub-areas and multiple stack sub-areas. Each buffer sub-region within the buffer area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped. After the buffer area detection is completed, each general sub-area within the general area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped. After the general area detection is completed, each stack sub-area within the stack area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped. Monitor whether any programs are currently running; After dividing the buffer area, general area, and stack area into multiple buffer sub-regions, multiple general sub-regions, and multiple stack sub-regions respectively according to the detection runtime, the method further includes: The detection begins when no program is currently running.

2. The method according to claim 1, characterized in that, The step of sequentially detecting each buffer sub-region within the buffer area, generating and playing an alarm message and stopping detection when an abnormal result is detected includes: Test values ​​are written sequentially into each buffer sub-region of the buffer region; Obtain the read value of the buffer sub-region; Determine whether the test value is equal to the read value. If not, generate and play an alarm message and stop detection. If yes, continue detecting the next buffer sub-region until the buffer region detection is completed.

3. The method according to claim 1, characterized in that, After the buffer area detection is completed, each general sub-region within the general area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped, including: After the buffer area detection is completed, each general sub-region within the general area is backed up to the buffer area in sequence to obtain a general sub-region backup; Write the test value into the general sub-region and obtain the read value of the general sub-region; Determine whether the test value is equal to the read value. If not, generate and play an alarm message and stop detection. If yes, restore the general sub-region backup to the general sub-region and continue to detect the next general sub-region until the detection of the general region is completed.

4. The method according to claim 1, characterized in that, After the detection of the general area is completed, each stack sub-region within the stack area is detected sequentially, and an alarm message is generated and played when an abnormal result is detected, and the detection is stopped, including: After the general area detection is completed, a temporary stack area is created in the buffer area to replace the stack area being tested; The tested stack sub-region is backed up to the buffer area to obtain the stack sub-region backup; Write the test value into the tested stack sub-region; Obtain the read value of the tested stack sub-region; Determine whether the test value is equal to the read value. If not, generate and play an alarm message and stop detection. If yes, restore the stack sub-region backup to the stack sub-region under test, delete the temporary stack region, and continue to detect the next stack sub-region until the stack region detection is completed.

5. The method according to claim 1, characterized in that, Based on the functions of the RAM module, the RAM module is divided into a buffer area, a general area, and a stack area.

6. A RAM module testing device based on a microcontroller, characterized in that, If the RAM module is divided into a buffer area, a general area, and a stack area, then the device includes: The acquisition module is used to determine the detection runtime of the RAM module based on the program runtime threshold of the running program when the microcontroller is normally executing the device task. The partitioning module is used to determine the number of bytes of RAM module area that can be tested each time the RAM module is called, based on the operating speed of the microcontroller. Then, in combination with the detection runtime, the buffer area, general area and stack area are divided into multiple buffer sub-areas, multiple general sub-areas and multiple stack sub-areas respectively. The detection module is used to sequentially detect each buffer sub-region within the buffer area, and generate and play alarm information and stop detection when an abnormal result is detected; after the buffer area detection is completed, it sequentially detects each general sub-region within the general area, and generates and plays alarm information and stops detection when an abnormal result is detected; after the general area detection is completed, it sequentially detects each stack sub-region within the stack area, and generates and plays alarm information and stops detection when an abnormal result is detected; it monitors whether a program is currently running; then, after dividing the buffer area, general area, and stack area into multiple buffer sub-regions, multiple general sub-regions, and multiple stack sub-regions respectively according to the detection runtime, the method further includes: starting detection when it is detected that no program is currently running.

7. A microcontroller, characterized in that, include: A processor, and a memory communicatively connected to the processor, the memory including a RAM module and a ROM module; The ROM module is used to store computer-executed instructions; The processor executes the computer execution instructions stored in the ROM module to implement the RAM module detection method as described in any one of claims 1 to 5.

8. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Embedded software stack overflow detection method and device

    CN107729240A

  • RAM online self-checking implementation method and system under real-time operating system

    CN111611119A