Synchronization signal generation method and device, electronic equipment, computer readable storage medium and computer program product

By dynamically adjusting the interrupt triggering time of the timer in a multi-sensor control system, the problem of low synchronization signal generation accuracy in the prior art is solved, and a higher time accuracy is achieved.

CN119861640APending Publication Date: 2025-04-22CHINA RAILWAY HI TECH IND CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510054976.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

When generating a synchronization signal, the prior art causes an error between the interrupt time actually triggered by the timer and the interrupt time expected by the user due to the system scheduling error, thereby reducing the accuracy of the synchronization signal.

Method used

By obtaining the preset period, the setting timer counts according to the preset period, and after the preset period is over, the multi-sensor control system is triggered to enter the interrupt service program to output the synchronization signal. The first output time of the actual output synchronization signal is detected, the second output time of the expected output synchronization signal is determined according to the preset period, and the adjustment timer triggers the multi-sensor control system to enter the interrupt service program again to output a new synchronization signal at the target interrupt time.

Benefits of technology

By dynamically adjusting the interrupt trigger time of the timer, the generation time error of the new synchronization signal is reduced, and the generation time accuracy of subsequent synchronization signals is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119861640A_ABST
    Figure CN119861640A_ABST
Patent Text Reader

Abstract

The invention relates to a synchronization signal generation method and device, electronic equipment, a computer readable storage medium and a computer program product. The method comprises the steps that a preset period is obtained, a timer is set to count according to the preset period, the multi-sensor control system is triggered to enter an interrupt service program after the preset period is finished, and the interrupt service program is used for outputting a synchronizing signal; detecting a first output moment when the multi-sensor control system actually outputs the synchronizing signal; determining a second output moment when the multi-sensor control system expects to output the synchronizing signal according to the preset period; and determining a target interruption moment according to the first output moment, the second output moment and the preset period, and adjusting the timer to trigger the multi-sensor control system to enter the interruption service program again to output a new synchronization signal at the target interruption moment. By adopting the method, the output precision of subsequent new synchronizing signals can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of sensor control technology, and in particular to a method, device, electronic device, computer-readable storage medium and computer program product for generating a synchronization signal. Background Art

[0002] With the widespread application of multi-sensor solutions, users have higher and higher requirements for the synchronization triggering accuracy between multiple sensors. At present, timers are often used to determine the common time base between various sensors. Users can set the multi-sensor control system to enter the interruption to generate a synchronization signal when the timer reaches the preset reading, and send the synchronization signal to each sensor to achieve multi-sensor synchronization. However, in the actual generation process of the synchronization signal, due to the system scheduling error, it is easy for the interruption time actually triggered by the timer to be different from the interruption time expected by the user, resulting in low accuracy of the generated synchronization signal. Summary of the invention

[0003] Based on this, it is necessary to provide a method, device, electronic device, computer-readable storage medium and computer program product for generating a high-precision synchronization signal in response to the above technical problems.

[0004] In a first aspect, the present application provides a method for generating a synchronization signal, comprising:

[0005] Obtaining a preset period, setting a timer to count according to the preset period, and triggering the multi-sensor control system to enter an interrupt service program after the preset period ends, wherein the interrupt service program is used to output a synchronization signal;

[0006] Detecting a first output time point at which the multi-sensor control system actually outputs the synchronization signal;

[0007] Determining a second output time at which the multi-sensor control system is expected to output the synchronization signal according to the preset period;

[0008] The target interruption time is determined according to the first output time, the second output time and the preset period, and the timer is adjusted to trigger the multi-sensor control system to re-enter the interruption service program to output a new synchronization signal at the target interruption time.

[0009] In one embodiment, determining the target interruption time according to the first output time, the second output time and the preset period includes:

[0010] Determine a time offset value between the first output time and the second output time;

[0011] Determining a third output time at which the multi-sensor control system is expected to output the new synchronization signal according to the second output time and the preset period;

[0012] The third output time is adjusted using the time offset value, and the adjusted third output time is used as the target interruption time.

[0013] In one embodiment, the method further comprises:

[0014] Detecting a fourth output time when the multi-sensor control system actually outputs the new synchronization signal;

[0015] determining a new time offset value between the third output time and the fourth output time;

[0016] The new time offset value, the third output time and the preset period are used to determine a new target interrupt time for the timer to trigger the multi-sensor control system to enter the interrupt service program next time after the target interrupt time.

[0017] In one embodiment, the method further comprises:

[0018] Detecting a first interruption moment when the multi-sensor control system actually enters the interruption service routine;

[0019] Determining a second interruption time when the multi-sensor control system is expected to enter the interruption service routine according to the preset period;

[0020] The first interruption time and the second interruption time are used to determine a system scheduling error between the time when the timer triggers the multi-sensor control system and the time when the multi-sensor control system actually enters the interruption service program.

[0021] In one embodiment, the method further comprises:

