Processor and self-checking method, system, memory and intelligent lighting unit
By conducting regular inspection and self-testing of the processor's data storage space, program storage space and main timer, the problem of errors in the processor when it is subject to strong magnetism or other serious interference is solved, and the reliability and security of electronic devices are improved effect.
Patent Information
- Application Number
- CN202210504021.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-05-10
AI Technical Summary
Existing processors may have a chance of error when subjected to strong magnetic or other serious interference, resulting in electronic equipment being out of control or accidents.
Design a processor self-test method to regularly detect the processor's data storage space, program storage space and main timer to determine whether it is abnormal, and restart, initialize or reconfigure when an exception is detected to ensure that the processor is running normally .
It effectively avoids out-of-control or accidents caused by external interference from the processor, and improves the reliability and safety of electronic devices.
Smart Images

Figure CN114996061B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software processing, and in particular to a processor and a self-checking method, system, memory and intelligent lighting unit thereof. Background Art
[0002] The processor (such as MCU) is the heart of many electronic devices and is indispensable. Moreover, its performance directly affects the performance of the electronic equipment. If there is a problem with the processor, the electronic equipment may be out of control at best, or even cause an accident at worst.
[0003] In the railway signal light system, the intelligent lighting unit, under the control of its internal processor, can automatically alternate and cycle the two LED beads in the bulb to light up, and can also automatically detect faults and trigger alarms. However, since the working environment of the railway signal light system is easily affected by external electromagnetic interference or other extreme conditions, there is a certain probability that the processor will make a mistake, causing the two LED beads in the bulb to fail to cycle normally or alarm normally, reducing the reliability of the railway signal light system and even causing safety accidents. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a processor and its self-check method, system, memory and intelligent lighting unit to address the defect in the prior art that the processor may fail due to strong magnetic field or other serious interference, causing loss of control or accident of electronic equipment.
[0005] The technical solution adopted by the present invention to solve the technical problem is: constructing a self-checking method of a processor, comprising:
[0006] Regularly detecting the data storage space of the processor according to a first preset period, and determining whether the data storage space is abnormal, and if abnormal, restarting the processor and initializing the data storage space;
[0007] In each program execution cycle, the program storage space of the processor is detected, and whether the program storage space is abnormal is determined, and if abnormal, the current state is recorded, and the processor is restarted, and the recorded state is maintained after the restart;
[0008] The main timer of the processor is detected regularly according to a second preset period, and it is determined whether the main timer is abnormal. Moreover, if it is abnormal, the hardware parameters of the main timer are reconfigured to make the main timer run again.
[0009] Preferably, the periodically detecting the data storage space of the processor and determining whether the data storage space is abnormal includes:
[0010] Periodically perform verification calculations on all data in the data storage space of the processor to obtain current calculation values;
[0011] Comparing the current calculated value with an initial calculated value pre-stored in the data storage space and / or the program storage space, and determining whether the current calculated value is consistent with the initial calculated value, wherein the initial calculated value is obtained by pre-checking all data in the data storage space of the processor;
[0012] If they are inconsistent, it is determined that the data storage space is abnormal;
[0013] If they are consistent, it is determined that there is no abnormality in the data storage space.
[0014] Preferably, it also includes:
[0015] Writing first specific data at a random address in the data storage space;
[0016] Furthermore, the periodically detecting the data storage space of the processor and determining whether the data storage space is abnormal includes:
[0017] regularly determining whether the first specific data changes;
[0018] If so, it is determined that the data storage space is abnormal;
[0019] If there is no change, it is determined that there is no abnormality in the data storage space.
[0020] Preferably, it also includes:
[0021] Writing second specific data at a random address of the program storage space;
[0022] Furthermore, the detecting the program storage space of the processor in each execution cycle and determining whether the program storage space is abnormal includes:
[0023] Determining whether the second specific data changes in each program execution cycle;
[0024] If so, it is determined that the program storage space is abnormal;
[0025] If there is no change, it is determined that there is no abnormality in the program storage space.
[0026] Preferably, the detecting the main timer of the processor and determining whether the main timer is abnormal includes:
[0027] Input the output signal of the main timer to the watchdog pre-set in the main program, and determine whether the dog feeding cycle is abnormal;
[0028] If the dog feeding cycle is abnormal, it is determined that the main timer is abnormal;
[0029] If there is no abnormality in the dog feeding cycle, it is determined that there is no abnormality in the main timer.
[0030] Preferably, the detecting the main timer of the processor and determining whether the main timer is abnormal includes:
[0031] The auxiliary timer and the main timer respectively determine whether their respective timing times have arrived, and when the timing times have arrived, clear the count value of the other party, wherein the timing times of the auxiliary timer and the main timer are the same;
[0032] Determine whether the count value of the auxiliary timer is greater than 1;
[0033] If the count value of the auxiliary timer is greater than 1, it is determined that the main timer is abnormal;
[0034] If the count value of the auxiliary timer is not greater than 1, it is determined that there is no abnormality in the main timer.
[0035] The present invention also constructs a processor self-checking system, comprising:
[0036] a data detection module, configured to periodically detect the data storage space of the processor according to a first preset period, and determine whether the data storage space is abnormal, and if abnormal, restart the processor and initialize the data storage space;
[0037] A program detection module is used to detect the program storage space of the processor in each program execution cycle and determine whether the program storage space is abnormal. Moreover, if it is abnormal, the current state is recorded, the processor is restarted, and the recorded state is maintained after the restart;
[0038] The timer detection module is used to regularly detect the main timer of the processor according to a second preset period and determine whether the main timer is abnormal. Moreover, when it is abnormal, the hardware parameters of the main timer are reconfigured to make the main timer run again.
[0039] The present invention also constructs a processor, which implements the steps of any one of the above self-checking methods when executing a stored computer program.
[0040] The present invention also constructs a memory storing a computer program, wherein the computer program implements the steps of the above self-checking method when executed by a processor.
[0041] The present invention also constructs an intelligent lighting unit, which is applied to an LED railway signal light system and includes the processor described above.
[0042] The technical solution provided by the present invention detects the data storage space, program storage space and main timer of the processor respectively, and eliminates the abnormality in time when an abnormality is detected, thereby ensuring the normal operation of the electronic equipment and avoiding the occurrence of accidents. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0044] Figure 1 is a flow chart of a first embodiment of a self-checking method for a processor of the present invention;
[0045] Figure 2 Logical structure diagram of the first embodiment of the LED railway signal light system of the present invention;
[0046] Figure 3 It is a logical structure diagram of the first embodiment of the self-checking system of the processor of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] Figure 1 1 is a flowchart of a first embodiment of a self-checking method for a processor of the present invention. The self-checking method of this embodiment comprises the following steps:
[0049] Step S10. Regularly detect the data storage space of the processor according to a first preset period, and determine whether the data storage space is abnormal, and if abnormal, restart the processor and initialize the data storage space;
[0050] In this step, it should be noted that for the processor in the application and intelligent lighting unit, the data stored in its data storage space includes: the switching time of the two LED lamp bead circuits, the recorded fault information, etc. By detecting the data storage space, it can be determined whether the processor has caused the electrodes of some storage units to change due to external interference or other circumstances, thereby causing data errors. Moreover, if it is determined that the data storage space of the processor is abnormal, the processor can be restarted, that is, the processor is reset by self-restarting, and the storage space is initialized.
[0051] Step S20. Detect the program storage space of the processor in each program execution cycle, and determine whether the program storage space is abnormal. If abnormal, record the current state, restart the processor, and keep the recorded state after restarting.
[0052] In this step, it should be noted that Figure 2 For the processor 110 used in the intelligent lighting unit 100, the main program stored in its program storage space is implemented when being executed: obtaining the detection results of the corresponding LED lamp beads 210, 220 and their circuits from the fault detection modules 131, 132, and according to the detection results of the two LED lamp beads 210, 220 and their circuits, when the first condition is met, the two constant current driving modules 121, 122 are used to control the two LED lamp beads 210, 220 to be alternately in the lighting state; when the second condition is met, the normal LED lamp beads 210 or 220 are controlled to be constantly in the lighting state through the corresponding constant current driving module 121 or 122, and the alarm is sent out. Module 140 alarms; when the first condition and the second condition are not met, the two constant current drive modules 121 and 122 are controlled to stop working through the power control module 160 to trigger the first alarm 300 to alarm. It should be noted that the first alarm 300 is set at the front end (main control room), and its relay drive coil is connected in series with the primary winding of the transformer of the power module. When the two constant current drive modules 121 and 122 stop working, the two LED lamp beads 210 and 220 are not lit, and the current of the entire intelligent lighting unit 100 becomes smaller. The first alarm triggers the alarm because the current on its relay drive coil is much lower than the pull-in current. The first condition is: both LED lamp beads and their circuits are normal; the second condition is: one of the LED lamp beads and its circuit is normal, and the other LED lamp bead or its circuit has a circuit breaker fault or the other LED lamp bead has a light decay fault.
[0053] Moreover, this step detects whether the program storage space of the processor is abnormal due to interference from extreme external conditions. If an abnormality occurs, the current working status is recorded and the processor chip is automatically restarted, and the working status before the restart is maintained after the restart.
[0054] Step S30. Regularly detect the main timer of the processor according to a second preset period, and determine whether the main timer is abnormal. Moreover, if it is abnormal, reconfigure the hardware parameters of the main timer to make the main timer run again.
[0055] In this step, it should be noted that for the processor used in the intelligent lighting unit, since it needs to control the alternating lighting of the two LED lamp beads according to a certain cycle, it is necessary to use the internal timer of the processor. In addition, a processor chip usually contains multiple timers, and the applied timer can be used as the main timer, that is, the timer to be checked, and the other timers can be used as auxiliary timers. This step detects the working status of the main timer. If the main timer stops working or changes the counting cycle due to severe external electromagnetic interference or other extreme conditions, the hardware parameters of the main timer are actively reconfigured to make the main timer run again.
[0056] In the technical solution of this embodiment, the data storage space, program storage space and main timer of the processor are detected respectively, and when an abnormality is detected, the abnormality is eliminated in time to ensure the normal operation of the electronic equipment and avoid accidents.
[0057] Regarding the above embodiment, it should be noted that although the sequence of steps S10, S20, and S30 is drawn in order, it should be understood that there is no sequential relationship in the execution of these three steps, among which steps S10 and S30 are executed at regular intervals, and their timing cycles can be the same or different; step S20 is performed in each program execution cycle.
[0058] In step S10 of an optional embodiment, it can be determined whether the data storage space of the processor is abnormal by the following method:
[0059] Periodically perform verification calculations on all data in the data storage space of the processor to obtain current calculation values;
[0060] Comparing the current calculated value with an initial calculated value pre-stored in the data storage space and / or the program storage space, and determining whether the current calculated value is consistent with the initial calculated value, wherein the initial calculated value is obtained by pre-checking all data in the data storage space of the processor;
[0061] If they are inconsistent, it is determined that the data storage space is abnormal;
[0062] If they are consistent, it is determined that there is no abnormality in the data storage space.
[0063] In this embodiment, data verification calculations can be performed on all data in the data storage space of the processor in advance (for example, when data in the data storage space is updated) according to a preset algorithm to generate an initial calculation value, and the initial calculation value is stored in a specific location in the program storage space and the data storage space. When the processor is running, it can periodically perform verification calculations on all data in the data storage space again according to a preset algorithm to generate a current calculation value, and then compare the current calculation value with the initial calculation value stored in the two places to see if they are consistent. If there is any inconsistency, it is considered that the data storage space is abnormal.
[0064] In step S10 of an optional embodiment, it can be determined whether the data storage space of the processor is abnormal by the following method:
[0065] Writing first specific data at a random address in the data storage space;
[0066] regularly determining whether the first specific data changes;
[0067] If so, it is determined that the data storage space is abnormal;
[0068] If there is no change, it is determined that there is no abnormality in the data storage space.
[0069] In this embodiment, a group of specific data (first specific data) is randomly written into the data storage space, and then it is periodically checked whether the group of specific data has changed. If it has changed, the data stored in the entire data storage space is considered unreliable.
[0070] In step S20 of an optional embodiment, it can be determined whether the program storage space of the processor is abnormal by the following method:
[0071] Writing second specific data at a random address of the program storage space;
[0072] Determining in each execution cycle whether the second specific data changes;
[0073] If so, it is determined that the program storage space is abnormal;
[0074] If there is no change, it is determined that there is no abnormality in the program storage space.
[0075] In this embodiment, a set of specific data (second specific data) is randomly written in the program storage space (ROM) of the processor. Of course, multiple sets of specific data may also be written in. The correctness of the specific data is checked in each program execution cycle. If an error occurs, the program storage space is considered unreliable.
[0076] In step S30 of an optional embodiment, whether the main timer of the processor is abnormal can be determined in the following manner:
[0077] Input the output signal of the main timer to the watchdog pre-set in the main program, and determine whether the dog feeding cycle is abnormal;
[0078] If the dog feeding cycle is abnormal, it is determined that the main timer is abnormal;
[0079] If there is no abnormality in the dog feeding cycle, it is determined that there is no abnormality in the main timer.
[0080] In this embodiment, a watchdog is set in the main loop, and the main timer performs dog feeding at a fixed time. When the main timer stops working or slows down, the dog feeding cycle will fail, and the main loop can determine that the dog feeding is abnormal.
[0081] In step S30 of an optional embodiment, whether the main timer of the processor is abnormal can be determined in the following manner:
[0082] The auxiliary timer and the main timer respectively determine whether their respective timing times have arrived, and when the timing times have arrived, clear the count value of the other party, wherein the timing times of the auxiliary timer and the main timer are the same;
[0083] Determine whether the count value of the auxiliary timer is greater than 1;
[0084] If the count value of the auxiliary timer is greater than 1, it is determined that the main timer is abnormal;
[0085] If the count value of the auxiliary timer is not greater than 1, it is determined that there is no abnormality in the main timer.
[0086] In this embodiment, a timer that is not used in the processor is used as an auxiliary timer, that is, a guard timer, and maintains the same timing cycle as the main timer. Moreover, when their respective timing times arrive, the two perform a count reset action on each other. If the count value of one side is greater than 1, it is considered that the other timer is abnormal.
[0087] Figure 3It is a logical structure diagram of the first embodiment of the self-checking system of the processor of the present invention. The self-checking system of this embodiment includes: a data detection module 10, a program detection module 20, and a timer detection module 30, wherein the data detection module 10 is used to regularly detect the data storage space of the processor according to a first preset period, and determine whether the data storage space is abnormal, and, in the case of an abnormality, restart the processor and initialize the data storage space; the program detection module 20 is used to detect the program storage space of the processor in each program execution cycle, and determine whether the program storage space is abnormal, and, in the case of an abnormality, record the current state, restart the processor, and maintain the recorded state after restarting; the timer detection module 30 is used to regularly detect the main timer of the processor according to a second preset period, and determine whether the main timer is abnormal, and, in the case of an abnormality, reconfigure the hardware parameters of the main timer to enable the main timer to run again.
[0088] The present invention also constructs a processor, which implements the steps of the above self-checking method when executing a stored computer program.
[0089] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or any conventional processor, etc.
[0090] Moreover, since the processor can implement the steps of any self-test method provided in the embodiments of the present invention when executing a computer program, the beneficial effects that can be achieved by any self-test method provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0091] The present invention also constructs a memory storing a computer program, wherein the computer program implements the steps of the above self-checking method when executed by a processor.
[0092] It should be understood that the readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and other computer-readable storage media that can store program codes. Moreover, since the computer program stored in the readable storage medium can implement the steps of any self-test method provided in the embodiment of the present invention when executed, the beneficial effects that can be achieved by any self-test method provided in the embodiment of the present invention can be achieved, as detailed in the previous embodiment, which will not be repeated here.
[0093] The present invention also constructs an intelligent lighting unit, which is applied to an LED railway signal light system. The intelligent lighting unit includes the processor described above.
[0094] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of the claims of the present invention.
Claims
1. A self-checking method for a processor, wherein the processor is applied to an intelligent lighting unit of an LED railway signal light system, characterized in that: include: Regularly detecting the data storage space of the processor according to a first preset period, and determining whether the data storage space is abnormal, and if abnormal, restarting the processor and initializing the data storage space; In each program execution cycle, the program storage space of the processor is detected, and whether the program storage space is abnormal is determined, and if abnormal, the current state is recorded, and the processor is restarted, and the recorded state is maintained after the restart, wherein the program storage space stores a main program; The main timer of the processor is regularly detected according to a second preset cycle, and it is determined whether the main timer is abnormal. Moreover, when it is abnormal, the hardware parameters of the main timer are reconfigured to make the main timer run again, wherein the timing time of the main timer is a cycle period for alternately lighting two LED lamp beads; The detecting the main timer of the processor and determining whether the main timer is abnormal includes: The auxiliary timer and the main timer respectively determine whether their respective timing times have arrived, and when the timing times have arrived, clear the count value of the other party, wherein the timing times of the auxiliary timer and the main timer are the same; Determine whether the count value of the auxiliary timer is greater than 1; If the count value of the auxiliary timer is greater than 1, it is determined that the main timer is abnormal; If the count value of the auxiliary timer is not greater than 1, it is determined that there is no abnormality in the main timer.
2. The processor self-checking method according to claim 1, characterized in that: The periodically detecting the data storage space of the processor and determining whether the data storage space is abnormal includes: Periodically perform verification calculations on all data in the data storage space of the processor to obtain current calculation values; Comparing the current calculated value with an initial calculated value pre-stored in the data storage space and / or the program storage space, and determining whether the current calculated value is consistent with the initial calculated value, wherein the initial calculated value is obtained by pre-checking all data in the data storage space of the processor; If they are inconsistent, it is determined that the data storage space is abnormal; If they are consistent, it is determined that there is no abnormality in the data storage space.
3. The processor self-checking method according to claim 1, characterized in that: Also includes: Writing first specific data at a random address in the data storage space; Furthermore, the periodically detecting the data storage space of the processor and determining whether the data storage space is abnormal includes: regularly determining whether the first specific data changes; If so, it is determined that the data storage space is abnormal; If there is no change, it is determined that there is no abnormality in the data storage space.
4. The processor self-checking method according to claim 1, characterized in that: Also includes: Writing second specific data at a random address of the program storage space; Furthermore, the detecting of the program storage space of the processor in each program execution cycle and determining whether the program storage space is abnormal includes: Determining whether the second specific data changes in each program execution cycle; If so, it is determined that the program storage space is abnormal; If there is no change, it is determined that there is no abnormality in the program storage space.
5. The processor self-checking method according to claim 1, characterized in that: The detecting the main timer of the processor and determining whether the main timer is abnormal includes: Input the output signal of the main timer to the watchdog pre-set in the main program, and determine whether the dog feeding cycle is abnormal; If the dog feeding cycle is abnormal, it is determined that the main timer is abnormal; If there is no abnormality in the dog feeding cycle, it is determined that there is no abnormality in the main timer.
6. A processor self-checking system, the processor is applied to an intelligent lighting unit of an LED railway signal light system, characterized in that: include: a data detection module, configured to periodically detect the data storage space of the processor according to a first preset period, and determine whether the data storage space is abnormal, and if abnormal, restart the processor and initialize the data storage space; A program detection module, used to detect the program storage space of the processor in each program execution cycle, and determine whether the program storage space is abnormal, and, if abnormal, record the current state, restart the processor, and maintain the recorded state after restart, wherein the program storage space stores the main program; A timer detection module is used to regularly detect the main timer of the processor according to a second preset period, and determine whether the main timer is abnormal, and when abnormal, reconfigure the hardware parameters of the main timer to make the main timer run again, wherein the timing time of the main timer is a cycle period for alternately lighting two LED lamp beads; The detecting the main timer of the processor and determining whether the main timer is abnormal includes: The auxiliary timer and the main timer respectively determine whether their respective timing times have arrived, and when the timing times have arrived, clear the count value of the other party, wherein the timing times of the auxiliary timer and the main timer are the same; Determine whether the count value of the auxiliary timer is greater than 1; If the count value of the auxiliary timer is greater than 1, it is determined that the main timer is abnormal; If the count value of the auxiliary timer is not greater than 1, it is determined that there is no abnormality in the main timer.
7. A processor, characterized in that: The processor implements the steps of the self-checking method according to any one of claims 1 to 5 when executing the stored computer program.
8. A memory storing a computer program, characterized in that: The computer program implements the steps of the self-test method according to any one of claims 1 to 5 when executed by a processor.
9. An intelligent lighting unit, applied to LED railway signal light system, characterized in that: Comprising the processor of claim 7.
Citation Information
Patent Citations
Self-check system and method thereof
CN111008099A