Vehicle time control method and related device
By building a real-time clock module in the domain controller and updating time information using the network time protocol server, the problem of low reliability of vehicle time synchronization caused by T-BOX dependence is solved, and higher accuracy and reliability of time synchronization are achieved.
Patent Information
- Application Number
- CN202510734040.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-03
- Publication Date
- 2025-08-08
AI Technical Summary
In the prior art, vehicle time synchronization depends on T-BOX to quickly start, resulting in communication delays or abnormalities, resulting in low reliability of time synchronization, affecting the smooth progress of time-strong related services such as OTA.
The real-time clock module is built in the domain controller. The local time information of the real-time clock module is updated through the network time protocol server, and directly obtain and synchronize it to the electronic control unit to avoid the dependence of T-BOX.
It improves the reliability and accuracy of vehicle time synchronization, reduces time synchronization errors, and ensures the normal progress of OTA and other services.
Smart Images

Figure CN120454910A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle technology, and in particular to a whole-vehicle time control method and related devices. Background Art
[0002] As vehicles become increasingly intelligent, the coordinated operation of electronic systems places higher demands on the synchronization accuracy of the entire vehicle's time. Time-sensitive services such as in-vehicle communications, safety control, and over-the-air (OTA) technology all rely on accurate system time synchronization throughout the vehicle.
[0003] In related technologies, time information from an external time source is usually obtained through an on-board telematics unit (T-BOX). This time information is then sent to a domain controller via a Controller Area Network (CAN) message. The domain controller then distributes the time information to each electronic control unit (ECU) in the vehicle to achieve time synchronization for the entire vehicle.
[0004] However, the above solution requires the T-BOX to start up quickly and send CAN messages carrying time information. T-BOX startup delays or communication anomalies may cause the domain controller to not complete time synchronization when starting time-sensitive services such as OTA, resulting in business logic errors. This shows that the reliability of vehicle time synchronization in related technologies is low. Summary of the Invention
[0005] In response to the above problems, the present application provides a vehicle time control method and related devices for improving the reliability of vehicle time synchronization.
[0006] Based on this, this application discloses the following technical solutions:
[0007] In a first aspect, an embodiment of the present application provides a vehicle time control method, which is applied to a domain controller of a target vehicle, wherein the domain controller has a built-in real-time clock module, and the method includes:
[0008] After loading the configuration information carrying the server address, obtaining network time information from a network time protocol server, the network time information being used to synchronize the entire vehicle time, the network time protocol server being determined by the server address indication carried in the configuration information;
[0009] The first local time information provided by the real-time clock module is updated according to the network time information to obtain the second local time information, wherein the first local time information and the second local time information are used to achieve vehicle time synchronization;
[0010] The domain controller and the electronic control unit of the target vehicle are time synchronized according to the second local time information provided by the real-time clock module.
[0011] Optionally, after obtaining the network time information from the network time protocol server, the method further includes:
[0012] Performing time synchronization on the domain controller and the electronic control unit of the target vehicle according to the network time information;
[0013] Detecting the synchronization process of the network time information through a timing detection instruction;
[0014] If the feedback information of the timing detection instruction indicates that the network time information is successfully synchronized, the first local time information provided by the real-time clock module is updated according to the network time information.
[0015] Optionally, the method further includes:
[0016] If the feedback information of the timing detection instruction indicates that the network time information synchronization fails, the server communication function is turned off; wherein, when the server communication function is turned off, the domain controller cannot establish a connection with the network time protocol server.
[0017] Optionally, acquiring network time information from a network time protocol server includes:
[0018] Sending a network diagnostic instruction, wherein the network diagnostic instruction carries a target domain name for testing a network status;
[0019] Determine the network status according to the feedback information corresponding to the network diagnostic instruction, wherein the network status includes a normal state and an abnormal state;
[0020] If the network status is the normal status, the server communication function is enabled;
[0021] The network time information is obtained from the network time protocol server through the server communication function.
[0022] Optionally, the method further includes:
[0023] Obtaining the calibration time information of the time zone where the target vehicle is located;
[0024] Setting the time of the real-time clock module according to the calibration time information;
[0025] If the target vehicle is powered on, the first local time information of the real-time clock module is obtained, and the initial local time information is determined based on the calibration time information.
[0026] Optionally, if the network state is the abnormal state and the real-time clock module cannot provide local time information, the domain controller provides default time information, the default time information corresponds to the first moment, and the method further includes:
[0027] Acquire backup time information of the non-volatile memory, where the backup time information is backed up at a second time, and the second time is later than the first time;
[0028] Time synchronization is performed on the domain controller and the electronic control unit of the target vehicle according to the backup time information.
[0029] Optionally, the backup time information is determined by:
[0030] Obtaining a backup period, where the backup period indicates an interval between the backup time information stored for the (i-1)th time and the backup time information stored for the (i)th time;
[0031] acquiring the system time provided by the domain controller multiple times when the target vehicle is powered on according to the backup cycle and updating the backup time information multiple times;
[0032] For the system time acquired for the i-th time, the backup time information stored for the i-1th time in the non-volatile memory is updated according to the system time acquired for the i-th time to obtain the backup time information stored for the i-th time.
[0033] Optionally, the backup time information is determined by:
[0034] In response to obtaining the shutdown instruction, obtaining the system time provided by the domain controller;
[0035] The system time is stored in the non-volatile memory to obtain the backup time information.
[0036] In a second aspect, an embodiment of the present application provides a vehicle time control device, which is applied to a domain controller of a target vehicle, wherein the domain controller has a built-in real-time clock module, and the device includes: an acquisition unit, an update unit, and a synchronization unit;
[0037] The acquisition unit is configured to acquire network time information from a network time protocol server after loading the configuration information carrying the server address, wherein the network time information is used to achieve vehicle time synchronization, and the network time protocol server is determined by the server address indication carried in the configuration information;
[0038] The updating unit is configured to update the first local time information provided by the real-time clock module according to the network time information to obtain second local time information, wherein the first local time information and the second local time information are used to achieve vehicle time synchronization;
[0039] The synchronization unit is used to synchronize the time of the domain controller and the electronic control unit of the target vehicle according to the second local time information provided by the real-time clock module.
[0040] In a third aspect, an embodiment of the present application provides a vehicle, comprising a domain controller with a built-in real-time clock module, wherein the domain controller is configured to execute the method described in the first aspect above according to a computer program.
[0041] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method described in the first aspect above.
[0042] In a fifth aspect, an embodiment of the present application provides a computer program product comprising a computer program, which, when executed on a computer device, enables the computer device to execute the method described in the first aspect above.
[0043] It can be seen from the above technical solutions that this application has at least the following beneficial effects:
[0044] After loading the configuration information containing the server address, network time information is obtained from the Network Time Protocol (NTP) server. This network time information is used to synchronize the entire vehicle. The NTP server is identified by the server address indicated in the configuration information. The first local time information provided by the real-time clock module is updated based on the network time information to obtain second local time information. The first and second local time information are used to synchronize the entire vehicle. By updating the first local time information originally provided by the real-time clock module based on the network time information, the updated second local time information is more real-time and accurate, reducing deviations in vehicle-wide time synchronization. Time synchronization is performed on the domain controller and the target vehicle's electronic control unit based on the second local time information provided by the real-time clock module. This allows the domain controller to synchronize the entire vehicle directly based on the calibrated second local time information provided by the built-in real-time clock module, avoiding reliance on the T-BOX's quick start function. This reduces time synchronization errors caused by time information transmission delays or failures and improves the reliability of vehicle-wide time synchronization. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0046] Figure 1 A flow chart of a vehicle time control method provided in an embodiment of the present application;
[0047] Figure 2 A schematic diagram of a process for synchronizing vehicle time based on network time information provided in an embodiment of the present application;
[0048] Figure 3 A schematic diagram of a process for synchronizing vehicle time based on backup time information provided in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of a process for determining backup time information provided in an embodiment of the present application;
[0050] Figure 5 A schematic structural diagram of a vehicle time control device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] The following describes embodiments of the present application in more detail with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are for illustrative purposes only and are not intended to limit the scope of protection of the present application.
[0052] As described in the background technology, relying on the T-BOX to transmit time information requires the T-BOX to start quickly and send CAN messages carrying time information. T-BOX startup delays or communication anomalies can cause the domain controller to not complete time synchronization when starting time-sensitive services, resulting in business logic errors and low reliability of vehicle time synchronization.
[0053] Taking OTA (Over-the-Air) as an example, today's vehicles often rely on OTA to update electronic system software, improving and supplementing functionality. Public Key Infrastructure (PKI) and Transport Layer Security (TLS) are key technologies for ensuring OTA security. The accuracy of the vehicle's system time directly impacts the validity of the PKI certificate. If there's a T-BOX startup delay or a communication link failure between the T-BOX and the domain controller, the domain controller won't have acquired time information by the time it begins the OTA update, the vehicle's time may not be synchronized, and the PKI certificate may be expired or invalid, impacting the smooth progress of the OTA update.
[0054] A real-time clock (RTC) module is an electronic device used to record and maintain time information. Research has found that in the field of vehicle technology, by using a domain controller with a built-in RTC module for vehicle-wide time synchronization, the domain controller can directly obtain the local time information provided by the RTC module, thereby eliminating the time information transmission process from the T-BOX to the domain controller, reducing unreliable data transmission links, and improving the reliability of vehicle time synchronization. However, if the local time information provided by the RTC module relies solely on initial settings during the production phase, it is difficult to maintain continuous and accurate local time information.
[0055] Based on this, an embodiment of the present application provides a vehicle time control method and related devices, which updates and calibrates the first local time information provided by the real-time clock module built into the domain controller by obtaining network implementation information of the network time protocol server to obtain the second local time information. By directly obtaining the second local time information provided by the real-time clock module to synchronize the entire vehicle time, the reliability of the vehicle time synchronization is improved.
[0056] The vehicle time control method provided in this application can be applied to a domain controller with a built-in real-time clock module. Figure 1 , which is a flow chart of the vehicle time control method provided by the embodiment of the present application. For the sake of convenience, the following embodiment is introduced by taking the execution subject of the vehicle time control method as the domain controller of the target vehicle as an example, and the domain controller has a built-in real-time clock module. Figure 1 As shown, the vehicle time control method includes S101-S103.
[0057] S101: After loading the configuration information carrying the server address, obtain network time information from the network time protocol server.
[0058] The network time information is the current standard time data obtained from the network time protocol server through the network time protocol. The network time information is used to achieve vehicle time synchronization.
[0059] The Network Time Protocol (NTP) is a protocol used to synchronize system clocks to a standard time source. Domain controllers connect to an NTP server that supports NTP and exchange data with the server to obtain network time information provided by the server.
[0060] The process of acquiring network time information relies on the server communication function, which is used to communicate with the Network Time Protocol (NTP) server and synchronize the acquired network time information with the domain controller's built-in real-time time module. Before acquiring network time information from the NTP server, the domain controller writes configuration information for executing the server communication function into a configuration file. This configuration information includes the server address and time synchronization period. The server address is an identifier for the NTP server, indicating its location on the network.
[0061] The network time protocol server is determined by the server address indication carried in the configuration information, that is, by reading the configuration information in the configuration file, determining the location of the network time protocol server based on the server address, and establishing a connection with the network time protocol server to obtain network time information.
[0062] As an implementation, there may be multiple Network Time Protocol servers. That is, the network time information may be determined based on the time information provided by multiple Network Time Protocol servers. For example, the network time information may be obtained by filtering and performing statistical analysis to calculate a comprehensive average of the multiple Network Time Protocol servers. For another example, if one of the multiple Network Time Protocol servers provides abnormal time information, the time information provided by other Network Time Protocol servers may be used for correction.
[0063] It should be noted that, unlike the T-BOX time synchronization process, the above process of obtaining network time information from the network time protocol server is not performed after the business that requires obtaining the entire vehicle time starts, but starts after the target vehicle is powered on. For example, after the target vehicle is powered on, the time synchronization period carried in the configuration information is read, and the network time information is periodically obtained from the connected network time protocol server according to the time synchronization period.
[0064] S102: Update the first local time information provided by the real-time clock module according to the network time information to obtain second local time information.
[0065] The first local time information is the initial reference time data provided without any network time update or correction. It can be used to synchronize the entire vehicle's time. Specifically, the domain controller can directly obtain the first local time information from its built-in real-time clock module and then synchronize it with other ECUs controlled by the domain controller in the target vehicle, achieving full vehicle time synchronization.
[0066] Since the real-time clock module is built into the domain controller, the domain controller can directly obtain the first local time information. Compared with relying on the T-BOX's fast startup and stable time information transmission, the real-time clock module obtains the first local time information more stably and reliably. The network time information is real-time information from the network time protocol server, which has higher real-time and accuracy. If the first local time information is not updated and corrected for a long time, time drift may occur, resulting in inaccurate vehicle time. Therefore, by updating the first local time information according to the network time information, a second local time information that is stable, reliable, and has high real-time and accuracy can be obtained. The second local time information is the local time information obtained after updating and correction. It is the same as the first local time information and can also be used to achieve vehicle time synchronization.
[0067] As an implementation method, the real-time clock module is powered by a separate power supply, such as an independent power supply through a backup battery such as a button battery, so that the real-time clock module has the ability to continuously provide time information. When the domain controller wakes up from sleep, the domain controller can still obtain the local time information provided by the real-time clock module through the time acquisition interface to achieve time synchronization of the entire vehicle.
[0068] The embodiments of the present application do not specifically limit how to update the first local time information provided by the real-time clock module based on the network time information. For example, the network time information can be directly synchronized to the real-time clock module to obtain the second local time information. The first local time information can also be corrected based on the difference between the network time information and the first local time information in combination with the network transmission delay to reduce the time information deviation provided by the real-time clock module.
[0069] In one possible implementation, after obtaining the network time information from the network time protocol server, the domain controller and the electronic control unit of the target vehicle can also be synchronized according to the network time information, thereby directly correcting the system time of the target vehicle. The synchronization process of the network time information is detected by a timing detection instruction, which is an instruction for determining whether the time synchronization process of the target vehicle according to the network time information is successful. For example, the timing detection instruction can be a timedatectl command. After sending the timing detection instruction, feedback information of the timing detection instruction will be received. If the feedback information of the timing detection instruction indicates that the network time information synchronization is successful, the first local time information provided by the real-time clock module is updated according to the network time information.
[0070] Therefore, in the process of updating the time information of the real-time clock module, not only can the real-time clock module provide more accurate and real-time second local time information, but the domain controller and electronic control unit of the target vehicle can also synchronize the network time information, so that during the update process, the entire vehicle time can also be corrected and updated, thereby improving the accuracy of the system time.
[0071] S103: Performing time synchronization on the domain controller and the electronic control unit of the target vehicle according to the second local time information provided by the real-time clock module.
[0072] Specifically, the real-time clock module's driver invokes an interface for obtaining time information, accessing registers to obtain the second local time information stored in the target register. The driver then maps the memory address to a virtual memory address to locate and read the target register. In addition to enabling the registers, the real-time clock module's clock source must be configured to obtain the second local time information.
[0073] Through the above operations, the domain controller obtains the second local time information, which is then distributed to each electronic control unit of the target vehicle through transmission methods such as CAN messages or Ethernet routing, thereby synchronizing the system time of the target vehicle with the real-time clock module.
[0074] In the embodiment of the present application, the process of obtaining the second local time information is an offline operation. Compared with transmitting time information through CAN messages or Ethernet after the T-BOX is started, the domain controller not only gets rid of the dependence on external time sources and is not affected by the T-BOX startup delay, but also the method of obtaining time information is more stable and reliable, thereby improving the reliability of the domain controller in obtaining time information. As a result, it is more reliable when synchronizing the second local information to the electronic control unit of the target vehicle through the domain controller, making the system time of the target vehicle more accurate.
[0075] In one possible implementation, if the first local time information has not been updated or the update of the first local time information has failed, in order to enable the target vehicle to obtain more accurate first local time information, an embodiment of the present application also provides an implementation method for pre-calibrating the real-time clock module.
[0076] Obtain the calibrated time information for the target vehicle's time zone. This calibrated time information is the current standard time in the target vehicle's time zone and can be obtained, for example, from a network time protocol server via an online time interface. The real-time clock module is set based on the calibrated time information so that the real-time clock module can provide a first local time information determined based on the calibrated time information, which is closer to the actual time in the target vehicle's time zone. If the target vehicle is powered on, obtain the first local time information from the real-time clock module.
[0077] For example, at the end of the product life cycle (EOL) of the target vehicle, the host computer can set the calibration time information of the time zone where the target vehicle is located into the real-time clock module through the communication protocol.
[0078] Therefore, by calibrating the real-time clock module in advance, it can provide more accurate first local time information, thereby improving the accuracy of the vehicle system time when it has not been updated or cannot be updated.
[0079] As can be seen from the above technical solution, after loading the configuration information carrying the server address, network time information is obtained from the Network Time Protocol server. The network time information is used to achieve vehicle-wide time synchronization. The Network Time Protocol server is determined by the server address indicated in the configuration information. The first local time information provided by the real-time clock module is updated based on the network time information to obtain second local time information. The first local time information and the second local time information are used to achieve vehicle-wide time synchronization. By updating the first local time information originally provided by the real-time clock module based on the network time information, the updated second local time information is more real-time and accurate, reducing deviations in vehicle-wide time synchronization. Based on the second local time information provided by the real-time clock module, the domain controller and the target vehicle's electronic control unit are synchronized. As a result, the domain controller can directly synchronize the entire vehicle's time based on the calibrated second local time information provided by the built-in real-time clock module, avoiding reliance on the T-BOX fast startup, thereby reducing time synchronization errors caused by time information transmission delays or failures and improving the reliability of vehicle-wide time synchronization.
[0080] In order to reduce the waste of computing resources during the update of the first local time information, the embodiment of the present application further provides two implementation methods, which are described below.
[0081] Implementation method 1: If the feedback information of the timing detection instruction indicates that the network time information synchronization fails, the server communication function is disabled. In this case, the domain controller cannot establish a connection with the network time protocol server.
[0082] If the feedback information of the timing detection command indicates that the network time information synchronization fails, it means that the network time information cannot be synchronized to the real-time clock module of the domain controller. For example, the current network status cannot meet the transmission conditions of the network time information, the network time protocol server is unreachable, etc. In this case, the server communication function is turned off to avoid multiple requests to connect to the network time protocol server and try to obtain network time information, thereby reducing the waste of computing resources.
[0083] Implementation method 2 sends a network diagnostic command containing a target domain name used to test network status. Based on the feedback from the network diagnostic command, the network status is determined, such as whether network communication is normal and whether domain name resolution is functioning properly. Network status can be classified as normal or abnormal. If the network status is normal, the server communication function is enabled. This function is used to obtain network time information from the Network Time Protocol server.
[0084] A network diagnostic command is used to determine the current network status. It carries a target domain name used to test the network status. By sending a network request to the target domain name, the network status can be determined based on the corresponding feedback information from the network diagnostic command. The target domain name is the domain name used to test the network status. If the network status is normal, it indicates that the current network supports obtaining network time information from the Network Time Protocol server. In this case, the server communication function is enabled to establish a connection with the Network Time Protocol server and proceed with subsequent steps. If the network status is abnormal, the server communication function is disabled or remains disabled.
[0085] As an implementation method, the target domain name should be the domain name corresponding to a more universal URL. Specifically, the target domain name should not be the domain name corresponding to the server address of the Network Time Protocol server. If there are multiple Network Time Protocol servers, there is a possibility that one of the Network Time Protocol servers is abnormal, causing the corresponding domain name to be unreachable, thereby receiving feedback information about the abnormal network status, while the other Network Time Protocol servers are normal. Testing the domain name corresponding to the server address cannot accurately and comprehensively reflect the network status.
[0086] Therefore, by enabling the server communication function when the network status is normal, the success rate of updating the real-time clock module with network time information is improved, and the waste of computing resources in trying to obtain network time information when the network status is abnormal is reduced, thereby realizing automatic time synchronization for the real-time clock module based on the network status.
[0087] See also Figure 2 , Figure 2 This is a flow chart of synchronizing vehicle time based on network time information provided by the embodiment of the present application. Figure 2 An exemplary process of vehicle time synchronization using the above-mentioned first and second embodiments is described as an example.
[0088] After the target vehicle's electronic system is powered on, the first local time information provided by the real-time clock module can be directly obtained and the time of the entire vehicle can be synchronized through the domain controller. At the same time, the Internet connection status is detected by the curl command, which is a network diagnostic command, such as curl -I http: / / www.XXX.com , http: / / www.XXX.com Used to indicate the target domain name of a non-server address. If the network condition is normal, the Chronyd function is turned on. The Chronyd function is a server communication function. If the feedback information of the timedatectl command indicates that the network time information synchronization is normal, the Chronyd function is used to establish a connection with the network time protocol server, and the obtained network time information is synchronized to the real-time clock module, thereby updating the first local time information and synchronizing the vehicle time, so that the real-time clock module can provide a second local time information with stronger real-time and accuracy, and the system time is also corrected. If the feedback information of the timedatectl command indicates that the network time information synchronization has failed, the Chronyd function is turned off, and the process of adaptive timing update by detecting the Internet connection condition through the curl command is returned.
[0089] To further improve the reliability of vehicle-wide time synchronization, embodiments of the present application provide a method for storing backup time information in non-volatile memory, thereby providing relatively more accurate time information for the target vehicle. Non-volatile memory, such as Flash and electrically erasable programmable read-only memory (EEPROM), is a storage medium that retains data even after power is turned off. This allows the non-volatile memory to maintain stable and long-term storage of backup time information, regardless of power-up or power-down.
[0090] If the network status is abnormal and the real-time clock module cannot provide local time information, the local time information includes the first local time information and the second local time information, then the domain controller provides default time information, the default time information is the default value of the time information provided by the vehicle electronic system, and the default time information corresponds to the first moment.
[0091] Based on this, the backup time information of the non-volatile memory is obtained. The backup time information is obtained by backing up the system time of the target vehicle. The backup time information is backed up at a second time, which is later than the first time. The domain controller and the electronic control unit of the target vehicle are then synchronized based on the backup time information.
[0092] For example, if the real-time time module fails or the power fails, the implementation time module cannot provide local time information, and the network status is abnormal, and network time information cannot be obtained. In this case, the domain controller provides default time information and synchronizes the entire vehicle. For example, the first moment corresponding to the default time information is September 1, 2022. At this time, after the target vehicle's vehicle data service is uploaded to the server, it is detected that the target vehicle's system time does not match the time in the current time zone, September 20, 2024. The server determines that the data is invalid and discards it, resulting in discontinuous server time, data anomalies, and the inability to perform other data analysis services. At the same time, since the log of the vehicle data service records the system time, inaccurate system data will also cause the log to lose its reference value. If the second moment corresponding to the backup time information is September 19, 2024, the system time obtained by synchronizing the backup time information is closer to the real time and has higher reliability.
[0093] Therefore, by obtaining the backup time information, the target vehicle can synchronize time information that is more accurate than the default time information, thereby maintaining the relative accuracy of the vehicle time in abnormal circumstances where neither the local time information can be obtained from the real-time clock module nor the network time information can be obtained from the network time protocol server.
[0094] See also Figure 3 , Figure 3 This is a schematic diagram of a process for synchronizing vehicle time based on backup time information, provided in an embodiment of the present application. After the system is powered on, if both the feedback from reading the real-time clock module and network monitoring (sending a network diagnostic command) indicates failure, the backup time information stored in the time file is read and synchronized with the target vehicle's domain controller and electronic control unit to obtain a relatively more accurate system time. If either the feedback from reading the real-time clock module or network monitoring (sending a network diagnostic command) indicates success, the system time is synchronized successfully, and the business process requiring the system time is carried out.
[0095] In a possible implementation, the backup time information can be determined in the following manner:
[0096] Obtain a backup period, where the backup period indicates the interval between the backup time information stored for the i-1th time and the backup time information stored for the ith time, where i is a positive integer. Retrieve the system time provided by the domain controller multiple times when the target vehicle is powered on, and update the backup time information multiple times according to the backup period.
[0097] For the i-th system time, the backup time information stored in the non-volatile memory is updated based on the i-th system time, resulting in the i-th backup time information. That is, after the backup time information is stored, the system time is obtained and updated after one backup cycle.
[0098] Therefore, by periodically acquiring the backup time information, the backup time information is continuously updated, maintaining a higher relative accuracy.
[0099] In a possible implementation, the backup time information may also be determined in the following manner:
[0100] In response to receiving a shutdown command, the system time provided by the domain controller is obtained. The system time is stored in non-volatile memory to obtain backup time information. The shutdown command is used to instruct the vehicle's electronic system to shut down. Obtaining the system time before shutting down the vehicle's electronic system allows the backup time information to be synchronized with the latest time at power-on, thereby ensuring the relative accuracy of the backup time information.
[0101] See also Figure 4 , Figure 4 A schematic diagram of a process for determining backup time information provided by an embodiment of the present application. When the vehicle electronic system is powered on, not only is the system time recorded in a time file periodically, but the time file is also updated after receiving a shutdown command, thereby making the time file record more accurate backup time information.
[0102] See also Figure 5 , Figure 5 The embodiment of the present application provides a vehicle time control device, the device 500 includes: an acquisition unit 501, an update unit 502 and a synchronization unit 503;
[0103] The acquisition unit 501 is configured to acquire network time information from a network time protocol server after loading the configuration information carrying the server address, wherein the network time information is used to synchronize the entire vehicle time. The network time protocol server is determined by the server address indication carried in the configuration information;
[0104] The updating unit 502 is configured to update the first local time information provided by the real-time clock module according to the network time information to obtain second local time information, wherein the first local time information and the second local time information are used to achieve vehicle time synchronization;
[0105] The synchronization unit 503 is configured to synchronize the time of the domain controller and the electronic control unit of the target vehicle according to the second local time information provided by the real-time clock module.
[0106] As can be seen from the above technical solution, the vehicle time control device provided in the embodiment of the present application includes an acquisition unit, an update unit, and a synchronization unit. After loading configuration information carrying a server address, the acquisition unit obtains network time information from a network time protocol server. The network time information is used to synchronize the entire vehicle time. The network time protocol server is determined by the server address indicated in the configuration information. The update unit updates the first local time information provided by the real-time clock module based on the network time information to obtain second local time information. The first and second local time information are used to synchronize the entire vehicle time. By updating the first local time information originally provided by the real-time clock module based on the network time information, the updated second local time information is more real-time and accurate, reducing deviations in vehicle time synchronization. The synchronization unit synchronizes the domain controller and the target vehicle's electronic control unit based on the second local time information provided by the real-time clock module. As a result, the domain controller can directly synchronize the entire vehicle time based on the calibrated second local time information provided by the built-in real-time clock module, avoiding reliance on the T-BOX fast startup, thereby reducing time synchronization errors caused by time information transmission delays or failures and improving the reliability of vehicle time synchronization.
[0107] As a possible implementation, the apparatus further includes a system time update synchronization unit configured to, after obtaining network time information from the network time protocol server:
[0108] Performing time synchronization on the domain controller and the electronic control unit of the target vehicle according to the network time information;
[0109] Detecting the synchronization process of the network time information through a timing detection instruction;
[0110] If the feedback information of the timing detection instruction indicates that the network time information is successfully synchronized, the first local time information provided by the real-time clock module is updated according to the network time information.
[0111] As a possible implementation manner, the apparatus further includes a communication closing unit, configured to:
[0112] If the feedback information of the timing detection instruction indicates that the network time information synchronization fails, the server communication function is turned off; wherein, when the server communication function is turned off, the domain controller cannot establish a connection with the network time protocol server.
[0113] As a possible implementation manner, the acquiring unit is specifically configured to:
[0114] Sending a network diagnostic instruction, wherein the network diagnostic instruction carries a target domain name for testing a network status;
[0115] Determine the network status according to the feedback information corresponding to the network diagnostic instruction, wherein the network status includes a normal state and an abnormal state;
[0116] If the network status is the normal status, the server communication function is enabled;
[0117] The network time information is obtained from the network time protocol server through the server communication function.
[0118] As a possible implementation, the device further includes a calibration unit, configured to:
[0119] Obtaining the calibration time information of the time zone where the target vehicle is located;
[0120] Setting the time of the real-time clock module according to the calibration time information;
[0121] If the target vehicle is powered on, the first local time information of the real-time clock module is obtained, and the initial local time information is determined based on the calibration time information.
[0122] As a possible implementation, if the network state is the abnormal state and the real-time clock module cannot provide local time information, the domain controller provides default time information, where the default time information corresponds to the first moment, and the device further includes a backup unit configured to:
[0123] Acquire backup time information of the non-volatile memory, where the backup time information is backed up at a second time, and the second time is later than the first time;
[0124] Time synchronization is performed on the domain controller and the electronic control unit of the target vehicle according to the backup time information.
[0125] As a possible implementation, the backup time information is determined by:
[0126] Obtaining a backup period, where the backup period indicates an interval between the backup time information stored for the (i-1)th time and the backup time information stored for the (i)th time;
[0127] acquiring the system time provided by the domain controller multiple times when the target vehicle is powered on according to the backup cycle and updating the backup time information multiple times;
[0128] For the system time acquired for the i-th time, the backup time information stored for the i-1th time in the non-volatile memory is updated according to the system time acquired for the i-th time to obtain the backup time information stored for the i-th time.
[0129] As a possible implementation, the backup time information is determined by:
[0130] In response to obtaining the shutdown instruction, obtaining the system time provided by the domain controller;
[0131] The system time is stored in the non-volatile memory to obtain the backup time information.
[0132] An embodiment of the present application further provides a vehicle, characterized in that the vehicle includes a domain controller with a built-in real-time clock module, and the domain controller is used to execute the method of the above method embodiment according to a computer program.
[0133] An embodiment of the present application further provides a computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method of the above method embodiment.
[0134] An embodiment of the present application further provides a computer program product including a computer program, which, when executed on a computer device, enables the computer device to execute the method of the above method embodiment.
[0135] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the systems or devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.
[0136] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.
[0137] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or plural.
[0138] It should also be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0139] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0140] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A vehicle time control method, characterized in that: A domain controller applied to a target vehicle, wherein the domain controller has a built-in real-time clock module, and the method includes: After loading the configuration information carrying the server address, obtaining network time information from a network time protocol server, the network time information being used to synchronize the entire vehicle time, the network time protocol server being determined by the server address indication carried in the configuration information; The first local time information provided by the real-time clock module is updated according to the network time information to obtain the second local time information, wherein the first local time information and the second local time information are used to achieve vehicle time synchronization; The domain controller and the electronic control unit of the target vehicle are time synchronized according to the second local time information provided by the real-time clock module.
2. The method according to claim 1, characterized in that After obtaining the network time information from the network time protocol server, the method further includes: Performing time synchronization on the domain controller and the electronic control unit of the target vehicle according to the network time information; Detecting the synchronization process of the network time information through a timing detection instruction; If the feedback information of the timing detection instruction indicates that the network time information is successfully synchronized, the first local time information provided by the real-time clock module is updated according to the network time information.
3. The method according to claim 2, characterized in that The method further comprises: If the feedback information of the timing detection instruction indicates that the network time information synchronization fails, the server communication function is turned off; wherein, when the server communication function is turned off, the domain controller cannot establish a connection with the network time protocol server.
4. The method according to claim 1, wherein The obtaining of network time information from a network time protocol server includes: Sending a network diagnostic instruction, wherein the network diagnostic instruction carries a target domain name for testing a network status; Determine the network status according to the feedback information corresponding to the network diagnostic instruction, wherein the network status includes a normal state and an abnormal state; If the network status is the normal status, the server communication function is enabled; The network time information is obtained from the network time protocol server through the server communication function.
5. The method according to claim 1, wherein The method further comprises: Obtaining the calibration time information of the time zone where the target vehicle is located; Setting the time of the real-time clock module according to the calibration time information; If the target vehicle is powered on, the first local time information of the real-time clock module is obtained, and the initial local time information is determined based on the calibration time information.
6. The method according to claim 4, characterized in that If the network state is the abnormal state and the real-time clock module cannot provide local time information, the domain controller provides default time information, the default time information corresponds to the first moment, and the method further includes: Acquire backup time information of the non-volatile memory, where the backup time information is backed up at a second time, and the second time is later than the first time; Time synchronization is performed on the domain controller and the electronic control unit of the target vehicle according to the backup time information.
7. The method according to claim 6, characterized in that The backup time information is determined in the following manner: Obtaining a backup period, where the backup period indicates an interval between the backup time information stored for the (i-1)th time and the backup time information stored for the (i)th time; acquiring the system time provided by the domain controller multiple times when the target vehicle is powered on according to the backup cycle and updating the backup time information multiple times; For the system time acquired for the i-th time, the backup time information stored for the i-1th time in the non-volatile memory is updated according to the system time acquired for the i-th time to obtain the backup time information stored for the i-th time.
8. The method according to claim 6, characterized in that The backup time information is determined in the following manner: In response to obtaining the shutdown instruction, obtaining the system time provided by the domain controller; The system time is stored in the non-volatile memory to obtain the backup time information.
9. A vehicle time control device, characterized in that: A domain controller applied to a target vehicle, wherein the domain controller has a built-in real-time clock module, and the device comprises: an acquisition unit, an update unit, and a synchronization unit; The acquisition unit is configured to acquire network time information from a network time protocol server after loading the configuration information carrying the server address, wherein the network time information is used to achieve vehicle time synchronization, and the network time protocol server is determined by the server address indication carried in the configuration information; The updating unit is configured to update the first local time information provided by the real-time clock module according to the network time information to obtain second local time information, wherein the first local time information and the second local time information are used to achieve vehicle time synchronization; The synchronization unit is used to synchronize the time of the domain controller and the electronic control unit of the target vehicle according to the second local time information provided by the real-time clock module.
10. A vehicle, characterized in that: The vehicle includes a domain controller with a built-in real-time clock module, and the domain controller is used to execute the method according to any one of claims 1 to 8 according to a computer program.