[0022] Detecting an actual level reversal moment of the multi-sensor control system in the interrupt service routine;

[0023] Determine an expected level reversal time of the multi-sensor control system in the interrupt service program by using the second interrupt time and the system scheduling error;

[0024] The actual level reversal time and the expected level reversal time are used to determine the action time of the multi-sensor control system in the interrupt service program.

[0025] In one embodiment, before obtaining the preset period, setting the timer to count according to the preset period, and triggering the multi-sensor control system to enter the interrupt service routine after the preset period ends, the method further includes:

[0026] Get timing source data;

[0027] Determine a time deviation value between the timing source data and the timer;

[0028] Converting the time deviation value into a clock count value matching the data format of the timer;

[0029] The timer is calibrated using the clock count value.

[0030] In a second aspect, the present application also provides a synchronization signal generation device, including:

[0031] A timer setting module, used to obtain a preset period, set the timer to count according to the preset period, and trigger the multi-sensor control system to enter an interrupt service program after the preset period ends, and the interrupt service program is used to output a synchronization signal;

[0032] An output detection module, used for detecting a first output moment when the multi-sensor control system actually outputs the synchronization signal;

[0033] An expected determination module, used to determine the second output time when the multi-sensor control system is expected to output the synchronization signal according to the preset period;

[0034] An interrupt adjustment module is used to determine a target interrupt time according to the first output time, the second output time and the preset period, and adjust the timer to trigger the multi-sensor control system to re-enter the interrupt service program to output a new synchronization signal at the target interrupt time.

[0035] In a third aspect, the present application further provides an electronic device, wherein the electronic device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method for generating a synchronization signal as described in any one of the embodiments of the first aspect is implemented.

[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for generating a synchronization signal as described in any one of the embodiments of the first aspect above is implemented.

[0037] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the method for generating a synchronization signal as described in any one of the embodiments of the first aspect above is implemented.

[0038] The above-mentioned synchronization signal generation method, device, electronic device, computer-readable storage medium and computer program product obtain a preset period, set a timer to count according to the preset period, and trigger the multi-sensor control system to enter the interrupt service program to output the synchronization signal after the preset period ends, detect the first output moment when the multi-sensor control system actually outputs the synchronization signal, determine the second output moment when the multi-sensor control system is expected to output the synchronization signal according to the preset period, determine the target interrupt moment according to the first output moment, the second output moment and the preset period, adjust the timer to trigger the multi-sensor control system to enter the interrupt service program again to output a new synchronization signal at the target interrupt moment, and can use the actual first output moment and the expected second output moment of the current synchronization signal to dynamically adjust the target interrupt moment when the timer triggers the multi-sensor control system to generate a new synchronization signal next time, thereby reducing the generation time error of the new synchronization signal output next time and improving the generation time accuracy of subsequent new synchronization signals. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 is an application environment diagram of a method for generating a synchronization signal in an embodiment;

[0041] Figure 2 is a schematic flow chart of a method for generating a synchronization signal in an embodiment;

[0042] Figure 3 A schematic flow chart of a target interruption time determination step in one embodiment;

[0043] Figure 4 A schematic flow chart of a new target interruption time determination step in one embodiment;

[0044] Figure 5 A waveform diagram of a synchronization signal in an embodiment Figure 1 ;

[0045] Figure 6 A waveform diagram of a synchronization signal in another embodiment is shown in FIG. Figure 2 ;

[0046] Figure 7 A schematic flow chart of a system scheduling error determination step in an embodiment;

[0047] Figure 8 A schematic diagram of a flow chart of a step of determining the time consumption of an action in an embodiment;

[0048] Fig. 9 A schematic flow chart of a timer calibration step in one embodiment;

[0049] Fig.10 is a flow chart of a method for generating a synchronization signal in another embodiment;

[0050] Fig.11 A waveform diagram of a synchronization signal in another embodiment is shown in FIG. Figure 3 ;

[0051] Fig.12 is a schematic diagram of a time error of a synchronization signal in one embodiment;

[0052] Fig.13 The figure is a structural block diagram of a device for generating a synchronization signal in an embodiment. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0054] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0055] The method for generating a synchronization signal provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown.

[0056] The multi-sensor control system 100 may be equipped with a processor chip, in which the synchronization signal generation logic is stored. The multi-sensor control system 100 may use the processor chip to perform data processing operations corresponding to the synchronization signal generation logic to control the timer 120 and the multiple sensors 140.

[0057] The timer 120 may include but is not limited to any one of various timing devices such as a software timer, a hardware timer, and a pulse timer.

[0058] The sensor 140 may include but is not limited to any one or more of a variety of sensors such as a laser sensor, an image sensor, and a positioning sensor.

