Agricultural machinery TBOX crash protection method, device, equipment and medium
By combining the use of hardware watchdogs and software watchdogs at different stages of TBOX, the limitations of TBOX crash protection in the existing technology are solved, and the full-process stable monitoring and reset of TBOX is achieved, and the reliability of the system is improved.
Patent Information
- Application Number
- CN202510194954.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-06-10
AI Technical Summary
The prior art has limitations in preventing TBOX from crashing. The software watchdog depends on the software health and may fail after initialization or disabling. The hardware watchdog timeout is short, making it difficult to feed the dog in time during all processing processes.
By using the hardware watchdog and the software watchdog for monitoring and resetting at different stages of TBOX, the hardware watchdog periodically feeds the dog during the boot program startup, and the software watchdog performs priority task control after the app program is started.
Effectively prevent TBOX from crashing, ensuring that it does not crash due to failure of a single type of watchdog during the entire operation, improving the stability and reliability of TBOX.
Smart Images

Figure CN120123133A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of deadlock protection for in-vehicle communication devices, and particularly to a deadlock protection method, device, equipment and medium for agricultural machinery TBOX. Background Art
[0002] With the aggravation of population aging in China, agricultural production faces huge challenges, and the development of modern agriculture is imminent. Smart agriculture will become the mainstream trend of future development, and various intelligent large-scale agricultural machinery will play an important role in modern agriculture. These intelligent agricultural machines, including tractors, harvesters, etc., are mostly equipped with in-vehicle tbox devices to achieve various functions, such as triple integration upload, acreage counting, financial vehicle locking, navigation, and remote OTA update, etc. The stability of tbox is crucial for ensuring the normal operation of agricultural machinery. Once the tbox crashes, it will directly affect functions such as obtaining purchase subsidies, statistical operation area, and vehicle safety locking.
[0003] Currently, the main method to prevent tbox from crashing is to implement through a watchdog reset mechanism, specifically including two means: software watchdog and hardware watchdog. The software watchdog resets the timer by sending a "feed the dog" signal within a predetermined time period to avoid the system entering a deadlock state. The hardware watchdog monitors the operating state of tbox through an independent hardware module or circuit. If tbox fails to send the "feed the dog" signal on time, the hardware watchdog will trigger a reset operation within the set time to restore the normal operation of tbox.
[0004] However, whether using the software watchdog or the hardware watchdog alone, there are certain limitations. The software watchdog completely depends on the running status of the software itself. When there are problems with the software itself, the watchdog function may fail. In addition, if the program runs wild before initialization, startup completion, or after being disabled, the watchdog may not be able to reset tbox, resulting in a reduced recovery ability of tbox. The hardware watchdog has a short timeout period and has high requirements for real-time performance. It is necessary to feed the dog in time within the timeout period. In practical applications, some processing processes are difficult to perform time slicing, and even some processing processes cannot be interrupted. Therefore, restart problems are likely to occur due to untimely feeding of the dog. Summary of the Invention
[0005] The technical problem to be solved by the present invention is: to provide a deadlock protection method, device, equipment and medium for agricultural machinery TBOX, aiming to solve at least one of the above technical problems.
[0006] The technical solution of the present invention to solve the above technical problems is as follows:
[0007] In the first aspect, the present application provides a deadlock protection method for agricultural machinery TBOX, adopting the following technical solution:
[0008] A method for preventing the agricultural machinery TBOX from crashing. The TBOX includes a boot program and an app program. The method includes:
[0009] Obtain a power-on signal, and read the boot program based on the power-on signal;
[0010] Based on the boot program, initialize the TBOX and control the hardware watchdog to perform a hardware dog feeding operation;
[0011] During the process of the hardware watchdog performing the hardware dog feeding operation, determine whether there is a timeout in the hardware dog feeding; if there is a timeout in the hardware dog feeding, control the TBOX to restart;
[0012] If there is no timeout in the hardware dog feeding, read the app program and control the software watchdog to start based on the app program;
[0013] After the software watchdog starts, control the software watchdog to perform a software dog feeding operation based on the set priority tasks;
[0014] During the process of the software watchdog performing the software dog feeding operation, determine whether there is a timeout in the software watchdog; if there is a timeout in the software watchdog, control the TBOX to restart.
[0015] The beneficial effects of the present invention are as follows: It can use the hardware watchdog and the software watchdog to monitor and reset respectively at different stages of the TBOX startup. By combining the hardware watchdog and the software watchdog, it can effectively prevent the TBOX from crashing. Specifically, after the TBOX is powered on, the boot program is first executed for hardware initialization, and at the same time, the hardware watchdog is periodically fed. If a timeout occurs in the hardware dog feeding during this process, it indicates that an abnormality occurs in the TBOX during the startup process of the boot program. At this time, the hardware watchdog will trigger a reset operation to ensure that the TBOX will not crash due to initial problems. Once the app program is successfully started, the software watchdog starts to work to prevent crashes caused by software problems. Through the combined use of the software and hardware watchdogs, not only can each stage before and after the startup of the boot program and the app program be effectively monitored, but also the system can continue to be protected after the software watchdog starts, ensuring that the TBOX will not crash due to the failure of a single type of watchdog during the entire operation process.
[0016] Based on the above technical solution, the present invention can also be improved as follows.
[0017] Further, the method further includes:
[0018] During the process of controlling the software watchdog to start based on the app program, determine whether there is a timeout in feeding the hardware watchdog.
[0019] If there is a timeout in feeding the hardware watchdog during the process of controlling the software watchdog to start based on the app program, then control the tbox to restart.
[0020] If there is no timeout in feeding the hardware watchdog during the process of controlling the software watchdog to start based on the app program, then determine that the software watchdog starts successfully based on the app program.
[0021] The beneficial effect of adopting the above further solution is: It can continuously monitor the feeding status of the hardware watchdog during the startup of the software watchdog. Before the app program starts, the hardware watchdog continues to perform the feeding operation to ensure the stability of the tbox during this critical period. If there is a timeout in feeding the hardware watchdog during this period, the reset operation will also be triggered to avoid the tbox being in an unstable state for a long time and reduce the service interruption time caused by crashing.
[0022] Further, the controlling the hardware watchdog to perform the hardware feeding operation includes:
[0023] Send a hardware feeding signal to the hardware watchdog based on a first set period, and the first set period is less than the set timeout time of the hardware watchdog;
[0024] Control the hardware watchdog to perform the hardware feeding operation based on the hardware feeding signal.
[0025] The beneficial effect of adopting the above further solution is: By sending a hardware feeding signal to the hardware watchdog based on a first set period, it is ensured that the hardware watchdog will not trigger the reset operation due to timeout. This periodic feeding operation ensures that during the startup and initialization of the tbox, even if there are short-term abnormalities, the tbox will not crash. Since the first set period is less than the set timeout time of the hardware watchdog, this method ensures that the hardware watchdog can receive the feeding signal in time, thus maintaining the normal operation of the tbox.
[0026] Further, the reading the app program and starting the software watchdog based on the app program includes:
[0027] Based on the boot program, read and load the app program from a first set storage location to a second set storage location, the first set storage location is a non-volatile memory, and the second set storage location is a volatile memory;
[0028] Perform an integrity verification on the app program based on the boot program;
[0029] If the verification is passed, based on the boot program, set the stack pointer to the stack top address of the app program and set the program counter to the entry address of the app program;
[0030] Initialize the app program and send a software watchdog feeding signal to the software watchdog based on a second set period to start the software watchdog, where the second set period is less than the set timeout time of the software watchdog.
[0031] The beneficial effects of adopting the above further solution are as follows: By performing integrity verification on the app program, it is ensured that the app program read from the non-volatile memory is not damaged or tampered with. Loading the app program from the non-volatile memory to the volatile memory speeds up the program loading speed and reduces the startup time. After the initialization of the app program is completed, a software watchdog feeding signal is sent to the software watchdog based on the second set period to ensure that the software watchdog can be started in time and work properly, preventing the system from crashing due to abnormal software operation.
[0032] Further, the controlling the software watchdog to perform software watchdog feeding operations based on the set priority tasks includes:
[0033] Configure the task priority of the software watchdog to the lowest priority task, where the task priority represents the priority of the task to obtain CPU resources;
[0034] Based on the lowest priority task, control the software watchdog to perform software watchdog feeding operations.
[0035] The beneficial effects of adopting the above further solution are as follows: Setting the software watchdog as the lowest priority task ensures that the software watchdog will only intervene and perform a reset operation when other high-priority tasks cannot be executed normally, reducing unnecessary system restarts caused by untimely feeding. The design of the low-priority task ensures that the feeding operation of the software watchdog does not occupy too much CPU resources, guaranteeing the efficient operation of critical tasks.
[0036] Further, after the software watchdog is started, it further includes:
[0037] Configure the task priority of the hardware watchdog to the highest priority task;
[0038] Based on the highest priority task, control the hardware watchdog to perform hardware watchdog feeding operations.
[0039] The beneficial effects of adopting the above further solution are as follows: After the app program is successfully started, the software watchdog can effectively monitor the running status of all tasks. At this time, there is no longer a need for the hardware watchdog to reset the tbox. Instead, setting the task of feeding the hardware watchdog to the highest priority can ensure that the hardware watchdog can be fed in a timely manner, and the feeding task will not be preempted. Therefore, there is no need to worry about the problem of false restart caused by the time slicing of other tasks resulting in failed feeding of the watchdog. It can effectively prevent the tbox from crashing after the software watchdog is started.
[0040] Further, the app program includes a wireless communication function program, a positioning function program, a Bluetooth wifi function program, a CAN communication function program, an OTA function program, a sleep wake-up function program, a financial vehicle locking function program, a photographing function program, and a file system function program.
[0041] In a second aspect, the present application provides a deadlock protection device for an agricultural machinery TBOX, adopting the following technical solution:
[0042] A deadlock protection device for an agricultural machinery TBOX, where the tbox includes a boot program and an app program, and the device includes:
[0043] An acquisition module, configured to acquire a power-on signal and read the boot program based on the power-on signal;
[0044] A hardware watchdog execution module, configured to initialize the tbox and control the hardware watchdog to perform a hardware dog feeding operation based on the boot program;
[0045] A judgment module, configured to judge whether there is a hardware watchdog feeding timeout during the process of the hardware watchdog performing the hardware dog feeding operation; if there is a hardware watchdog feeding timeout, it transfers to the first restart module; if there is no hardware watchdog feeding timeout, it transfers to the software watchdog start module; a restart module, configured to control the tbox to restart;
[0046] A software watchdog start module, configured to read the app program and control the software watchdog to start based on the app program;
[0047] A software watchdog execution module, configured to control the software watchdog to perform a software dog feeding operation based on a set priority task after the software watchdog is started;
[0048] A second judgment module, configured to judge whether there is a software watchdog timeout during the process of the software watchdog performing the software dog feeding operation; if there is a software watchdog timeout, it transfers to the restart module.
[0049] In a third aspect, the present application provides an electronic device, adopting the following technical solution:
[0050] An electronic device includes a memory and a processor, and a computer program capable of being loaded and executed by the processor for the agricultural machinery TBOX crash protection method according to any one of the first aspect is stored on the memory.
[0051] In a fourth aspect, the present application provides a computer-readable storage medium, adopting the following technical solution:
[0052] A computer-readable storage medium stores a computer program capable of being loaded and executed by the processor for the agricultural machinery TBOX crash protection method according to any one of the first aspect.
[0053] Additional aspects and advantages of the present application will be given in part in the following description, which will become apparent from the following description, or can be understood through the practice of the present application. Description of the Drawings
[0054] Figure 1 A schematic diagram of an agricultural machinery TBOX program provided by an embodiment of the present invention;
[0055] Figure 2 A flowchart of an agricultural machinery TBOX crash protection method provided by an embodiment of the present invention;
[0056] Figure 3 A flowchart of an agricultural machinery TBOX crash protection method provided by another embodiment of the present invention;
[0057] Figure 4 A structural block diagram of an agricultural machinery TBOX crash protection device provided by an embodiment of the present invention;
[0058] Figure 5 A structural diagram of an electronic device provided by an embodiment of the present invention. Detailed Embodiments
[0059] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0060] In addition, the term "and / or" in this text merely describes the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this text generally represents an "or" relationship between the front and back associated objects unless otherwise specified.
[0061] The solution provided by the embodiments of the present invention can be applied to any application scenario that requires anti-freeze protection for agricultural machinery TBOX. The solution provided by the embodiments of the present invention can be executed by an electronic device with data processing capabilities, such as a processor in an in-vehicle TBOX.
[0062] As Figure 1 shown, the embedded program of the TBOX consists of two parts, one is the boot program and the other is the app program. The boot program is also known as the BootLoader program.
[0063] Optionally, the app program includes a wireless communication function program, a positioning function program, a Bluetooth WiFi function program, a CAN communication function program, an OTA function program, a sleep wake-up function program, a financial vehicle locking function program, a photographing function program, and a file system function program.
[0064] For example, in the app program, multiple function modules can be included, such as a wireless communication function program, a positioning function program, a Bluetooth WiFi function program, a CAN communication function program, an OTA function program, a sleep wake-up function program, a financial vehicle locking function program, a photographing function program, and a file system function program. The implementation of these function modules needs to consider the coordination and cooperation among them to ensure the stable operation of the entire TBOX.
[0065] As Figure 2 shown, a method for anti-freeze protection of agricultural machinery TBOX, the TBOX includes a boot program and an app program, and the method mainly includes steps S101 to S106:
[0066] Step S101, obtain a power-on signal, and read the boot program based on the power-on signal;
[0067] Step S102, based on the boot program, initialize the TBOX and control the hardware watchdog to perform a hardware dog feeding operation;
[0068] Step S103, during the process of the hardware watchdog performing the hardware dog feeding operation, determine whether there is a hardware watchdog dog feeding timeout; if there is a hardware watchdog dog feeding timeout during the process of the hardware watchdog performing the hardware dog feeding operation, control the TBOX to restart to prevent the TBOX from crashing;
[0069] Step S104, if there is no timeout in the process of the hardware watchdog performing the hardware watchdog feeding operation, read the app program, and based on the app program, control the software watchdog to start;
[0070] Step S105, after the software watchdog starts, based on the set priority tasks, control the software watchdog to perform the software watchdog feeding operation;
[0071] Step S106, in the process of the software watchdog performing the software watchdog feeding operation, determine whether there is a software watchdog timeout; if there is a software watchdog timeout, control the tbox to restart to prevent the tbox from crashing.
[0072] Through the method of the present invention, it is possible to monitor and reset respectively using the hardware watchdog and the software watchdog at different stages of the tbox startup. By combining the hardware watchdog and the software watchdog, it can effectively prevent the tbox from crashing. Specifically, after the tbox is powered on, the boot program is first executed and hardware initialization is performed, and at the same time, the hardware watchdog feeding operation is performed periodically. If there is a timeout in the hardware watchdog feeding operation during this process, it indicates that there is an abnormality in the tbox during the startup of the boot program. At this time, the hardware watchdog will trigger a reset operation to ensure that the tbox will not crash due to initial problems. Once the app program is successfully started, the software watchdog starts to work to prevent crashes caused by software problems. Through the combined use of the software and hardware watchdogs, not only can each stage before and after the startup of the boot program and the app program be effectively monitored, but also the system can continue to be protected after the software watchdog starts, ensuring that the tbox will not crash due to the failure of a single type of watchdog during the entire operation process.
[0073] The following further illustrates the solution of the present invention in combination with the following specific embodiments. In this embodiment, refer to Figure 2 A method for preventing the agricultural machinery TBOX from crashing mainly includes:
[0074] Step S101, the tbox is powered on and running, obtain the power-on signal, and read the boot program based on the power-on signal;
[0075] Step S102, after the tbox is powered on or reset, based on the boot program, initialize the tbox and control the hardware watchdog to perform the hardware watchdog feeding operation;
[0076] In the embodiment of the present application, the hardware initialization of the tbox includes configuring the clock, setting the interrupt vector table, initializing the memory, etc., to ensure that the hardware environment of the tbox is in a suitable state and prepare for the execution of subsequent programs.
[0077] In the embodiments of the present application, the hardware watchdog includes a timer for recording time.
[0078] Optionally, controlling the hardware watchdog to perform a hardware dog feeding operation includes:
[0079] Sending a hardware dog feeding signal to the hardware watchdog based on a first set period. The dog feeding signal of the hardware watchdog can be sent through a specific I / O pin or communication interface, and the first set period is less than the set timeout time of the hardware watchdog;
[0080] Controlling the hardware watchdog to perform a hardware dog feeding operation based on the hardware dog feeding signal.
[0081] By sending a hardware dog feeding signal to the hardware watchdog based on a first set period, it is ensured that the hardware watchdog will not trigger a reset operation due to timeout. This periodic dog feeding operation ensures that during the startup and initialization process of the tbox, even if there are short-term anomalies, the tbox will not crash. Since the first set period is less than the set timeout time of the hardware watchdog, this method ensures that the hardware watchdog can receive the dog feeding signal in a timely manner, thereby maintaining the normal operation of the tbox.
[0082] Step S103, during the process of the hardware watchdog performing a hardware dog feeding operation, determine whether there is a hardware watchdog dog feeding timeout; if there is a hardware watchdog dog feeding timeout during the process of the hardware watchdog performing a hardware dog feeding operation, then control the tbox to restart to prevent the tbox from crashing;
[0083] In the embodiments of the present application, if an anomaly occurs during the boot startup process of the tbox, it will cause the hardware watchdog dog feeding to fail, and in this case, there will be a situation of hardware watchdog dog feeding timeout. If there is a hardware watchdog dog feeding timeout during the process of the hardware watchdog performing a hardware dog feeding operation, then control the tbox to restart to avoid the phenomenon of crashing. After restarting, re-execute steps S101 to S103.
[0084] Step S104, if there is no hardware watchdog dog feeding timeout during the process of the hardware watchdog performing a hardware dog feeding operation, then read the app program and control the software watchdog to start based on the app program;
[0085] In the embodiments of the present application, reading the app program and controlling the software watchdog to start based on the app program includes:
[0086] Based on the boot program, read and load the app program from a first set storage location to a second set storage location. The first set storage location is a non-volatile memory, and the second set storage location is a volatile memory;
[0087] Verify the integrity of the app program based on the boot program;
[0088] If the verification passes, based on the boot program, set the stack pointer to the stack top address of the app program and set the program counter to the entry address of the app program;
[0089] Initialize the app program and send a software watchdog feeding signal to the software watchdog based on a second set period to start the software watchdog, where the second set period is less than the set timeout time of the software watchdog.
[0090] In the embodiments of the present application, the non-volatile memory can be interfaces such as Flash, EEPROM, SD card, UART, CAN, USB, etc., and the volatile memory can be RAM.
[0091] If a new firmware version is detected, the Boot program updates the firmware through methods such as serial port, USB, CAN, or OTA (Over-The-Air), downloads the new APP program code, and verifies its integrity. The Boot program sets the stack pointer to the stack top address of the APP program and sets the program counter to the entry address of the APP program to achieve a jump to the APP program.
[0092] By verifying the integrity of the app program, it is ensured that the app program read from the non-volatile memory is not damaged or tampered with. Loading the app program from the non-volatile memory into the volatile memory speeds up the program loading speed and reduces the startup time.
[0093] In the embodiments of the present application, before the app program enables the software watchdog, it is still necessary to perform a periodic hardware watchdog feeding operation. Optionally, during the process of controlling the software watchdog to start based on the app program, send a hardware watchdog feeding signal to the hardware watchdog based on a first set period, and control the hardware watchdog to perform a hardware watchdog feeding operation based on the hardware watchdog feeding signal. And during the hardware watchdog feeding operation, determine whether there is a hardware watchdog feeding timeout;
[0094] If there is a hardware watchdog feeding timeout during the process of controlling the software watchdog to start based on the app program, control the tbox to restart to prevent the tbox from crashing.
[0095] If there is no hardware watchdog feeding timeout during the process of controlling the software watchdog to start based on the app program, determine that the control of the software watchdog to start based on the app program is successful.
[0096] By using the above method, it is possible to continuously monitor the dog-feeding status of the hardware watchdog during the startup of the software watchdog. Before the app program starts, the hardware watchdog continues to perform the dog-feeding operation to ensure the stability of the tbox during this critical period. If the dog-feeding of the hardware watchdog times out during this period, a reset operation will also be triggered to prevent the tbox from being in an unstable state for a long time and reduce the service interruption time caused by crashing.
[0097] Step S105, after the software watchdog starts, control the software watchdog to perform a software dog-feeding operation based on the set priority tasks;
[0098] In the embodiment of the present application, the controlling the software watchdog to perform a software dog-feeding operation based on the set priority tasks includes:
[0099] Configure the task priority of the software watchdog to the lowest priority task, where the task priority represents the priority of the task to obtain CPU resources;
[0100] Based on the lowest priority task, control the software watchdog to perform a software dog-feeding operation.
[0101] After the software watchdog starts, it further includes:
[0102] Configure the task priority of the hardware watchdog to the highest priority task;
[0103] Based on the highest priority task, control the hardware watchdog to perform a hardware dog-feeding operation.
[0104] In the embodiment of the present application, the normal operation of the app program indicates that all tasks have been started normally. At this time, call the vTaskPrioritySet() function of the FreeRTOS real-time operating system to set the priority of the dog-feeding task of the hardware watchdog to the highest priority. Since, after the app program starts successfully, the software watchdog can effectively monitor the running status of all tasks, and at this time, there is no need for the hardware watchdog to reset the tbox anymore. And setting the dog-feeding task of the hardware watchdog to the highest priority can ensure that the hardware watchdog can feed the dog in time, and the dog-feeding task will not be preempted, avoiding the problem of false restart caused by the time slicing of other tasks resulting in dog-feeding failure.
[0105] Set the software watchdog's feeding task to the lowest priority. By setting a set second timeout for the software watchdog, it can be ensured that all tasks of tbox can be successfully executed within this second time, that is, when the software watchdog is feeding the dog, all tasks are normal. Only when a bug occurs in a task will the software watchdog feeding timeout occur. At this time, the software watchdog will reset and restart tbox to restore tbox to normal state. Avoid tbox being in an unstable state for a long time and reduce the service interruption time caused by crashes.
[0106] Step S106, during the process of the software watchdog performing the software feeding operation, it is determined whether there is a software watchdog timeout; if there is a software watchdog timeout, the tbox is controlled to restart and the steps S101 to S106 are re-executed to prevent the tbox from freezing. This effectively improves the stability and reliability of the TBOX system and reduces the risk of work interruption and data loss caused by freezing.
[0107] The above method is further explained below.
[0108] like Figure 3 As shown, a method for preventing a TBOX from freezing in agricultural machinery is provided, including:
[0109] The first step is to power on and run tbox.
[0110] In the second step, the boot program of tbox is executed first. During the running of the boot program, the hardware watchdog is fed periodically, and the feeding cycle is less than the timeout period of the hardware watchdog.
[0111] Step 3: If tbox restarts during the execution of the boot program, it means that tbox has an exception during the boot process, resulting in the failure of feeding the hardware watchdog. The timeout of feeding the watchdog causes tbox to restart. Tbox restarts to avoid crashes.
[0112] Step 4. If tbox does not restart during the boot process, it means that the boot program of tbox is executed successfully.
[0113] Step 5. After the boot program is successfully executed, the CPU program pointer (PC) points to the starting address of the app application to guide the app program to run. Before turning on the software watchdog, the app program still needs to periodically feed the hardware watchdog.
[0114] Step 6: Before the app program enables the software watchdog, if the tbox restarts, it indicates that before the app program enables the software watchdog, an exception occurred in the app program, causing the hardware watchdog to time out in feeding the dog. The timeout in feeding the dog led to the restart of the tbox, and the restart of the tbox prevented the occurrence of a freeze.
[0115] Step 7: If the tbox does not restart before the app program enables the software watchdog, it indicates that the app program has successfully started the software watchdog.
[0116] Step 8: After the app software runs normally, transfer the operation of feeding the hardware watchdog to the highest-priority task for hardware dog feeding, which is equivalent to the hardware watchdog becoming ineffective. Perform software watchdog dog feeding in the lowest-priority task to prevent the occurrence of a freeze problem caused by bugs during software operation.
[0117] At this time, the software watchdog takes over the handling of all freeze problems of the tbox.
[0118] Step 9: If the tbox restarts at this time, it indicates that an exception occurred during the operation of the app in the tbox, resulting in the failure of the software watchdog to feed the dog. The timeout in feeding the dog led to the restart of the tbox, and the restart of the tbox prevented the occurrence of a freeze.
[0119] The potential problem of the tbox freezing is perfectly solved by using a combination of software and hardware watchdogs. The hardware watchdog is responsible for all freeze problems before the software watchdog is enabled, and the software watchdog takes over all freeze problems after it is enabled.
[0120] Figure 4 The structural schematic diagram of a deadlock protection device 200 for an agricultural machinery TBOX is shown.
[0121] As Figure 4 shown, for a deadlock protection device 200 of an agricultural machinery TBOX, the tbox includes a boot program and an app program, and the device mainly includes:
[0122] An acquisition module 201, configured to acquire a power-on signal and read the boot program based on the power-on signal;
[0123] A hardware watchdog execution module 202, configured to initialize the tbox based on the boot program and control the hardware watchdog to perform a hardware dog-feeding operation;
[0124] The judgment module 203 is used to judge whether there is a hardware watchdog feeding timeout during the process of the hardware watchdog performing the hardware feeding operation; if there is a hardware watchdog feeding timeout during the process of the hardware watchdog performing the hardware feeding operation, the restart module is transferred; if there is no hardware watchdog feeding timeout during the process of the hardware watchdog performing the hardware feeding operation, the software watchdog startup module 204 is transferred; the restart module is used to control the restart of the tbox to prevent the tbox from freezing;
[0125] A software watchdog startup module 204 is used to read the app program and control the startup of the software watchdog based on the app program;
[0126] The software watchdog execution module 205 is used to control the software watchdog to perform a software watchdog feeding operation based on a set priority task after the software watchdog is started;
[0127] The second judgment module 206 is used to judge whether there is a software watchdog timeout during the process of the software watchdog performing the software dog feeding operation; if there is a software watchdog timeout, it will enter the restart module.
[0128] Optionally, the device further includes a third judgment module, wherein the third judgment module is specifically configured to:
[0129] In the process of controlling the software watchdog to start based on the app program, determining whether there is a hardware watchdog feeding timeout;
[0130] If the hardware watchdog feeding timeout occurs during the process of enabling the software watchdog based on the app program, the tbox is controlled to restart to prevent the tbox from freezing;
[0131] If there is no hardware watchdog timeout in the process of starting the software watchdog based on the app program control, it is determined that the software watchdog based on the app program control is started successfully.
[0132] Optionally, the hardware watchdog execution module 202 is specifically used for:
[0133] Sending a hardware dog feeding signal to the hardware watchdog based on a first set period, wherein the first set period is less than a set timeout period of the hardware watchdog;
[0134] The hardware watchdog is controlled to perform a hardware watchdog feeding operation based on the hardware watchdog feeding signal.
[0135] Optionally, the software watchdog startup module 204 is specifically used for:
[0136] Based on the boot program, read and load the app program from a first setting storage location to a second setting storage location, where the first setting storage location is a non-volatile memory and the second setting storage location is a volatile memory;
[0137] Performing integrity verification on the app program based on the boot program;
[0138] If the verification is successful, the stack top pointer is set to the stack top address of the app program based on the boot program, and the program counter is set to the entry address of the app program;
[0139] The app program is initialized and a software dog feeding signal is sent to the software watchdog based on a second set period to start the software watchdog, wherein the second set period is less than a set timeout period of the software watchdog.
[0140] Optionally, the software watchdog execution module 205 is specifically used for:
[0141] Setting the task priority configuration of the software watchdog to the lowest priority task, wherein the task priority represents the priority of the task in obtaining CPU resources;
[0142] Based on the lowest priority task, control the software watchdog to perform software watchdog feeding operation.
[0143] Optionally, the hardware watchdog execution module 202 is further used for:
[0144] After the software watchdog is started, set the task priority configuration of the hardware watchdog to the highest priority task;
[0145] Based on the highest priority task, control the hardware watchdog to perform hardware watchdog feeding operations.
[0146] Optionally, the app program includes a wireless communication function program, a positioning function program, a Bluetooth wifi function program, a CAN communication function program, an OTA function program, a sleep wake-up function program, a financial car locking function program, a photo taking function program and a file system function program.
[0147] In one example, the module in any of the above devices can be one or more integrated circuits configured to implement the above methods, such as: one or more application specific integrated circuits (ASICs), or, one or more digital signal processors (DSPs), or, one or more field programmable gate arrays (FPGAs), or a combination of at least two of these integrated circuit forms.
[0148] For another example, when the modules in the device can be implemented in the form of a processing element scheduling program, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0149] Various objects such as various messages / information / equipment / network elements / systems / devices / actions / operations / processes / concepts that may appear in this application are named. It can be understood that these specific names do not constitute a limitation on the relevant objects. The names assigned may change with factors such as scenarios, contexts or usage habits. The understanding of the technical meaning of the technical terms in this application should be mainly determined from the functions and technical effects embodied / executed in the technical scheme.
[0150] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0151] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0152] Figure 5 This is a structural block diagram of an electronic device 300 according to an embodiment of the present application.
[0153] like Figure 5As shown, the electronic device 300 includes a processor 301 and a memory 302 , and may further include one or more of an information input / information output (I / O) interface 303 , a communication component 304 , and a communication bus 305 .
[0154] The processor 301 is used to control the overall operation of the electronic device 300 to complete all or part of the steps in the above-mentioned agricultural machinery TBOX crash protection method; the memory 302 is used to store various types of data to support the operation of the electronic device 300, and these data may include instructions for any application or method used to operate on the electronic device 300, and data related to the application. The memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), programmable read-only memory (Programmable Read-Only Memory, PROM), read-only memory (Read-Only Memory, ROM), magnetic memory, flash memory, disk or optical disk. One or more.
[0155] The I / O interface 303 provides an interface between the processor 301 and other interface modules, and the above-mentioned other interface modules can be keyboards, mice, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 304 is used to test the wired or wireless communication between the electronic device 300 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 304 can include: Wi-Fi components, Bluetooth components, NFC components.
[0156] The communication bus 305 may include a path to transmit information between the above components. The communication bus 305 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 305 may be divided into an address bus, a data bus, a control bus, etc.
[0157] The electronic device 300 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the agricultural machinery TBOX crash protection method given in the above embodiment.
[0158] The computer-readable storage medium provided in the embodiment of the present application is introduced below. The computer-readable storage medium described below and the agricultural machinery TBOX crash protection method described above can be referenced to each other.
[0159] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned agricultural machinery TBOX crash protection method are implemented.
[0160] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0161] The terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or also includes elements inherent to such process, method, article, or apparatus.
[0162] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of application involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the aforementioned application concept. For example, the above features are replaced with (but not limited to) technical features with similar functions applied in the present application.
Claims
1. A method for preventing agricultural machinery TBOX from freezing, characterized in that: The tbox includes a boot program and an app program, and the method includes: Obtaining a power-on signal, and reading a boot program based on the power-on signal; Based on the boot program, the tbox is initialized and the hardware watchdog is controlled to perform a hardware dog feeding operation; During the process of the hardware watchdog performing the hardware watchdog feeding operation, determining whether there is a hardware watchdog feeding timeout; if there is a hardware watchdog feeding timeout, controlling the tbox to restart; If there is no hardware watchdog feeding timeout, read the app program and control the software watchdog to start based on the app program; After the software watchdog is started, the software watchdog is fed based on the set priority task control; During the process of the software watchdog performing the software dog feeding operation, it is determined whether there is a software watchdog timeout; if there is a software watchdog timeout, the tbox is controlled to restart.
2. A method for preventing a TBOX from freezing in agricultural machinery according to claim 1, characterized in that: The method further comprises: In the process of controlling the software watchdog to start based on the app program, determining whether there is a hardware watchdog feeding timeout; If the hardware watchdog feeding timeout occurs during the process of controlling the software watchdog to start based on the app program, the tbox is controlled to restart; If there is no hardware watchdog timeout in the process of starting the software watchdog based on the app program control, it is determined that the software watchdog based on the app program control is started successfully.
3. The method for preventing a TBOX from freezing in an agricultural machine according to claim 1, characterized in that: The controlling the hardware watchdog to perform the hardware watchdog feeding operation includes: Sending a hardware dog feeding signal to the hardware watchdog based on a first set period, wherein the first set period is less than a set timeout period of the hardware watchdog; The hardware watchdog is controlled to perform a hardware watchdog feeding operation based on the hardware watchdog feeding signal.
4. A method for preventing agricultural machinery TBOX from freezing according to claim 1, characterized in that: The reading of the app program and controlling the start of the software watchdog based on the app program include: Based on the boot program, read and load the app program from a first setting storage location to a second setting storage location, where the first setting storage location is a non-volatile memory and the second setting storage location is a volatile memory; Performing integrity verification on the app program based on the boot program; If the verification is successful, the stack top pointer is set to the stack top address of the app program based on the boot program, and the program counter is set to the entry address of the app program; The app program is initialized and a software dog feeding signal is sent to the software watchdog based on a second set period to start the software watchdog, wherein the second set period is less than a set timeout period of the software watchdog.
5. The method for preventing agricultural machinery TBOX from freezing according to claim 1, characterized in that: The software watchdog feeding operation based on the set priority task control software watchdog includes: Setting the task priority configuration of the software watchdog to the lowest priority task, wherein the task priority represents the priority of the task in obtaining CPU resources; Based on the lowest priority task, control the software watchdog to perform software watchdog feeding operation.
6. A method for preventing a TBOX from freezing in agricultural machinery according to claim 4, characterized in that: After the software watchdog is started, it also includes: Set the hardware watchdog task priority configuration to the highest priority task; Based on the highest priority task, control the hardware watchdog to perform hardware watchdog feeding operations.
7. The method for preventing a TBOX from freezing in an agricultural machine according to claim 1, characterized in that: The app programs include wireless communication function program, positioning function program, Bluetooth wifi function program, CAN communication function program, OTA function program, sleep wake-up function program, financial car locking function program, photo taking function program and file system function program.
8. A TBOX crash protection device for agricultural machinery, characterized in that: The tbox includes a boot program and an app program, and the device includes: An acquisition module, used for acquiring a power-on signal, and reading a boot program based on the power-on signal; A hardware watchdog execution module is used to initialize the tbox based on the boot program and control the hardware watchdog to perform a hardware watchdog feeding operation; The first judgment module is used to judge whether there is a hardware watchdog feeding timeout during the process of the hardware watchdog performing the hardware feeding operation; if there is a hardware watchdog feeding timeout, it will enter the restart module; if there is no hardware watchdog feeding timeout, it will enter the software watchdog startup module; the restart module is used to control the tbox to restart to prevent the tbox from freezing; A software watchdog startup module, used to read the app program and control the startup of the software watchdog based on the app program; The software watchdog execution module is used to control the software watchdog to perform software watchdog feeding operation based on the set priority task after the software watchdog is started; The second judgment module is used to judge whether there is a software watchdog timeout during the process of the software watchdog performing the software dog feeding operation; if there is a software watchdog timeout, it will enter the restart module.
9. An electronic device, characterized in that: comprising a processor coupled to a memory; The processor is configured to execute a computer program stored in the memory, so that the electronic device executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The method comprises a computer program or an instruction, and when the computer program or the instruction is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 7.