Time service method and vehicle
By building a virtual system with a shared microcontroller in the system-on-a-chip and using priority rules to obtain high-precision clock time from an external clock source, the problems of hardware resource waste and high cost in traditional vehicle systems are solved, and high-precision time synchronization of the TBox system is realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-03-13
AI Technical Summary
In traditional vehicle systems, the TBox and the host are independent hardware components, resulting in wasted hardware resources and high hardware costs. How can we achieve high-precision time synchronization for the TBox system while sharing a microcontroller unit and system-on-a-chip?
Multiple virtual systems, including a host entertainment system and a TBox system, are built in a single system-on-a-chip (SoC). They share the same microcontroller unit and obtain high-precision clock time from an external clock source through priority rules for time synchronization.
This reduces hardware resource waste and hardware costs, while achieving high-precision time synchronization for the TBox system and reducing dependence on the main console entertainment system.
Smart Images

Figure CN121664346A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicle control technology, and more specifically, to a timing method and a vehicle in the field of vehicle control technology. Background Technology
[0002] In traditional vehicle systems, the telematics box (TBox) and the host are two separate hardware components, each with its own system-on-chip (SOC), microcontroller unit (MCU), and controller area network (CAN) transceiver. However, this leads to a waste of hardware resources and high hardware costs.
[0003] Therefore, while reducing the waste of hardware resources and hardware costs, how to provide high-precision time synchronization for the TBox system has become a technical problem that needs to be solved. Summary of the Invention
[0004] This application provides a timing method and a vehicle. The method can still provide high-precision timing for the TBox system in multiple virtual systems by using a first priority rule when multiple virtual systems share the same microcontroller unit and multiple virtual systems are built in a system-on-a-chip.
[0005] Firstly, a time synchronization method is provided, applied in a vehicle including multiple virtual systems built in a system-on-a-chip, the multiple virtual systems including at least a host entertainment system and a TBox system, and the multiple virtual systems sharing the same microcontroller unit. The method includes: after the TBox system completes startup, the TBox system determines a first system time, the first system time including a pending system time determined by the TBox system based on a verification result, or a target system time obtained by the TBox system from the host entertainment system, the target system time being related to a local clock time obtained from a local clock source in the microcontroller unit; the TBox system uses a first priority rule to determine a second system time from a first clock time obtained from a first external clock source and the first system time; and uses the second system time to synchronize the time of the TBox system.
[0006] The above technical solution enables the construction of multiple virtual systems within a single system-on-a-chip (SoC). These virtual systems include at least a host entertainment system and a TBox system. Even when multiple virtual systems share the same microcontroller unit, the first priority rule is still used to provide time synchronization for the TBox system. Even if the TBox system relies on the target system time obtained from the host entertainment system and is related to the local clock time, it can still achieve high-precision time synchronization by obtaining the first clock time from a high-priority first external clock source. This reduces the TBox system's dependence on the target system time obtained from the host entertainment system.
[0007] Secondly, a time synchronization device is provided, which is applied in a vehicle. The vehicle includes multiple virtual systems built on a system-on-a-chip (SoC). The multiple virtual systems include at least a host entertainment system and a TBox system, and the multiple virtual systems share the same microcontroller unit. The device includes: a first determining module, used to determine a first system time for the TBox system after the TBox system has started up. The first system time includes a pending system time determined by the TBox system based on a verification result, or a target system time obtained by the TBox system from the host entertainment system. The target system time is related to a local clock time obtained from a local clock source in the microcontroller unit; a second determining module, used for the TBox system to determine a second system time from a first clock time and the first system time obtained from a first external clock source using a first priority rule; and a time synchronization module, used to synchronize the time of the TBox system using the second system time.
[0008] Thirdly, a vehicle is provided, including a controller comprising a system-on-a-chip and a microcontroller unit, the system-on-a-chip comprising: a memory for storing executable program code; and a processor for calling and running the executable program code from the memory, causing the vehicle to perform the methods described in the first aspect or any possible implementation thereof.
[0009] Fourthly, a computer program product is provided, comprising: computer program code, which, when run on a computer, causes the computer to perform the methods described in the first aspect or any possible implementation thereof.
[0010] Fifthly, a computer-readable storage medium is provided that stores computer program code, which, when executed on a computer, causes the computer to perform the methods described in the first aspect or any possible implementation thereof.
[0011] The possible implementations of aspects two through five have similar effects to those of aspect one and its possible implementations, and will not be elaborated upon here. Attached Figure Description
[0012] Figure 1 This is a system architecture diagram of the TBox and host in a traditional vehicle system; Figure 2 This is a system architecture diagram of the vehicle system provided in this application embodiment after the TBox and host are integrated; Figure 3 This is a flowchart illustrating a time synchronization method provided in an embodiment of this application; Figure 4 This is a schematic diagram illustrating the startup process of each virtual system provided in the embodiments of this application; Figure 5 This is a schematic diagram illustrating the time synchronization of the microcontroller unit, host instrument system, host entertainment system, and TBox system provided in the embodiments of this application; Figure 6 This is a schematic diagram illustrating how the TBox system, as provided in this embodiment, determines the first system time after startup. Figure 7 This is a schematic diagram of the TBox system providing time synchronization decision-making according to an embodiment of this application; Figure 8 This is a system architecture diagram of the vehicle system after the TBox and host are integrated in the vehicle system according to the embodiments of this application, which performs time synchronization for the vehicle. Figure 9 This is a schematic diagram of the structure of a timing device provided in an embodiment of this application; Figure 10 This is a schematic diagram of the structure of a vehicle provided in an embodiment of this application. Detailed Implementation
[0013] The technical solutions in this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0014] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0015] To facilitate understanding of the technical solutions in the embodiments of this application, some terms involved in the embodiments of this application will be briefly explained below.
[0016] TBox: It is the core component in the vehicle responsible for remote communication and data processing. For example, when users remotely control the vehicle's air conditioning, windows and other components through mobile applications, they need to transmit relevant control commands through the TBox.
[0017] Head unit: refers to the component in a vehicle used to realize in-vehicle entertainment and instrument display functions, which can also be called the vehicle information system (head unit system, HUT).
[0018] Currently, in traditional vehicle systems, the TBox and the host are two independent hardware components, each with its own system-on-a-chip, microcontroller unit, and CAN transceiver.
[0019] like Figure 1 As shown, the TBox includes its corresponding system-on-a-chip (SoC), microcontroller unit, and CAN transceiver. The SoC and microcontroller unit in the TBox can be connected via a serial peripheral interface (SPI), and the microcontroller unit is connected to the CAN transceiver, enabling the microcontroller unit to transmit and receive CAN messages via the CAN transceiver and CAN bus.
[0020] Correspondingly, the host also includes its corresponding system-on-a-chip, microcontroller unit and CAN transceiver. The system-on-a-chip in the host and the microcontroller unit in the host can also be connected via SPI. The microcontroller unit in the host is connected to the CAN transceiver in the host, so that the microcontroller unit in the host can realize some CAN message sending and receiving functions through the CAN transceiver in the host and the CAN bus.
[0021] And, as Figure 1 As shown, the TBox has an independent clock source mechanism, and the host also has an independent clock source mechanism. For example, regarding the clock source mechanism of the TBox, according to the priority order of time synchronization, the satellite clock time obtained from the satellite clock source has a higher priority than the cloud clock time obtained from the cloud clock source, and the cloud clock time obtained from the cloud clock source has a higher priority than the local clock time obtained from the local clock source. Under this architecture, time synchronization depends on the TBox's own multi-source clock time fusion decision.
[0022] In one example, the satellite clock source can be a global navigation satellite system (GNSS) clock source, and the satellite clock time can be GNSS time; the cloud clock source can be a telematics service provider (TSP) cloud platform clock source, and the cloud clock time can be TSP time; the local clock source can be a real-time clock (RTC) clock source in the microcontroller unit, and the local clock time can be RTC time.
[0023] Therefore, in traditional vehicle systems, the TBox and the host each have independent hardware resources, and the TBox has an independent clock source mechanism, with time synchronization decisions being completely independent and unaffected by other systems. However, because the TBox and the host each have independent system-on-a-chip, microcontroller units, and CAN transceivers, this leads to wasted hardware resources and high hardware costs.
[0024] To reduce the waste of hardware resources and hardware costs, embodiments of this application can combine the TBox and the host into one hardware unit, so that the TBox and the host can share the same microcontroller unit and the same system-on-a-chip. Of course, the TBox and the host can also share the same CAN transceiver.
[0025] It should be noted that in this embodiment, where the TBox and the host share the same system-on-a-chip (SoC) and the same microcontroller unit, the number of SoCs and microcontroller units can be reduced, thereby reducing hardware resource waste and hardware costs. Furthermore, in this embodiment, the TBox and the host can also share the same CAN transceiver, which can further reduce the number of CAN transceivers, thereby reducing hardware resource waste and hardware costs.
[0026] Furthermore, since the TBox and the host can share the same microcontroller unit and the same system-on-a-chip, a virtual machine monitor (i.e., a hypervisor) can be used to build multiple virtual systems on this shared system-on-a-chip. These multiple virtual systems can be Linux systems.
[0027] For example, such as Figure 2As shown, a virtual machine monitor is used to build three virtual systems on a shared system-on-a-chip. One virtual system is the host instrumentation system (i.e., the server OS system, which is the service operating system in the virtualization environment), and the other two virtual systems are guest OS systems (i.e., guest operating systems in the virtualization environment). The two guest OS systems are the host entertainment system (i.e., the guest OS Android system) and the TBox system (i.e., the guest OS Linux system).
[0028] In other words, embodiments of this application can construct multiple virtual systems within a single system-on-a-chip (SoC). These virtual systems may include a host instrument system, a host entertainment system, and a TBox system, all sharing the same microcontroller unit. Since the host instrument system, host entertainment system, and TBox system are constructed within a single SoC, they also share the same SoC. Of course, in some embodiments, the host instrument system, host entertainment system, and TBox system may also share the same CAN transceiver.
[0029] It should be understood that a virtual machine monitor (VM monitor) is a software layer installed on physical hardware. It can virtualize the physical hardware into multiple virtual systems, meaning that a VM monitor can virtualize hardware resources, allowing multiple virtual systems to run simultaneously on a single physical hardware device. There are two types of VM monitors: Type-1 and Type-2.
[0030] Type-1 virtual machine monitors, also known as bare-metal virtual machine monitors or native virtual machine monitors, do not require a pre-loaded underlying operating system. They directly access the underlying hardware without the need for other software (such as operating systems and device drivers), and can be installed directly on the hardware, splitting the hardware into multiple virtual machines, on which virtual systems are installed. Type-2 virtual machine monitors are typically installed on top of an existing operating system; these are called managed virtual machine hypervisors. For Type-2 virtual machine monitors, the presence of the underlying operating system inevitably introduces latency.
[0031] Therefore, in this embodiment of the application, the virtual machine monitor can be a Type-1 virtual machine monitor.
[0032] It should be understood that the host instrument system and host entertainment system are virtual systems used to implement the relevant functions of the host, and the TBox system is a virtual system used to implement the relevant functions of the TBox.
[0033] like Figure 2As shown, the shared microcontroller unit and the host instrumentation system can communicate via SPI, the host instrumentation system and the host entertainment system can communicate via virtual socket (VSOCK), and the host entertainment system and the TBox system can communicate via FDBus (an inter-process communication framework designed for high-performance distributed systems).
[0034] Therefore, while building virtual systems such as the host instrumentation system, host entertainment system, and TBox system within a single system-on-a-chip (SoC), with all three systems sharing the same microcontroller unit, can reduce hardware resource waste and costs, it also introduces a significant challenge: the TBox system's clock source mechanism is no longer independent. In this scenario, achieving high-precision time synchronization for the TBox system becomes a critical technical problem that needs to be addressed.
[0035] To address the aforementioned issues, this application provides a time synchronization method. After the TBox system starts up, the TBox system determines a first system time. This first system time includes either a pending system time determined by the TBox system based on a verification result, or a target system time obtained by the TBox system from the host entertainment system. The target system time is related to the local clock time obtained from the local clock source in the microcontroller unit. The TBox system uses a first priority rule to determine a second system time from the first clock time obtained from the first external clock source and the first system time. The second system time is then used to synchronize the TBox system's time. Therefore, this application can construct multiple virtual systems within a single system-on-a-chip (SoC). These virtual systems include at least the host entertainment system and the TBox system, and even when multiple virtual systems share the same microcontroller unit, the first priority rule is still used to synchronize the TBox system's time. Even if the TBox system relies on the target system time obtained from the host entertainment system, which is related to the local clock time, it can still achieve high-precision time synchronization using the first clock time obtained from the high-priority first external clock source, thereby reducing the TBox system's dependence on the target system time obtained from the host entertainment system.
[0036] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments.
[0037] Figure 3 This is a flowchart illustrating a time synchronization method provided in an embodiment of this application. This time synchronization method can be applied to a vehicle, which includes multiple virtual systems built on a system-on-a-chip (SoC). These virtual systems include at least a host entertainment system and a TBox system, and all virtual systems share the same microcontroller unit. Figure 3As shown, this time synchronization method may specifically include the following steps: S301, after the TBox system has started up, the TBox system determines the first system time. The first system time includes the pending system time determined by the TBox system based on the verification result, or the target system time obtained by the TBox system from the host entertainment system. The target system time is related to the local clock time obtained from the local clock source in the microcontroller unit.
[0038] The TBox system is one of multiple virtual systems built within a system-on-a-chip (SoC), and it is the virtual system used to implement the functions related to the TBox. The host entertainment system is another virtual system built within this SoC, and it is the virtual system used to implement the functions related to the host.
[0039] After the TBox system boots up, it first performs a verification operation, such as verifying the system time based on a third-party system time or the factory default time, to obtain the verification result. Based on this result, a pending system time is determined. Then, the TBox system, depending on the actual situation, determines either the pending system time or the target system time obtained from the host entertainment system as the primary system time. Therefore, in some cases, the pending system time is the primary system time; in other cases, the target system time is the primary system time.
[0040] The third system time refers to the current system time of the TBox system. Furthermore, performing a verification operation based on the third system time and the factory default time essentially involves determining the relationship between the third system time and the factory default time, and then, based on this relationship, determining the pending system time from between the third system time and the factory default time.
[0041] When multiple virtual systems share the same microcontroller unit, the local clock time can be obtained from the local clock source in this microcontroller unit. In some cases, the target system time determined by the host entertainment system is related to this local clock time.
[0042] S302, the TBox system uses the first priority rule to determine the second system time from the first clock time and the first system time obtained from the first external clock source.
[0043] The first priority rule is used to represent the timing priority rule of the TBox system. In one example, the first clock time obtained from the first external clock source has a higher priority than the first system time.
[0044] When the TBox system obtains clock time from an external clock source, the corresponding external clock source is referred to as the first external clock source. The first external clock source includes satellite clock sources and cloud clock sources. The first clock time obtained by the TBox system from the satellite clock source is the first satellite clock time, and the first clock time obtained by the TBox system from the cloud clock source is the cloud clock time. Specifically, the first satellite clock time has a higher priority than the cloud clock time, and the cloud clock time has a higher priority than the first system time.
[0045] Therefore, in this embodiment, the TBox system can first determine whether the first satellite clock time obtained from the satellite clock source can be used as the second system time. If the first satellite clock time obtained from the satellite clock source can be used as the second system time, the TBox system directly determines the first satellite clock time as the second system time. If the first satellite clock time obtained from the satellite clock source cannot be used as the second system time, the TBox system then determines whether the cloud clock time obtained from the cloud clock source can be used as the second system time.
[0046] If the cloud clock time obtained from the cloud clock source can be used as the second system time, the TBox system will determine the cloud clock time as the second system time; if the cloud clock time obtained from the cloud clock source cannot be used as the second system time, the TBox system will determine the first system time as the second system time.
[0047] In one example, the satellite clock source can be a GNSS clock source, so the first satellite clock time can be the first GNSS time; the cloud clock source can be a TSP cloud platform clock source, and the cloud clock time can be the TSP time.
[0048] S303 uses a second system time to synchronize the TBox system.
[0049] It should be understood that time synchronization for the TBox system refers to the precise synchronization of the TBox system's system time to ensure the accuracy of various time-related functions during the operation of the TBox system.
[0050] Therefore, the embodiments of this application can construct multiple virtual systems in a single system-on-a-chip. These multiple virtual systems include at least a host entertainment system and a TBox system. Even when multiple virtual systems share the same microcontroller unit, the first priority rule is still used to synchronize the time of the TBox system. Even if the TBox system relies on the target system time related to the local clock time obtained from the host entertainment system, it can still synchronize the time with high precision through the first clock time obtained from the high-priority first external clock source, thereby reducing the dependence of the TBox system on the target system time obtained from the host entertainment system.
[0051] The following sections provide detailed explanations of the startup process of each virtual system, the time synchronization process between the shared microcontroller unit and each virtual system, the process by which the TBox system determines the time of the first system, and the process by which the TBox system makes time synchronization decisions.
[0052] For example, Figure 4 This is a schematic diagram illustrating the startup process of various virtual systems provided in the embodiments of this application. The modules involved in the process include a virtual machine monitor, a host instrumentation system, a host entertainment system, a TBox system, and a microcontroller unit. That is, multiple virtual systems, including a host instrumentation system, a host entertainment system, and a TBox system, are built in a single system-on-a-chip. The process may specifically include the following steps S401 to S411: S401, the virtual machine monitor sends the first startup command to the host instrumentation system.
[0053] Among them, the host instrument system and the host entertainment system are virtual systems used to realize the relevant functions of the host, and the first startup command is used to trigger the startup operation of the host instrument system.
[0054] S402, the main instrument system performs a startup operation based on the first startup command.
[0055] S403 After the host instrumentation system has finished booting, the host instrumentation system sends a first boot request and a second boot request to the virtual machine monitor.
[0056] It should be understood that the first and second startup requests sent by the host instrumentation system to the virtual machine monitor can be sent simultaneously or at different times. Taking the host instrumentation system sending the first and second startup requests to the virtual machine monitor at different times as an example, the host instrumentation system can send the first startup request to the virtual machine monitor first and then send the second startup request, or the host instrumentation system can send the second startup request to the virtual machine monitor first and then send the first startup request.
[0057] S404, the virtual machine monitor sends a second startup command to the host entertainment system based on the first startup request.
[0058] The second startup command is used to trigger the startup operation of the host entertainment system.
[0059] S405, the virtual machine monitor sends a third boot command to the TBox system based on the second boot request.
[0060] The third startup command is used to trigger the startup operation of the TBox system.
[0061] S406, the host entertainment system performs a startup operation based on the second startup command.
[0062] The S407 TBox system performs the boot operation based on the third boot instruction.
[0063] S408 After the host entertainment system has finished booting, the host entertainment system sends a first notification message to the virtual machine monitor. The first notification message is used to indicate that the host entertainment system has finished booting.
[0064] S409. After the TBox system has finished booting, the TBox system sends a second notification message to the virtual machine monitor. The second notification message is used to indicate that the TBox system has finished booting.
[0065] S410, after the virtual machine monitor receives the first notification message and the second notification message, the virtual machine monitor sends a third notification message to the host instrumentation system. The third notification message is used to indicate that the host instrumentation system, the host entertainment system and the TBox system have all completed startup.
[0066] S411: After the host instrument system receives the third notification message, a handshake connection is established between the host instrument system and the microcontroller unit.
[0067] In this way, after the handshake connection between the host instrument system and the microcontroller unit is successfully established, the microcontroller unit can be triggered to send the local clock time obtained from the local clock source to the host instrument system, which triggers the execution of step S501 below.
[0068] In one possible implementation, the multiple virtual systems also include a host instrumentation system, and the time synchronization method may further include the following steps: after the host instrumentation system, the host entertainment system, and the TBox system have started up, the local clock time obtained by the microcontroller unit from the local clock source is sent to the host entertainment system through the host instrumentation system; the host entertainment system uses a second priority rule to determine the target system time from the second clock time obtained from the second external clock source and the local clock time.
[0069] The second priority rule is used to represent the timing priority rule of the host entertainment system. In one example, the priority of the second clock time obtained from the second external clock source is higher than the priority of the local clock time.
[0070] When the console entertainment system obtains clock time from an external clock source, this external clock source is referred to as the second external clock source. The second external clock source includes a network clock source and a satellite clock source. The second clock time obtained by the console entertainment system from the network clock source is the network clock time, and the second clock time obtained from the satellite clock source is the second satellite clock time. Specifically, the network clock time has a higher priority than the second satellite clock time, and the second satellite clock time has a higher priority than the local clock time.
[0071] Therefore, the aforementioned "the host entertainment system uses a second priority rule to determine the target system time from the second clock time obtained from the second external clock source and the local clock time" can specifically include the following steps: the host entertainment system obtains the network clock time from the network clock source; if the network clock time is valid, it determines the network clock time as the target system time; if the network clock time is invalid, the host entertainment system obtains the second satellite clock time from the satellite clock source; if the second satellite clock time is valid, it determines the second satellite clock time as the target system time; if the second satellite clock time is invalid, it determines the local clock time as the target system time.
[0072] In this embodiment, the host entertainment system can first determine whether the network clock time obtained from the network clock source can be used as the target system time (i.e., determine whether the network clock time is valid). If the network clock time obtained from the network clock source can be used as the target system time (i.e., the network clock time is valid), the host entertainment system directly uses the network clock time as the target system time. If the network clock time obtained from the network clock source cannot be used as the target system time (i.e., the network clock time is invalid), the host entertainment system then determines whether the second satellite clock time obtained from the satellite clock source can be used as the target system time (i.e., determine whether the second satellite clock time is valid).
[0073] If the second satellite clock time obtained from the satellite clock source can be used as the target system time (i.e., if the second satellite clock time is valid), the host entertainment system will determine the second satellite clock time as the target system time; if the second satellite clock time obtained from the satellite clock source cannot be used as the target system time (i.e., if the second satellite clock time is invalid), the host entertainment system will determine the local clock time as the target system time.
[0074] In one example, the network clock source can be a Network Time Protocol (NTP) server clock source, then the network clock time can be NTP time; the satellite clock source can be a GNSS clock source, then the second satellite clock time can be the second GNSS time; the local clock source can be an RTC clock source in the microcontroller unit, then the local clock time can be RTC time.
[0075] In this way, the host entertainment system adopts the second priority rule, which can improve the accuracy of the determined target system time.
[0076] For example, Figure 5 This is a schematic diagram illustrating the time synchronization of a microcontroller unit, a host instrument system, a host entertainment system, and a TBox system provided in this application embodiment. The modules involved in the process include the microcontroller unit, the host instrument system, the host entertainment system, and the TBox system. Specifically, the process may include the following steps S501 to S513: S501, the microcontroller unit sends the local clock time obtained from the local clock source to the host instrument system.
[0077] S502, the host instrument system sends the local clock time to the host entertainment system.
[0078] S503, the host entertainment system stores the local clock time.
[0079] S504, the host entertainment system obtains network clock time from the network clock source.
[0080] S505, the host entertainment system determines whether the network clock time is valid.
[0081] In one implementation, the host entertainment system can acquire a first time series, which includes multiple historical network times obtained by the host entertainment system from a network clock source within a first preset duration prior to the current moment. The host entertainment system subtracts the first preset duration from the difference between the network clock time acquired at the current moment and the earliest historical network time in the first time series to obtain a first time difference. Furthermore, the host entertainment system can determine whether a time jump occurs between any two adjacent historical network times in the first time series. If the absolute value of the first time difference is less than or equal to a first threshold, and no time jump occurs between any two adjacent historical network times, the network clock time is determined to be valid; if the absolute value of the first time difference is greater than the first threshold, and / or a time jump occurs between any two adjacent historical network times, the target network time is determined to be invalid.
[0082] Since the first time series includes multiple historical network times continuously acquired from the network clock source within a first preset duration, under normal circumstances, the network clock time acquired at the current moment should be spaced apart from the earliest historical network time in the first time series by the first preset duration. That is, the difference between the network clock time acquired at the current moment and the earliest historical network time in the first time series, after subtracting the first preset duration, is usually 0.
[0083] It should be noted that the first threshold can be set according to the actual situation. For example, the first threshold can be 0 seconds, or the first threshold can be 100 milliseconds, or the first threshold can be 1 second, etc. This application embodiment does not limit this.
[0084] Furthermore, if, in two adjacent historical network times, the historical network time acquired later is later than the historical network time acquired earlier, it is determined that no jump has occurred between the two adjacent historical network times; if, in two adjacent historical network times, the historical network time acquired later is earlier than the historical network time acquired earlier, it is determined that a jump has occurred between the two adjacent historical network times.
[0085] If the host entertainment system determines that the network clock time is valid, proceed with step S506 below; if the host entertainment system determines that the network clock time is invalid, proceed with step S507 below.
[0086] S506, when the network clock time is valid, the host entertainment system will set the network clock time as the target system time.
[0087] S507: In the event that the network clock time is invalid, the host entertainment system obtains a second satellite clock time from the satellite clock source.
[0088] S508, the main entertainment system determines whether the second satellite clock time is valid.
[0089] In one implementation, the host entertainment system can acquire a second time series, which includes multiple first historical satellite times obtained by the host entertainment system from a satellite clock source within a second preset duration prior to the current moment. The host entertainment system subtracts the second preset duration from the difference between the second satellite clock time acquired at the current moment and the earliest first historical satellite time in the second time series to obtain a second time difference. Furthermore, the host entertainment system can determine whether a time jump occurs between any two adjacent first historical satellite times in the second time series. If the absolute value of the second time difference is less than or equal to a second threshold, and no time jump occurs between any two adjacent first historical satellite times, the second satellite clock time is determined to be valid; if the absolute value of the second time difference is greater than the second threshold, and / or a time jump occurs between any two adjacent first historical satellite times, the second satellite clock time is determined to be invalid.
[0090] Since the second time series includes multiple first historical satellite times continuously acquired from the satellite clock source within a second preset duration, under normal circumstances, the second satellite clock time acquired at the current moment should be spaced apart from the earliest first historical satellite time in the second time series by the second preset duration. That is, the second time difference between the second satellite clock time acquired at the current moment and the earliest first historical satellite time in the second time series, after subtracting the second preset duration, is usually 0.
[0091] It should be noted that the second threshold can be set according to actual conditions. For example, the second threshold can be 0 seconds, or the second threshold can be 100 milliseconds, or the second threshold can be 1 second, etc. This application embodiment does not limit this. In addition, the second preset duration can be equal to or unequal to the first preset duration; the second threshold can be equal to or unequal to the first threshold.
[0092] Furthermore, if, among two adjacent first historical satellite times, the later first historical satellite time is later than the earlier first historical satellite time, it is determined that no jump has occurred between the two adjacent first historical satellite times; if, among two adjacent first historical satellite times, the later first historical satellite time is earlier than the earlier first historical satellite time, it is determined that a jump has occurred between the two adjacent first historical satellite times.
[0093] If the host entertainment system determines that the second satellite clock time is valid, proceed with step S509 below; if the host entertainment system determines that the second satellite clock time is invalid, proceed with step S510 below.
[0094] S509, if the second satellite clock time is valid, the host entertainment system will determine the second satellite clock time as the target system time.
[0095] S510: In the event that the second satellite clock time is invalid, the host entertainment system will determine the local clock time as the target system time.
[0096] S511, the host entertainment system sends the target system time to the TBox system.
[0097] S512, the host entertainment system returns the target system time to the host instrument system.
[0098] S513, the host instrumentation system returns the target system time to the microcontroller unit.
[0099] In this way, after the microcontroller unit receives the target system time returned by the host instrument system, if the target system time is inconsistent with the local clock time, the local clock time corresponding to the microcontroller unit can be updated, thereby improving the accuracy of the local clock time corresponding to the microcontroller unit.
[0100] In summary, based on the above Figure 5 The implementation shown allows the microcontroller unit to send the local clock time obtained from the local clock source to the host instrument system after the system is powered on and the host entertainment system and TBox system have started up. The host instrument system then sends the local clock time to the host entertainment system. The host entertainment system can then use the second priority rule to determine the target system time from the second clock time obtained from the second external clock source and the local clock time, and actively send the target system time to the TBox system. This achieves local clock time synchronization among the microcontroller unit, the host instrument system and the host entertainment system, as well as cross-system time synchronization between the host entertainment system and the TBox system.
[0101] In one possible implementation, the aforementioned "pending system time determined by the TBox system based on the verification result" may specifically include the following steps: After the TBox system starts up, the TBox system obtains the third system time and the factory default time; the third system time is verified based on the factory default time to obtain the verification result; if the verification result shows that the third system time is less than or equal to the factory default time, the factory default time is determined as the pending system time; if the verification result shows that the third system time is greater than the factory default time, the third system time is determined as the pending system time.
[0102] In one possible implementation, the above-mentioned S301 "TBox system determines the first system time" may specifically include the following steps: the TBox system determines whether the time synchronization flag is valid; if the time synchronization flag is valid, the pending system time is determined as the first system time; if the time synchronization flag is invalid, the target system time is determined as the first system time.
[0103] For example, Figure 6 This is a schematic diagram illustrating how the TBox system, as provided in this application embodiment, determines the first system time after startup. The modules involved in this process may include the host entertainment system and the TBox system, and the process may specifically include the following steps S601 to S609: S601: After the TBox system has finished booting, the TBox system obtains the third system time and the factory default time.
[0104] When the TBox system is first powered on, it has a default system time, which is the factory default time, such as January 1, 2020, 00:00:00. If the TBox system has been synchronized with its time after startup, the third system time will be the current system time of the TBox system. That is, after each time the TBox system is synchronized with its time, it can automatically count the time based on the synchronized time to obtain the current system time (i.e., the third system time), such as December 20, 2025, 15:20:00.
[0105] S602, the TBox system determines whether the time of the third system is less than or equal to the factory default time.
[0106] If the time of the third system is less than or equal to the factory default time, execute step S603 below; if the time of the third system is greater than the factory default time, execute step S604 below.
[0107] S603: If the third system time is less than or equal to the factory default time, the TBox system will set the factory default time as the pending system time.
[0108] Typically, when the TBox system is powered off and then powered on again, the third-party system time it obtains may be equal to the factory default time.
[0109] S604: If the third system time is greater than the factory default time, the TBox system will determine the third system time as the pending system time.
[0110] The S605 TBox system determines whether the time synchronization flag is valid.
[0111] After the TBox system determines the pending system time, if the time synchronization flag has been set and the time synchronization status of the set time synchronization flag is "time synchronized", the time synchronization flag is determined to be valid, and the following step S606 is executed; if the time synchronization flag has not been set or the time synchronization status of the set time synchronization flag is "time synchronized", the time synchronization flag is determined to be invalid, and the following step S607 is executed.
[0112] S606, when the time synchronization flag is valid, the TBox system will determine the pending system time as the first system time.
[0113] S607, in the case of an invalid timing flag, the TBox system sends a request message to the host entertainment system.
[0114] The request message is used to request the target system time, which can be the target system time determined by the execution process corresponding to S501 to S510.
[0115] S608, the host entertainment system returns the target system time to the TBox system based on the request message.
[0116] The S609 TBox system sets the target system time as the first system time.
[0117] Therefore, embodiments of this application can introduce a time synchronization flag to record historical time synchronization status, so as to guide the TBox system to make a time decision on the first system time after startup, thereby avoiding repeated and invalid time synchronization operations.
[0118] It should be noted that, Figure 6 The execution process shown is the same as... Figure 5 The execution process shown does not have a fixed order. It can be executed after the TBox system has finished booting up. Figure 6 The execution process is shown below; furthermore, execution can proceed only after the host instrument system, host entertainment system, and TBox system have all started up, and after a successful handshake connection between the host instrument system and the microcontroller unit. Figure 5 The execution process is shown.
[0119] If the TBox system determines that the time synchronization flag is invalid, the TBox system needs to determine the target system time obtained from the host entertainment system as the first system time. Thus, in practical applications, the target system time obtained by the TBox system from the host entertainment system may be actively sent by the host entertainment system to the TBox system (i.e., step S511 above), or it may be obtained by the TBox system from the host entertainment system based on a request message sent to the host entertainment system (i.e., steps S607 and S608 above).
[0120] Therefore, in some embodiments, the time synchronization method may further include the following steps: the TBox system sends a request message to the host entertainment system to obtain the target system time from the host entertainment system based on the request message; and / or, the TBox system receives the target system time actively sent by the host entertainment system.
[0121] Thus, if the TBox system determines that the time synchronization flag is invalid, but receives the target system time actively sent by the host entertainment system, the TBox system can directly determine the target system time actively sent by the host entertainment system as the first system time. However, if the TBox system determines that the time synchronization flag is invalid, but does not receive the target system time actively sent by the host entertainment system, the TBox system can send a request message to the host entertainment system to obtain the target system time based on the request message.
[0122] Furthermore, if the TBox system obtains the target system time from the host entertainment system based on the request message, the TBox system can determine the obtained target system time as the first system time. If the TBox system does not obtain the target system time from the host entertainment system based on the request message, the TBox system can wait for the host entertainment system to actively send the target system time.
[0123] In one possible implementation, the first external clock source includes a satellite clock source and a cloud clock source. The aforementioned S302, "The TBox system uses a first priority rule to determine the second system time from the first clock time and the first system time obtained from the first external clock source," can specifically include the following steps: The TBox system obtains the first satellite clock time from the satellite clock source; if the first satellite clock time is valid, it determines the first satellite clock time as the second system time; if the first satellite clock time is invalid, the TBox system detects the status of the cloud clock source; if the cloud clock source is logged in and the cloud clock time obtained from it is valid, it determines the cloud clock time as the second system time; if the cloud clock source is not logged in, or if the cloud clock source is logged in but the cloud clock time obtained from it is invalid, it determines the first system time as the second system time.
[0124] In this embodiment, the TBox system can first determine whether the first satellite clock time obtained from the satellite clock source can be used as the second system time (i.e., determine whether the first satellite clock time is valid). If the first satellite clock time obtained from the satellite clock source can be used as the second system time (i.e., the first satellite clock time is valid), the TBox system directly determines the first satellite clock time as the second system time. If the first satellite clock time obtained from the satellite clock source cannot be used as the second system time (i.e., the first satellite clock time is invalid), the TBox system then checks the status of the cloud clock source.
[0125] If the cloud clock source is logged in and the cloud clock time obtained from the cloud clock source can be used as the second system time (i.e., the cloud clock time is valid), the TBox system will determine the cloud clock time as the second system time. If the cloud clock source is not logged in, or if the cloud clock source is logged in but the cloud clock time obtained from the cloud clock source cannot be used as the second system time (i.e., the cloud clock time is invalid), the TBox system will determine the first system time as the second system time.
[0126] Therefore, within the TBox system, the dynamic time synchronization priority remains unchanged: the priority of the first satellite clock time is higher than that of the cloud clock time, and the priority of the cloud clock time is higher than that of the first system time. As a Guest OS system, the TBox system shares its hardware resources (such as the microcontroller unit). The TBox system loses direct access to the local clock source (i.e., the RTC clock source) within the microcontroller unit. In scenarios where the host entertainment system determines the local clock time as the target system time, the TBox system can obtain the local clock time corresponding to its local clock source from the host entertainment system through intra-domain communication. In this way, even if the TBox system relies on the target system time obtained from the host entertainment system, it can still achieve high-precision time synchronization through the high-priority first satellite clock time or the cloud clock time, thereby improving time synchronization accuracy and ensuring that the TBox system always uses the optimal available time source.
[0127] Furthermore, by adopting the above approach, the TBox system can maintain functional independence while sharing hardware resources, reduce unnecessary cross-system time requests, and lower system load.
[0128] Furthermore, when multiple virtual systems are built within a single system-on-a-chip (SoC), including a host instrumentation system, a host entertainment system, and a TBox system, and these virtual systems share the same microcontroller unit, the timing decisions of the TBox system depend on the host entertainment system. This introduces a new chain of uncertainties, as the time accuracy and stability of the host entertainment system directly affect the TBox system. Moreover, due to the timing differences in the startup of the host instrumentation system, host entertainment system, and TBox system, a time initialization race condition arises during the parallel startup of multiple systems. This race condition refers to the fact that in a highly integrated and interdependent system, due to the uncertainty of the startup speed and readiness time of each subsystem, the TBox system may request time data from the host entertainment system before it completes its own time initialization. In other words, before the host entertainment system has determined the target system time, the TBox system may send a request message to obtain the target system time, resulting in the TBox system receiving an intermediate or invalid time value.
[0129] To address the aforementioned issue, the TBox system in this embodiment only needs to determine the target system time obtained from the host entertainment system as the second system time when both the first satellite clock time and the cloud clock time are invalid. Only then does it rely on the startup of the host entertainment system. If the host entertainment system has not yet finished starting, the TBox system sends a request message to the host entertainment system. Even if obtaining the target system time based on the request message fails, it's not a problem. After the host entertainment system finishes starting, it can actively send the target system time to the TBox system after determining it from the network clock time, the second satellite clock time, and the local clock time. This resolves the problem of time initialization race conditions when multiple systems start in parallel.
[0130] For example, Figure 7 This is a schematic diagram of the TBox system providing time synchronization decision-making according to an embodiment of this application. The modules involved in the process include the TBox system, and the process may specifically include the following steps S701 to S710: S701, the TBox system initiates the satellite positioning process.
[0131] S702, TBox system attempts to log in to cloud clock source.
[0132] The S703 TBox system obtains the first satellite clock time from the satellite clock source.
[0133] The S704 TBox system determines whether the first satellite clock time is valid.
[0134] In one implementation, the TBox system can acquire a third time series, which includes multiple second historical satellite times obtained by the TBox system from a satellite clock source within a third preset duration prior to the current time. The TBox system subtracts the third preset duration from the difference between the first satellite clock time acquired at the current time and the earliest second historical satellite time in the third time series to obtain a third time difference. Furthermore, the TBox system can determine whether a time jump occurs between any two adjacent second historical satellite times in the third time series. If the absolute value of the third time difference is less than or equal to a third threshold, and no time jump occurs between any two adjacent second historical satellite times, the first satellite clock time is determined to be valid; if the absolute value of the third time difference is greater than the third threshold, and / or a time jump occurs between any two adjacent second historical satellite times, the first satellite clock time is determined to be invalid.
[0135] Since the third time series includes multiple second historical satellite times continuously acquired from the satellite clock source within a third preset duration, under normal circumstances, the first satellite clock time acquired at the current moment should be spaced apart from the earliest second historical satellite time in the third time series by the third preset duration. That is, the difference between the first satellite clock time acquired at the current moment and the earliest second historical satellite time in the third time series, after subtracting the third preset duration, is usually 0.
[0136] It should be noted that the third threshold can be set according to the actual situation. For example, the third threshold can be 0 seconds, or the third threshold can be 100 milliseconds, or the third threshold can be 1 second, etc. This application embodiment does not limit this.
[0137] Furthermore, if, among two adjacent second historical satellite times, the second historical satellite time acquired later is later than the second historical satellite time acquired earlier, then it is determined that no jump has occurred between the two adjacent second historical satellite times; if, among two adjacent second historical satellite times, the second historical satellite time acquired later is earlier than the second historical satellite time acquired earlier, then it is determined that a jump has occurred between the two adjacent second historical satellite times.
[0138] In this way, the embodiments of this application construct multiple virtual systems in a system-on-a-chip. The multiple virtual systems include a host instrument system, a host entertainment system, and a TBox system. When multiple virtual systems share the same microcontroller unit, that is, under the system convergence architecture, the TBox system can maintain the original time validity verification logic of the single TBox (that is, the TBox and the host are two independent hardware). This allows the time validity verification logic to be smoothly transitioned to the TBox system under the system convergence architecture without major business logic modifications.
[0139] If the TBox system determines that the first satellite clock time is valid, proceed with step S705 below; if the TBox system determines that the first satellite clock time is invalid, proceed with step S706 below.
[0140] S705, if the first satellite clock time is valid, the TBox system will determine the first satellite clock time as the second system time.
[0141] S706: In the event that the first satellite clock time is invalid, the TBox system detects the status of the cloud clock source.
[0142] The detection of the cloud clock source status actually involves: detecting whether the cloud clock source is logged in, and if the cloud clock source is logged in, detecting whether the cloud clock time obtained from the cloud clock source is valid.
[0143] If the time interval between the current time and the last time the TBox system synchronized its time is greater than the fourth threshold, then the cloud clock time obtained at the current time is determined to be valid; if the time interval between the current time and the last time the TBox system synchronized its time is less than or equal to the fourth threshold, then the cloud clock time obtained at the current time is determined to be invalid.
[0144] It should be noted that the fourth threshold can be set according to actual circumstances, and this application embodiment does not limit it. The fourth threshold can be a positive number.
[0145] S707: When the cloud clock source is logged in and the cloud clock time obtained from the cloud clock source is valid, the TBox system will determine the cloud clock time as the second system time.
[0146] S708: If the cloud clock source is not logged in, or if the cloud clock source is logged in but the cloud clock time obtained from the cloud clock source is invalid, the TBox system will determine the first system time as the second system time.
[0147] The S709 TBox system uses a second system time to synchronize the TBox system's time.
[0148] In the S710, the TBox system updates the timing status of the timing flag to "timing enabled".
[0149] After each time the TBox system is synchronized with the time, the TBox system can update the synchronization status of the synchronization flag to "synchronized".
[0150] It should be understood that the TBox system will repeatedly execute the steps S703 to S710 described above in order to continuously monitor the timing.
[0151] In summary, combining Figures 4 to 7 This paper details the startup process of each virtual system, the time synchronization process between the shared microcontroller unit and each virtual system, the process of the TBox system determining the time of the first system, and the time synchronization decision process of the TBox system. The following section will elaborate on these processes. Figure 8 In the system architecture after the Tbox and host are integrated in the vehicle system, the interaction process between various virtual systems is explained.
[0152] For example, Figure 8 This is a system architecture diagram of the vehicle system after the TBox and host are integrated in the vehicle system, according to an embodiment of this application, to provide time synchronization for the vehicle. Figure 8 As shown, the system architecture includes virtual systems such as the host instrument system, host entertainment system, and TBox system built on a system-on-a-chip, and the host instrument system, host entertainment system, and TBox system share the same microcontroller unit.
[0153] The microcontroller unit can obtain the local clock time from the local clock source and send the local clock time to the host instrument system, which then sends the local clock time to the host entertainment system.
[0154] The host entertainment system can employ a second priority rule to determine the target system time from the network clock time obtained from the network clock source, the second satellite clock time obtained from the satellite clock source, and the local clock time. The network clock time has a higher priority than the second satellite clock time, which in turn has a higher priority than the local clock time.
[0155] After the host entertainment system determines the target system time, it can send the target system time to the TBox system. The TBox system can determine the pending system time or the target system time as the first system time by checking whether the time synchronization flag is valid. Then, the TBox system can use a first priority rule to determine a second system time from the first satellite clock time obtained from the satellite clock source, the cloud clock time obtained from the cloud clock source, and the first system time, and use the second system time to synchronize the time with the TBox system.
[0156] Furthermore, after the host entertainment system determines the target system time, it can also return the target system time to the host instrumentation system, which in turn returns the target system time to the microcontroller unit.
[0157] In summary, the embodiments of this application can construct a time transfer architecture of microcontroller unit - host instrumentation system - host entertainment system - TBox system. Within the TBox system, a first-priority rule is used for time synchronization based on multi-source clocks. Under the domain fusion architecture, the dependence of the TBox system on the host entertainment system is reduced, and the problem of time initialization race conditions during parallel startup of multiple systems is resolved. This achieves a balance between autonomous time decision-making and overall coordination among the various virtual systems. In multiple virtual systems, the failure of a single virtual system will not significantly affect the overall time synchronization, ensuring a valid time reference can be obtained under any startup sequence.
[0158] Furthermore, when the console entertainment system and the TBox system make time decisions, the validity of the clock times obtained from each clock source is verified to improve the high reliability of the final determined second system time.
[0159] The above combination Figures 2 to 8 The timing method provided in the embodiments of this application has been described. The apparatus for performing the above method provided in the embodiments of this application is described below.
[0160] Figure 9 This is a schematic diagram of a timing device provided in an embodiment of this application. The timing device can be applied to a vehicle, which includes multiple virtual systems built on a system-on-a-chip. These virtual systems include at least a host entertainment system and a TBox system, and all virtual systems share the same microcontroller unit. Figure 9 As shown, the timing device 900 may include: a first determining module 901, a second determining module 902, and a timing module 903.
[0161] The first determining module 901 is used to determine a first system time after the TBox system has started up. The first system time includes a pending system time determined by the TBox system based on a verification result, or a target system time obtained by the TBox system from the host entertainment system. The target system time is related to the local clock time obtained from the local clock source in the microcontroller unit. The second determining module 902 is used by the TBox system to determine a second system time from the first clock time and the first system time obtained from the first external clock source using a first priority rule. The time synchronization module 903 is used to synchronize the time of the TBox system using the second system time.
[0162] In one possible implementation, the first determining module 901 is specifically used for: the TBox system to determine whether the time synchronization flag is valid; if the time synchronization flag is valid, the pending system time is determined as the first system time; if the time synchronization flag is invalid, the target system time is determined as the first system time.
[0163] In one possible implementation, the time synchronization device 900 may further include a verification module, which is used to: after the TBox system has started up, the TBox system obtains the third system time and the factory default time; verify the third system time based on the factory default time to obtain a verification result; if the verification result is that the third system time is less than or equal to the factory default time, determine the factory default time as the pending system time; if the verification result is that the third system time is greater than the factory default time, determine the third system time as the pending system time.
[0164] In one possible implementation, the first external clock source includes a satellite clock source and a cloud clock source. The second determining module 902 is specifically used by the TBox system to obtain the first satellite clock time from the satellite clock source; if the first satellite clock time is valid, determine the first satellite clock time as the second system time; if the first satellite clock time is invalid, the TBox system detects the status of the cloud clock source; if the cloud clock source is logged in and the cloud clock time obtained from the cloud clock source is valid, determine the cloud clock time as the second system time; if the cloud clock source is not logged in, or if the cloud clock source is logged in but the cloud clock time obtained from the cloud clock source is invalid, determine the first system time as the second system time.
[0165] In one possible implementation, the multiple virtual systems also include a host instrumentation system, and the timing device 900 may further include a third determining module, which is used to: after the host instrumentation system, the host entertainment system, and the TBox system have started up, send the local clock time obtained by the microcontroller unit from the local clock source to the host entertainment system through the host instrumentation system; the host entertainment system uses a second priority rule to determine the target system time from the second clock time obtained from the second external clock source and the local clock time.
[0166] In one possible implementation, the second external clock source includes a network clock source and a satellite clock source. The third determining module is specifically used for: the host entertainment system obtaining the network clock time from the network clock source; if the network clock time is valid, determining the network clock time as the target system time; if the network clock time is invalid, the host entertainment system obtaining the second satellite clock time from the satellite clock source; if the second satellite clock time is valid, determining the second satellite clock time as the target system time; and if the second satellite clock time is invalid, determining the local clock time as the target system time.
[0167] In one possible implementation, the timing device 900 may further include a time return module, which is used for: the host entertainment system to return the target system time to the host instrument system; and the host instrument system to return the target system time to the microcontroller unit.
[0168] In one possible implementation, the timing device 900 may further include a time acquisition module, which is used for: the TBox system sending a request message to the host entertainment system to obtain the target system time from the host entertainment system based on the request message; and / or, the TBox system receiving the target system time actively sent by the host entertainment system.
[0169] In one possible implementation, the timing device 900 may further include an update module for: the TBox system updating the timing status of the timing flag to "timing enabled".
[0170] Figure 10 This is a schematic diagram of the structure of a vehicle provided in an embodiment of this application. For example, as shown... Figure 10 As shown, the vehicle 1000 includes a controller, which includes a system-on-a-chip and a microcontroller unit. The system-on-a-chip includes a memory 1001 and a processor 1002. The memory 1001 stores executable program code 10011, and the processor 1002 is used to call and execute the executable program code 10011 to perform a timing method.
[0171] Furthermore, embodiments of this application also protect an apparatus that may include a memory and a processor, wherein the memory stores executable program code, and the processor is used to call and execute the executable program code to perform a timing method provided in embodiments of this application.
[0172] This embodiment can divide the device into functional modules based on the above method example. For example, each module can correspond to a separate function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0173] When each function is divided into modules corresponding to its specific function, the device may further include a first determining module, a second determining module, a time synchronization module, a verification module, a third determining module, a time return module, a time acquisition module, and an update module. It should be noted that all relevant content regarding the steps involved in the above method embodiments can be referenced to the functional descriptions of the corresponding modules, and will not be repeated here.
[0174] It should be understood that the apparatus provided in this embodiment is used to execute the above-described timing method, and therefore can achieve the same effect as the above-described implementation method.
[0175] When using an integrated unit, the device may include a processing module and a storage module. When the device is applied to a vehicle, the processing module can be used to control and manage the vehicle's movements. The storage module can be used to support the vehicle in executing relevant program code.
[0176] The processing module may be a processor, which can implement or execute various exemplary logic blocks, modules, and circuits shown in conjunction with the disclosure of this application. The processor may also be a combination of functions that implement computing capabilities, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc., and the storage module may be a memory.
[0177] In addition, the device provided in the embodiments of this application may specifically be a chip, component or module. The chip may include a connected processor and a memory. The memory is used to store instructions. When the processor calls and executes the instructions, the chip can execute a timing method provided in the above embodiments.
[0178] This embodiment also provides a computer-readable storage medium storing computer program code. When the computer program code is run on a computer, the computer executes the aforementioned method steps to implement a time synchronization method provided in the above embodiment.
[0179] This embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned related steps to implement a time synchronization method provided in the above embodiment.
[0180] In this embodiment, the device, computer-readable storage medium, computer program product, or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0181] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A time synchronization method, characterized in that, Applied to vehicles, the vehicles include multiple virtual systems built on a system-on-a-chip, the multiple virtual systems including at least a host entertainment system and a TBox system, and the multiple virtual systems sharing a common microcontroller unit, the method includes: After the TBox system has started up, the TBox system determines a first system time. The first system time includes a pending system time determined by the TBox system based on the verification result, or a target system time obtained by the TBox system from the host entertainment system. The target system time is related to the local clock time obtained from the local clock source in the microcontroller unit. The TBox system uses a first priority rule to determine the second system time from the first clock time obtained from the first external clock source and the first system time; The TBox system is synchronized using the second system time.
2. The method according to claim 1, characterized in that, The TBox system determines the first system time, including: The TBox system determines whether the time synchronization flag is valid; If the time synchronization flag is valid, the pending system time is determined as the first system time; If the time synchronization flag is invalid, the target system time will be determined as the first system time.
3. The method according to claim 1, characterized in that, The pending system time determined by the TBox system based on the verification results includes: After the TBox system has started up, the TBox system obtains the third system time and the factory default time. The time of the third system is verified based on the factory default time to obtain the verification result. If the verification result indicates that the third system time is less than or equal to the factory default time, the factory default time will be determined as the pending system time. If the verification result indicates that the third system time is greater than the factory default time, the third system time will be determined as the pending system time.
4. The method according to claim 1, characterized in that, The first external clock source includes a satellite clock source and a cloud clock source. The TBox system uses a first priority rule to determine the second system time from the first clock time obtained from the first external clock source and the first system time, including: The TBox system obtains the first satellite clock time from the satellite clock source; If the first satellite clock time is valid, the first satellite clock time is determined as the second system time; If the first satellite clock time is invalid, the TBox system detects the status of the cloud clock source; If the cloud clock source is logged in and the cloud clock time obtained from the cloud clock source is valid, the cloud clock time will be determined as the second system time. If the cloud clock source is not logged in, or if the cloud clock source is logged in but the cloud clock time obtained from the cloud clock source is invalid, the first system time will be determined as the second system time.
5. The method according to claim 1, characterized in that, The plurality of virtual systems also includes a host instrumentation system, and the method further includes: After the host instrument system, the host entertainment system and the TBox system have started up, the local clock time obtained by the microcontroller unit from the local clock source is sent to the host entertainment system through the host instrument system. The host entertainment system uses a second priority rule to determine the target system time from the second clock time obtained from the second external clock source and the local clock time.
6. The method according to claim 5, characterized in that, The second external clock source includes a network clock source and a satellite clock source. The host entertainment system uses a second priority rule to determine the target system time from the second clock time obtained from the second external clock source and the local clock time, including: The host entertainment system obtains the network clock time from the network clock source; If the network clock time is valid, the network clock time is determined as the target system time; In the event that the network clock time is invalid, the host entertainment system obtains a second satellite clock time from the satellite clock source; If the second satellite clock time is valid, the second satellite clock time shall be determined as the target system time; If the second satellite clock time is invalid, the local clock time will be determined as the target system time.
7. The method according to claim 5, characterized in that, After the host entertainment system determines the target system time from the second clock time obtained from the second external clock source and the local clock time using the second priority rule, the system further includes: The host entertainment system returns the target system time to the host instrumentation system; The host instrumentation system returns the target system time to the microcontroller unit.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: The TBox system sends a request message to the host entertainment system to obtain the target system time from the host entertainment system based on the request message; And / or, the TBox system receives the target system time actively sent by the host entertainment system.
9. The method according to any one of claims 1 to 7, characterized in that, After timing the TBox system using the second system time, the method further includes: The TBox system updates the timing status of the timing flag to "timing enabled".
10. A vehicle, comprising a controller, characterized in that, The controller includes a system-on-a-chip and a microcontroller unit. The system-on-a-chip includes: Memory, used to store executable program code; A processor for calling and running the executable program code from the memory, causing the vehicle to perform the method as described in any one of claims 1 to 9.