[0059] For example, the multi-sensor control system 100 can obtain a preset period, use the preset period to initialize the timer 120, set the timer 120 to count according to the preset period, and perform an operation to trigger the multi-sensor control system 100 to enter the interrupt service program after the preset period ends. The multi-sensor control system 100 can generate and output a synchronization signal through level inversion in the interrupt service program. The synchronization signal can be used to control the synchronization of each sensor 140.

[0060] The multi-sensor control system 100 can determine the first output time of the actual output synchronization signal by collecting the waveform information of the synchronization signal actually sent to each sensor 140. The multi-sensor control system 100 can determine the second output time of the synchronization signal expected to be currently output according to the preset period. The multi-sensor control system 100 can perform calculations on the first output time, the second output time and the preset period to obtain the target interruption time. The multi-sensor control system 100 can adjust the timer 120 to trigger the multi-sensor control system 100 to enter the interrupt service program again at the target interruption time to output a new synchronization signal to each sensor 140.

[0061] In this embodiment, by adjusting the target interrupt time for the next time the timer triggers the multi-sensor control system to enter the interrupt service program according to the preset period of the timer count, the first output time when the multi-sensor control system actually sends the synchronization signal to each sensor, and the second output time when the user expects to send the synchronization signal based on the preset period, the interrupt trigger time of the timer can be dynamically adjusted in combination with the actual output time and the expected output time, thereby improving the time accuracy of the subsequent output of new synchronization signals.

[0062] In an exemplary embodiment, Figure 2 As shown, a method for generating a synchronization signal is provided, and the method is applied to Figure 1 The multi-sensor control system 100 in FIG. 1 is taken as an example to illustrate the method, which includes the following steps S202 to S208. Among them:

[0063] Step S202, obtaining a preset period, setting a timer to count according to the preset period, and triggering the multi-sensor control system to enter an interrupt service program after the preset period ends. The interrupt service program is used to output a synchronization signal.

[0064] Optionally, in some embodiments, the multi-sensor control system may receive a preset period directly input by a user. The timer is set to count according to the preset period, and after the preset period ends, the multi-sensor control system is triggered to enter the interrupt service program. For example, the timer can be set to start counting after it is started. When the count value of the timer matches the count value corresponding to the preset period, a preset period is completed, and an interrupt signal is sent to the multi-sensor control system through the timer, so that the multi-sensor control system enters the interrupt service program and outputs a synchronization signal after receiving the interrupt signal.

[0065] Step S204, detecting the first output moment when the multi-sensor control system actually outputs the synchronization signal.

[0066] Exemplarily, after the synchronization signal is sent, the multi-sensor control system can collect the waveform information of the output synchronization signal, the level jump information of the multi-sensor control system, or the response signal corresponding to the synchronization signal fed back by the sensor, so as to determine the first output time of the current actual output synchronization signal.

[0067] Step S206, determining a second output time at which the multi-sensor control system is expected to output a synchronization signal according to a preset cycle.

[0068] Exemplarily, the multi-sensor control system can use the start time of the timer counting and the preset period to perform calculations and processing to obtain a time after the start time and at a preset period interval from the start time, that is, the second output time when the multi-sensor control system expects to output the synchronization signal in the absence of additional time loss.

[0069] Step S208, determining a target interruption time according to the first output time, the second output time and the preset period, adjusting the timer to trigger the multi-sensor control system to re-enter the interruption service program to output a new synchronization signal at the target interruption time.

[0070] Exemplarily, the multi-sensor control system may perform computational processing on the first output time and the second output time to determine a time difference between the first output time and the second output time.

[0071] Optionally, in some embodiments, the time difference and the preset period can be used for calculation processing, and the data obtained after the processing is used as the time interval between the first output moment and the moment when the timer triggers the multi-sensor control system next time. The target interruption moment is obtained by calculating the time interval and the first output moment. Alternatively, in other embodiments, the second output moment and the preset period can be used for calculation processing to obtain the expected moment when the multi-sensor control system is triggered to enter the interrupt service program to output a new synchronization signal next time. The time difference between the current first output moment and the second output moment is used to calculate the expected moment to obtain the target interruption moment.

[0072] The multi-sensor control system may send the target interruption time to the timer, and set the timer to trigger the multi-sensor control system to enter the interruption service program at the target interruption time to output a new synchronization signal. Optionally, in some embodiments, the multi-sensor control system may also set the timer to repeat the operation starting from the target interruption time: counting according to a preset period and executing the operation of triggering the multi-sensor control system to enter the interruption service program to output a new synchronization signal once after the preset period ends.

[0073] In the above-mentioned method for generating a synchronization signal, a preset period is obtained, a timer is set to count according to the preset period, and after the preset period ends, the multi-sensor control system is triggered to enter the interrupt service program to output the synchronization signal, the first output moment when the multi-sensor control system actually outputs the synchronization signal is detected, and the second output moment when the multi-sensor control system is expected to output the synchronization signal is determined according to the preset period, and the target interrupt moment is determined according to the first output moment, the second output moment and the preset period, and the timer is adjusted to trigger the multi-sensor control system to enter the interrupt service program again to output a new synchronization signal at the target interrupt moment. The actual first output moment and the expected second output moment of the current synchronization signal can be used to dynamically adjust the target interrupt moment when the timer triggers the multi-sensor control system to generate a new synchronization signal next time, thereby reducing the generation time error of the new synchronization signal output next time, and improving the generation time accuracy of subsequent new synchronization signals.

[0074] In an exemplary embodiment, Figure 3 As shown, step S208 includes steps S302 to S306. Among them:

[0075] Step S302: determine a time offset value between the first output time and the second output time.

[0076] Exemplarily, the multi-sensor control system can perform calculations on the first output moment of the actual output synchronization signal and the second output moment of the expected output synchronization signal, and use the difference between the first output moment and the second output moment as the time offset value between the first output moment and the second output moment.

[0077] Step S304: determining a third output time at which the multi-sensor control system is expected to output a new synchronization signal according to the second output time and the preset period.

[0078] Exemplarily, the multi-sensor control system can use the second output moment and the preset period to perform calculations and process, and use the moment after the second output moment with an interval of the preset period as the expected output moment corresponding to the new synchronization signal output by the multi-sensor control system next time, that is, the third output moment.

[0079] Step S306: adjusting the third output time by using the time offset value, and using the adjusted third output time as the target interruption time.

[0080] Exemplarily, the multi-sensor control system can use the time offset value between the actual output and the expected output of the current synchronization signal, as well as the third output moment when the next new synchronization signal is expected to be output, for calculation and processing. For example, the moment before the third output moment that is separated from the third output moment by the time offset value can be used as the adjusted third output moment, that is, the target interruption moment.

[0081] The subsequent multi-sensor control system controls the timer to execute the operation of triggering the multi-sensor control system to enter the interrupt service program at the target interrupt time, so that the trigger time of the timer can be advanced by the time offset value, thereby obtaining a new synchronization signal output at the third output time.

[0082] In this embodiment, by utilizing the time offset value between the actual output and the expected output of the current synchronization signal, the time when the timer triggers the interrupt next time is adjusted, which can help the next new synchronization signal to be output according to the expected third output time, reduce the generation time error of the next new synchronization signal to be output, and improve the generation time accuracy of the next new synchronization signal to be output.

[0083] In an exemplary embodiment, Figure 4 As shown, the method for generating a synchronization signal provided in the present application may further include the following steps S402 to S406. Among them:

[0084] Step S402: Detect the fourth output time of the new synchronization signal actually output by the multi-sensor control system.

[0085] Exemplarily, the detection method of the first output moment provided in the above step S204 can be referred to to detect the next time the multi-sensor control system actually outputs a synchronization signal after the first output moment, that is, the fourth output moment of the new synchronization signal.

[0086] Step S404: determine a new time offset value between the third output time and the fourth output time.

[0087] Exemplarily, the multi-sensor control system may perform computational processing on the third output time at which the new synchronization signal is expected to be output and the fourth output time at which the new synchronization signal is actually output, to determine a new time offset value between the third output time and the fourth output time.

[0088] Step S406, using the new time offset value, the third output time and the preset period to determine a new target interrupt time for the timer to trigger the multi-sensor control system to enter the interrupt service routine next time after the target interrupt time.

[0089] Exemplarily, the multi-sensor control system can use the third output moment and the preset period to determine the expected moment of the multi-sensor control system outputting the synchronization signal next time. The expected moment of the next output synchronization signal after the third output moment is adjusted using the new time offset value determined in step S404 to obtain a new target interruption moment for the timer to trigger the multi-sensor control system to enter the interrupt service routine next time after the target interruption moment in step S208.

[0090] In this embodiment, by continuing to use the new time offset value between the actual output time and the expected output time of the new synchronization signal to adjust the time when the timer triggers the interrupt next time, it is possible to implement iterative cyclic adjustment of the timer interrupt trigger, which helps to further improve the time accuracy of the synchronization signal subsequently output by the multi-sensor control system.

[0091] For example, Figure 5 As shown, the waveform diagrams of the synchronization signal under the ideal state (i.e., the state without any time error) of the current multi-sensor control system expected output and the synchronization signal under the actual state of the actual output are respectively shown. Among them, T0 can represent the time when the timer starts counting, and D can represent the preset period of the timer.

[0092] from Figure 5It can be seen that, in an ideal state, the timer is set to start counting from time T0. When the count reaches the preset period D, the multi-sensor control system is triggered by the timer to enter the interrupt service program and the level is reversed, and the synchronization signal from time T0 to time T0+2D is output at the time T0+2D. The timer starts counting the next preset period from time T0+2D, and ends the preset period at time T0+3D, triggering the multi-sensor control system to enter the interrupt service program and the level is reversed.

[0093] However, in actual conditions, although the timer triggers the multi-sensor control system to enter an interrupt at time T0+D, the multi-sensor control system actually enters the interrupt service routine at time T0+D+t1. Therefore, there is a time error caused by system scheduling between the time when the timer triggers the multi-sensor control system to interrupt and the time when the multi-sensor control system actually enters the interrupt service routine.

[0094] In actual state, although the timer triggers the multi-sensor control system to enter the interruption and the level inversion occurs at the time of T0+D, the multi-sensor control system actually does not reverse the level until the time of T0+D+t1+t2. Therefore, there is still time for executing certain actions from the time when the multi-sensor control system enters the interruption service routine to the time when the level inversion occurs.

[0095] At the same time, in actual conditions, the timer is usually set to trigger the interruption at the next time after the multi-sensor control system actually enters the interruption service program. Therefore, the timer will trigger the multi-sensor control system to enter the interruption at the time of T0+2D+t1+t2. However, in the process of outputting a new synchronization signal next time, there is also a time error t1' generated by the system scheduling and the action time t2' after entering the interruption. As a result, in the process of outputting a new synchronization signal next time, the multi-sensor control system actually enters the interruption service program at the time of T0+2D+t1+t2+t1', and the level reversal occurs at the time of T0+2D+t1+t2+t1'+t2'. It can be seen from this that the synchronization signal generation method currently implemented by the timer will cause the frequency of the synchronization signal finally output to deviate more and more from the signal frequency corresponding to the preset period as the number of interruptions increases, affecting the accuracy of the synchronization signal.

[0096] For example, Figure 6 As shown, a waveform diagram of the synchronous signal output when the timer is forcibly set to an interrupt value of T0+D, T0+2D, T0+3D (T0 is the start time of the timer counting, and D is the preset period), etc. is shown.

[0097] from Figure 6It can be seen that although the timer is set to trigger the multi-sensor control system interrupt at T0+D, T0+2D, T0+3D, etc., there are still time offset values ​​of t1+t2, t1'+t2', and t1''+t2'' each time the multi-sensor control system actually enters the interrupt service program.

[0098] Based on the time offset problem existing in the above method, in an exemplary embodiment, as Figure 7 As shown, the method for generating a synchronization signal provided in the present application may further include steps S702 to S706. Among them:

[0099] Step S702, detecting the first interruption moment when the multi-sensor control system actually enters the interruption service program.

[0100] Optionally, in some embodiments, an external hardware device may be used to detect the first interruption time when the multi-sensor control system actually enters the interruption service program. Alternatively, in other embodiments, a specific flag bit may be set in the interruption service program. When the flag bit is detected, the current time is used as the first interruption time when the multi-sensor control system actually enters the interruption service program.

[0101] Step S704, determining the second interruption time when the multi-sensor control system is expected to enter the interruption service routine according to the preset cycle.

[0102] Exemplarily, the multi-sensor control system can perform calculations on the count start time of the timer and the preset period to obtain the second interrupt time when the multi-sensor control system is expected to enter the interrupt service program without any time error. For example, when the count start time is T0 and the preset period is D, it can be determined that the second interrupt time when the multi-sensor control system is expected to enter the interrupt service program is T0+D.

[0103] Step S706, using the first interruption time and the second interruption time, determine a system scheduling error between the time when the timer triggers the multi-sensor control system and the time when the multi-sensor control system actually enters the interruption service program.

[0104] Exemplarily, the multi-sensor control system can perform calculations on the first interruption moment and the second interruption moment, and use the difference between the first interruption moment and the second interruption moment as the system scheduling error from the moment when the timer triggers the multi-sensor control system to the moment when the multi-sensor control system actually enters the interruption service program.

[0105] In this embodiment, by detecting the first interrupt time when the multi-sensor control system actually enters the interrupt service program and the second interrupt time when it is expected to enter the interrupt service program, the system scheduling error is determined using the first interrupt time and the second interrupt time. This makes it possible to eliminate the impact of the system scheduling error on the synchronization signal output time in subsequent timer interrupt triggers, thereby helping to improve the time accuracy of subsequent synchronization signal generation.

[0106] In an exemplary embodiment, Figure 8 As shown, the method for generating a synchronization signal provided in the present application may further include steps S802 to S806. Among them:

[0107] Step S802, detecting the actual level reversal moment of the multi-sensor control system in the interrupt service program.

[0108] For example, an oscilloscope can be used to read the real-time signal level of the multi-sensor control system. When a jump from a high level to a low level, or a jump from a low level to a high level is detected, the current moment can be recorded as the actual level reversal moment of the multi-sensor control system in the interrupt service program.

[0109] Step S804: Determine the expected level reversal time of the multi-sensor control system in the interrupt service program by using the second interrupt time and the system scheduling error.

[0110] For example, the multi-sensor control system can use the expected second interrupt time of entering the interrupt service routine and the actual system scheduling error to calculate the expected level reversal time of the multi-sensor control system without any action time consumption. For example, when the second interrupt time is T0+D and the system scheduling error is t1, the expected level reversal time can be determined to be T0+D+t1.

[0111] Step S806, using the actual level reversal time and the expected level reversal time, determine the action time of the multi-sensor control system in the interrupt service program.

[0112] Exemplarily, the multi-sensor control system may perform calculations on the actual level reversal time and the expected level reversal time, and use the difference between the actual level reversal time and the expected level reversal time as the action time of the multi-sensor control system in the interrupt service program.

[0113] In this embodiment, by detecting the actual level reversal moment of the multi-sensor control system in the interrupt service program, calculating the expected level reversal moment in the absence of action time, and using the actual level reversal moment and the expected level reversal moment to determine the action time, it is possible to eliminate the influence of the action time on the output moment of the synchronization signal during the subsequent synchronization signal generation process, thereby helping to improve the time accuracy of the subsequent synchronization signal output.

[0114] In an exemplary embodiment, Fig. 9 As shown, the method for generating a synchronization signal provided in the present application further includes steps S902 to S908. Among them:

[0115] Step S902, obtaining timing source data.

[0116] Step S904, determining the time deviation value between the timing source data and the timer.

[0117] Step S906: convert the time deviation value into a clock count value that matches the data format of the timer.

[0118] Step S908, calibrating the timer using the clock count value.

[0119] Among them, the timing source data can be used as unified time standard data among multiple sensors.

[0120] Exemplarily, the multi-sensor control system can obtain timing source data through timing sources such as the Network Time Protocol (NTP), global positioning system satellites, and ground radio wave signals. Calculate the time deviation value between the timing source data and the timer's own clock parameters. Convert the time deviation value to a clock count value that matches the data format of the timer. Use the clock count value to calibrate the timer, for example, increase or decrease the corresponding clock count value based on the timer's own count value.

[0121] In this embodiment, by acquiring the timing source data to calibrate the timer, the clock synchronization between the sensors can be guaranteed, thereby improving the clock accuracy of the synchronization signal.

[0122] In an exemplary embodiment, Fig.10 As shown, a method for generating a synchronization signal is also provided, comprising the following steps S1002 to S1018. Among them:

[0123] Step S1002, obtaining timing source data, and determining a time deviation value between the timing source data and the timer.

[0124] Step S1004: convert the time deviation value into a clock count value that matches the data format of the timer, and use the time count value to calibrate the timer.

[0125] For example, a system-level chip based on a software-defined intelligent computing platform (such as the autonomous driving chip Orin) and a hardware timer for precise timing (such as a time stamp counter Time StampCounter, referred to as TSC timer) can be deployed in a multi-sensor control system. The multi-sensor control system can obtain the timing source data and calculate the time deviation value between the timing source data and the time currently counted by the timer. The time deviation value is converted into a time count value in the count value format of the timer. The time count value is used to calibrate the time of the timer to achieve time synchronization between the timer and the timing source.

[0126] Step S1006, obtaining a preset period, setting a timer to count according to the preset period, and triggering the multi-sensor control system to enter an interrupt service program after the preset period ends.

[0127] For example, the multi-sensor control system can obtain the operating frequency of any sensor in the multi-sensors, calculate the working cycle corresponding to the operating frequency as the preset cycle, set the timer to count according to the preset cycle, and trigger the multi-sensor control system to enter the interrupt service program to output the synchronization signal after the preset cycle ends. Thus, the synchronization signal can be used to achieve synchronous operation between the multi-sensors.

[0128] Step S1008, detecting the first output moment when the multi-sensor control system actually outputs the synchronization signal.

[0129] Step S1010, determining a second output time at which the multi-sensor control system is expected to output a synchronization signal according to a preset cycle.

[0130] Step S1012: determine a time offset value between the first output time and the second output time.

[0131] For example, the multi-sensor control system may detect a first output time of an actual output synchronization signal, determine a second output time of an expected output synchronization signal using a preset period, and calculate a difference between the first output time and the second output time as a time offset value.

[0132] For example, Fig.11 As shown, when the first output moment is T0'+Tadj+D+t1+t2 (T0' is the moment when the timer starts counting, D is the preset period, t1 is the system scheduling error, t2 is the action time, Tadj is the clock count value between the timer and the timing source), and the second output moment is T0'+Tadj+D, it can be determined that there is a time offset value of t1+t2 in the generation process of the synchronization signal here.

[0133] Step S1014: determining a third output time at which the multi-sensor control system is expected to output a new synchronization signal according to the second output time and the preset period.

[0134] Step S1016: adjust the third output time by using the time offset value, and use the adjusted third output time as the target interruption time.

[0135] Step S1018, adjusting the timer to trigger the multi-sensor control system to re-enter the interrupt service program at the target interrupt time to output a new synchronization signal.

[0136] For example, the multi-sensor control system can calculate the third output time when the multi-sensor control system is expected to output a new synchronization signal next time using the second output time and the preset period. The third output time is adjusted using the time offset value, and the adjusted third output time is used as the target interrupt time. The adjustment timer triggers the multi-sensor control system to enter the interrupt service program again at the target interrupt time to output a new synchronization signal.

[0137] For example, Fig.11 As shown, when the second output time is T0'+Tadj+D, the third output time of the expected output can be calculated using the preset period (D) as T0'+Tadj+2D. The third output time is adjusted using the time offset value (t1+t2), and the target interruption time can be obtained as T0'+Tadj+D-(t1+t2). As a result, the new synchronization signal is actually output at the time T0+2D+Tadj.

[0138] Optionally, in some embodiments, by triggering the multi-sensor control system to enter the interrupt service program to output a new synchronization signal at the target interrupt time in the above step S1018, the time accuracy is determined based on the difference between the system scheduling error and action time (t1'+t2') in the new synchronization signal generation process and the time offset value (t1+t2) in the previous synchronization signal generation process.

[0139] like Fig.12As shown, a scatter plot of the time accuracy of the synchronization signal generated by each interruption is shown (the data on the horizontal axis in the figure represents the number of times the multi-sensor control system enters the interruption, and the vertical axis represents the time error between the actual output and the expected output of the synchronization signal with a preset period of 50 milliseconds, and the unit is the clock count value clk). The data in the scatter plot can be the data obtained by repeating the above steps S1008 to S1018 10,000 times (that is, using the synchronization signal generation method provided in the present application to trigger the multi-sensor control system to enter 10,000 interruptions). Among them, the timer generates 31,250,000 clocks per second. The time error fluctuation range of the synchronization signal is ±5 milliseconds (us). The average error of the synchronization signal output per interruption is 31 clock count values ​​(clk, 1 clk is approximately equal to 0.99 milliseconds), and the maximum error is 144 clock count values ​​(4.6 milliseconds).

[0140] In this embodiment, by using the timing source data to calibrate the timer, it is beneficial to achieve time synchronization between multiple sensors. By setting the timer to count according to a preset period, and triggering the multi-sensor control system to enter the interrupt service program to output a synchronization signal after the preset period ends, the first output moment of the actual output of the synchronization signal is detected, and the second output moment of the expected output of the synchronization signal is determined according to the preset period. The time offset value between the actual output and the expected output of the current synchronization signal is used to calibrate the target interrupt moment of the next time the timer triggers an interrupt. The future error of the new synchronization signal to be output next can be predicted based on the historical error of the synchronization signal generation, thereby reducing the time error of the timer triggering the interrupt, which is beneficial to improving the time accuracy of the subsequent generation of new synchronization signals.

[0141] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.

[0142] Based on the same inventive concept, the embodiment of the present application also provides a device for generating a synchronization signal for implementing the method for generating a synchronization signal involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more synchronization signal generation devices provided below can refer to the limitations of the synchronization signal generation method above, and will not be repeated here.

[0143] In an exemplary embodiment, Fig.13 As shown, a synchronization signal generation device 1300 is provided, including: a timer setting module 1302, an output detection module 1304, an expected determination module 1306 and an interrupt adjustment module 1308, wherein:

[0144] The timer setting module 1302 is used to obtain a preset period, set the timer to count according to the preset period, and trigger the multi-sensor control system to enter an interrupt service program after the preset period ends. The interrupt service program is used to output a synchronization signal.

[0145] The output detection module 1304 is used to detect the first output moment when the multi-sensor control system actually outputs the synchronization signal.

[0146] The expected determination module 1306 is used to determine the second output time when the multi-sensor control system is expected to output the synchronization signal according to a preset period.

[0147] The interrupt adjustment module 1308 is used to determine the target interrupt time according to the first output time, the second output time and the preset period, and adjust the timer to trigger the multi-sensor control system to enter the interrupt service program again to output a new synchronization signal at the target interrupt time.

[0148] In an exemplary embodiment, the interrupt adjustment module 1308 includes: an offset determination unit, used to determine the time offset value between the first output moment and the second output moment; an output expectation unit, used to determine the third output moment at which the multi-sensor control system is expected to output a new synchronization signal based on the second output moment and a preset period; an output adjustment unit, used to adjust the third output moment using the time offset value, and use the adjusted third output moment as the target interruption moment.

[0149] In an exemplary embodiment, the interrupt adjustment module 1308 is also used to: detect the fourth output moment when the multi-sensor control system actually outputs a new synchronization signal; determine a new time offset value between the third output moment and the fourth output moment; and use the new time offset value, the third output moment and a preset period to determine the new target interrupt moment when the timer triggers the multi-sensor control system to enter the interrupt service program next time after the target interrupt moment.

[0150] In an exemplary embodiment, the synchronization signal generating device 1300 also includes: a scheduling determination module, which is used to detect the first interrupt time when the multi-sensor control system actually enters the interrupt service program; determine the second interrupt time when the multi-sensor control system is expected to enter the interrupt service program according to a preset period; and use the first interrupt time and the second interrupt time to determine the system scheduling error between the time when the timer triggers the multi-sensor control system and the time when the multi-sensor control system actually enters the interrupt service program.

[0151] In an exemplary embodiment, the synchronization signal generating device 1300 also includes: a time-consuming determination module, which is used to detect the first interrupt time when the multi-sensor control system actually enters the interrupt service program; determine the second interrupt time when the multi-sensor control system is expected to enter the interrupt service program according to a preset period; and use the first interrupt time and the second interrupt time to determine the system scheduling error between the time when the timer triggers the multi-sensor control system and the time when the multi-sensor control system actually enters the interrupt service program.

[0152] In an exemplary embodiment, the synchronization signal generating device 1300 also includes: a timing source synchronization module, which is used to obtain timing source data; determine the time deviation value between the timing source data and the timer; convert the time deviation value into a clock count value that matches the data format of the timer; and calibrate the timer using the clock count value.

[0153] Each module in the above-mentioned synchronization signal generating device 1300 can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in an electronic device in the form of hardware, or can be stored in a memory in an electronic device in the form of software, so that the processor can call and execute operations corresponding to each module above.

[0154] Those skilled in the art will understand that the structures shown in the above figures are merely block diagrams of partial structures related to the scheme of the present application, and do not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.

[0155] In an exemplary embodiment, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0156] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0157] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0158] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0159] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0160] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for generating a synchronization signal, characterized in that: The method comprises: Obtaining a preset period, setting a timer to count according to the preset period, and triggering the multi-sensor control system to enter an interrupt service program after the preset period ends, wherein the interrupt service program is used to output a synchronization signal; Detecting a first output time point at which the multi-sensor control system actually outputs the synchronization signal; Determining a second output time at which the multi-sensor control system is expected to output the synchronization signal according to the preset period; The target interruption time is determined according to the first output time, the second output time and the preset period, and the timer is adjusted to trigger the multi-sensor control system to re-enter the interruption service program to output a new synchronization signal at the target interruption time.

2. The method according to claim 1, characterized in that The determining the target interruption time according to the first output time, the second output time and the preset period includes: Determine a time offset value between the first output time and the second output time; Determining a third output time at which the multi-sensor control system is expected to output the new synchronization signal according to the second output time and the preset period; The third output time is adjusted using the time offset value, and the adjusted third output time is used as the target interruption time.

3. The method according to claim 2, characterized in that The method further comprises: detecting a fourth output time at which the multi-sensor control system actually outputs the new synchronization signal; determining a new time offset value between the third output time and the fourth output time; The new time offset value, the third output time and the preset period are used to determine a new target interrupt time for the timer to trigger the multi-sensor control system to enter the interrupt service program next time after the target interrupt time.

4. The method according to claim 1, characterized in that: The method further comprises: Detecting a first interruption moment when the multi-sensor control system actually enters the interruption service routine; Determining a second interrupt time when the multi-sensor control system is expected to enter the interrupt service routine according to the preset period; The first interruption time and the second interruption time are used to determine a system scheduling error between the time when the timer triggers the multi-sensor control system and the time when the multi-sensor control system actually enters the interruption service program.

5. The method according to claim 4, characterized in that The method further comprises: Detecting an actual level reversal moment of the multi-sensor control system in the interrupt service routine; Determine an expected level reversal time of the multi-sensor control system in the interrupt service program by using the second interrupt time and the system scheduling error; The actual level reversal time and the expected level reversal time are used to determine the action time of the multi-sensor control system in the interrupt service program.

6. The method according to claim 1, characterized in that Before obtaining the preset period, setting the timer to count according to the preset period, and triggering the multi-sensor control system to enter the interrupt service program after the preset period ends, the method further includes: Get timing source data; Determine a time deviation value between the timing source data and the timer; Converting the time deviation value into a clock count value matching the data format of the timer; The timer is calibrated using the clock count value.

7. A device for generating a synchronization signal, characterized in that: The device comprises: A timer setting module, used to obtain a preset period, set the timer to count according to the preset period, and trigger the multi-sensor control system to enter an interrupt service program after the preset period ends, and the interrupt service program is used to output a synchronization signal; An output detection module, used for detecting a first output moment when the multi-sensor control system actually outputs the synchronization signal; An expected determination module, used to determine the second output time when the multi-sensor control system is expected to output the synchronization signal according to the preset period; An interrupt adjustment module is used to determine a target interrupt time according to the first output time, the second output time and the preset period, and adjust the timer to trigger the multi-sensor control system to re-enter the interrupt service program to output a new synchronization signal at the target interrupt time.

8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.