Vehicle-mounted entertainment system upgrading method and system based on Flash CAN
Technical Field
The invention belongs to the technical field of vehicle-mounted upgrade control, and particularly relates to a vehicle-mounted entertainment system upgrade method and system based on a Flash CAN.
Background
With the rapid development of automotive electronics, in-vehicle entertainment systems have become an important component of modern automobiles. The system not only provides multimedia entertainment functions such as music and video, but also integrates diversified services such as navigation, vehicle information display, vehicle-mounted communication and the like. However, with the continued expansion of system functionality and the increasing demand of users, software upgrades of in-vehicle entertainment systems are becoming increasingly important.
Traditional vehicle entertainment system upgrades usually rely on physical media (such as CD, DVD or USB storage devices) for manual upgrades, which is not only cumbersome to operate, but also inefficient. With the popularization of the internet of vehicles technology, remote online upgrade (OTA) is becoming a mainstream way of upgrading an in-vehicle entertainment system. OTA technology allows vehicles to receive and install upgrade packages over a wireless network, thereby enabling remote updating and optimization of the in-vehicle entertainment system.
However, a series of technical challenges are also faced in implementing OTA upgrades. First, the storage medium (e.g., NAND FLASH) of the in-vehicle entertainment system has its special features, such as bad blocks, limited number of block erases, and inability to directly copy, which increases the difficulty and complexity of system upgrades. Second, the in-vehicle entertainment system needs to communicate and coordinate with other control units of the vehicle to ensure smooth progress of the upgrade process, which requires high reliability and stability of the upgrade method. In addition, with the increasing functions of the vehicle-mounted entertainment system, the size of the upgrade package is gradually increased, which puts higher demands on network bandwidth and transmission speed.
In view of the above problems, the industry is continually exploring more efficient, safe, and reliable vehicle entertainment system upgrade methods.
Disclosure of Invention
Aiming at the defects of the prior art, the invention aims to provide a Flash CAN-based vehicle-mounted entertainment system upgrading method and system, which aim to solve the problems of complex operation, low efficiency, technical challenges in the OTA upgrading process and the like in the traditional upgrading mode.
The invention discloses a vehicle-mounted entertainment system upgrading method based on a Flash CAN, which comprises the following steps:
S1, a hardware preparation step, namely ensuring that an embedded control unit supports a CAN bus interface and configuring a CAN controller, a Flash controller and corresponding pins;
S2, a firmware update file obtaining step, namely obtaining a firmware update file matched with the vehicle model and the current system version;
S3, upgrading the steps of the process, including:
s301, backing up the firmware of the current vehicle-mounted entertainment system;
S302, checking the downloaded firmware update file, if the check is successful, continuing the next step, and if the check is failed, re-downloading the firmware update file;
S303, erasing the designated Flash storage area;
S304, a transmission step, in which the upgrade management module requests and transmits a data packet of the firmware update file to the embedded control unit, and if the request or the transmission fails, the data packet rolls back to the original system;
S305, the data receiving and checking step, namely the embedded control unit receives the data packet of the firmware updating file and checks, writes in Flash if the check is successful, counts errors if the check is failed, stops upgrading and restores the original system when the error count exceeds a preset threshold, and if the error count does not exceed the preset threshold, the upgrading management module resends the data packet of the firmware updating file and performs rechecking;
s306, restarting the vehicle after completing data receiving and verifying whether the functions of the vehicle-mounted entertainment system are normal.
By further perfecting the technical scheme, the backup current vehicle-mounted entertainment system firmware is stored in a preset independent area, the independent area is physically or logically isolated from a target area for storing firmware update files, and the independent area selects external storage equipment, cloud storage or a backup server.
And periodically verifying the backup vehicle-mounted entertainment system firmware and performing recovery exercise so as to recover the original vehicle-mounted entertainment system firmware when the upgrading fails.
The setting ensures a reliable, accessible and safe environment for storing the backup files, and when the setting is performed, a backup strategy needs to be formulated, access authority is controlled, the backup files are periodically verified, and recovery exercise is performed, so that the original firmware can be recovered when the upgrading fails.
In the verification step, one or more methods of a checksum, a hash value and a digital signature are adopted to verify the integrity of the firmware update file, the hash value is used for verifying the uniqueness of the firmware update file and is not tampered, and the digital signature is used for verifying the authenticity of the firmware update file.
Further, the Flash memory is divided into a target storage area and other areas by physical division or logical division to obtain the target storage area and the other areas for storing the firmware update file data packet, the physical division refers to dividing the Flash memory into the target storage area and the other areas according to different partitions, the logical division refers to that in the logical management of Flash storage, the addresses of the target storage area and the other areas are different, and in the erasing step, the target storage area is only erased, so that the influence on the data stored in the other areas is avoided.
Further, in the transmission step, a transmission format, a transmission flow and a check sum error processing mechanism of a data packet are defined through a Flash CAN communication protocol, the transmission format of the data packet comprises a data packet header, a data body, a check code and a data packet tail, wherein the data packet header comprises a packet sequence number, a packet total number and a data packet type, the data body comprises firmware data, the check code is used for checking data integrity, the data packet tail marks the end of the data packet, the transmission flow comprises an initialization stage, a data transmission stage, a data receiving and checking stage, a writing stage and a finishing stage, the states of the transmission flow are controlled and managed through a state machine, and the state machine comprises idle, transmitting, receiving and error processing states, and state conversion is carried out according to the current state and event triggering conditions.
Further, the data packets are transmitted in a segmented mode, the embedded control unit executes data receiving and checking on each segmented data packet, when the embedded control unit receives the data packets, the embedded control unit performs integrity checking and sequential checking on the firmware update file data packets so as to ensure the correctness and the sequential performance of the data, after the verification is passed, the data are written into a target storage area of Flash, and an error processing mechanism is triggered when the verification is failed.
Further, the error processing mechanism comprises the steps of monitoring the transmission state of the data packet in real time, immediately stopping the upgrading process by the upgrading management module once the transmission error or abnormality of the data packet is found, counting errors of verification failure and reminding to retry, and recording error logs and state information.
The rules and the mechanisms improve the reliability, the efficiency and the stability of the upgrading process, and ensure that the data packet of the firmware update file can be accurately and completely transmitted to the embedded control unit.
Further, the upgrade management module encrypts the firmware update file by adopting an encryption technology to ensure the safety of firmware data in the processes of downloading, transmitting and storing, wherein the encryption technology comprises symmetric encryption and asymmetric encryption, and the vehicle identity verification is carried out by verifying the unique identifier of the vehicle in the process of transmitting the firmware update file, so that only the vehicle passing verification can receive and apply the firmware update package.
The backup and rollback steps in the upgrade process include automatically backing up the original firmware, and the system stores the backup file in a preset independent area, which is physically or logically isolated from the area for storing the new firmware. Through the storage address division and the access control strategy of Flash, the system can ensure that backup data cannot be wrongly written or covered in the upgrading process. At the same time, the control mechanism also includes protection of the storage area, such as setting a write protect bit, to prevent unauthorized access or modification. To avoid conflicts with new firmware data, and to restore the original system from backup if the upgrade fails.
The system for realizing the vehicle-mounted entertainment system upgrading method based on the Flash CAN comprises the following steps:
The embedded control unit is used for controlling the upgrading process of the vehicle-mounted entertainment system and supporting the CAN bus interface;
the upgrade management module is responsible for downloading, checking, transmitting, writing, backing up and rolling back firmware update files and providing data transmission state monitoring and error processing;
the Flash memory is used for storing firmware update files, backup data and new and old firmware version data;
the communication interface is connected with the vehicle built-in communication network and supports downloading of firmware update packages through Wi-Fi or mobile data networks;
The embedded control unit is communicated with other control units of the vehicle through the CAN bus interface, receives an upgrade instruction and transmits relevant data in the upgrade process.
Compared with the prior art, the vehicle-mounted entertainment system has the advantage that the vehicle-mounted entertainment system has remarkable advantages in upgrading. Firstly, the method does not need the owner to purchase external equipment and upgrade software additionally, greatly reduces upgrade cost, and enables more owners to enjoy the convenience brought by system upgrade easily. Secondly, the upgrading operation can be completed through the vehicle-mounted entertainment system interface, the whole flow is simple and clear, complicated steps are not needed, and the user experience is greatly improved. Meanwhile, by utilizing the high-speed and reliable data transmission characteristic of the Flash CAN, the invention reduces the risk of upgrade failure, improves the upgrade efficiency, enhances the safety of the system and effectively avoids the system abnormality caused by improper upgrade. Finally, the vehicle owner can receive and apply the upgrade package issued by the authorities at any time without waiting, thus greatly shortening the upgrade period and enabling the vehicle owner to enjoy the latest system functions and optimization in the first time.
The invention combines a plurality of aspects such as hardware configuration, CAN communication protocol customization, upgrade management module, program design and the like, provides a comprehensive, flexible and efficient solution for upgrading the vehicle-mounted entertainment system, and is suitable for various upgrade application scenes.
Drawings
Fig. 1 is a flow chart of the method of the present invention.
Detailed Description
The technical scheme of the invention is described in detail below through the drawings, but the protection scope of the invention is not limited to the embodiments.
Embodiment 1 an on-board entertainment system upgrade system based on Flash CAN comprises the following parts.
1. The hardware preparation comprises the steps of ensuring that an embedded control unit (MCU) supports a CAN bus interface and is provided with relevant hardware resources, wherein the hardware resources comprise a CAN controller, a Flash controller and corresponding pin connections, and the corresponding configuration is carried out according to a chip manual.
2. And acquiring a firmware update file, namely downloading the latest firmware update file of the vehicle-mounted entertainment system from an official website of an automobile manufacturer or a designated upgrading service center, and ensuring that the downloaded file is matched with the automobile model, year and current version of the vehicle-mounted entertainment system.
3. The upgrading process comprises the following steps:
① Backing up the current firmware, namely backing up the current vehicle-mounted entertainment system firmware by using Flash CAN software or other tools before upgrading. The backup file should be saved in a secure location so that the original firmware can be restored when the upgrade fails;
② The upgrade module checks the upgrade package, and in order to ensure the safety and the accuracy of the upgrade package, the verification succeeds in the next step, and the upgrade package is downloaded again if the verification fails;
③ Erasing the appointed Flash area;
④ The upgrade management module starts to request and transmit the data packet of the upgrade file, and rolls back to the recovery system if the request and the transmission fail, and the next step is successfully continued;
⑤ The MCU receives the data and performs verification, wherein the data is successfully written into the Flash, the error counting is performed when the verification fails, when the data is larger than a set threshold value, the upgrading is ended, the process is exited, the original system is recovered, and when the data is not larger than the set threshold value, the upgrading module retransmits the data for rechecking;
⑥ And (3) finishing data receiving, restarting and operating the new system, namely restarting the vehicle after upgrading is finished, and checking whether the functions of the vehicle-mounted entertainment system are normal.
As shown in fig. 1, the present invention provides a method for upgrading a vehicle-mounted entertainment system based on the above system, comprising the following steps:
S1, receiving an upgrade instruction:
When the update is needed, the number of the update packages is prompted on the vehicle-mounted entertainment system page, and then the vehicle owner can click on update now to start the update. And then receives upgrade instructions from other control units (such as an information center or a remote control module) of the vehicle through the CAN bus. These instructions may be triggered by the vehicle owner through the vehicle information center or sent by the remote control center through the remote control module. The upgrade instruction comprises key information such as a version number, a download address and the like of the upgrade package and is used for guiding the upgrade management module to carry out subsequent operation.
S2, downloading an upgrade package:
the upgrade management module is connected to the server through a communication network (such as a mobile data network or Wi-Fi) built in the vehicle according to the download address in the upgrade instruction. After verifying the identity and authority of the vehicle-mounted entertainment system, the server provides an upgrade package downloading link of a corresponding version. The upgrade management module downloads the upgrade package from the server and stores it in the temporary storage area for subsequent checksum write operations.
S3, checking an upgrade package:
And the upgrade management module performs integrity check on the downloaded upgrade package. This typically includes checking and verifying the integrity of the file, the matching of version numbers, the signature of the file, and so on. If the verification fails, the upgrade management module stops the upgrade process and prompts the owner to try to download again or contact the service center for support. If the verification is successful, the upgrade management module transmits the upgrade package to the embedded control unit.
S4, writing into a Flash memory:
And the embedded control unit writes the verified upgrade package into a target area appointed by the Flash memory. In the process, the data packets are transmitted in a blocking mode, written into the memory one by one, and the correctness and the integrity of each data packet block are ensured. In the writing process, the original vehicle-mounted entertainment system firmware is backed up so as to restore the system when the upgrade fails or rollback is needed. After the writing is completed, the upgrade management module updates the metadata of the Flash memory to reflect the new system software version and state.
S5, restarting and applying upgrade:
After the vehicle-mounted entertainment system is restarted, the processor reads new system software from the Flash memory and operates the new system software. This typically involves loading a new system file, initializing new configuration parameters, and executing the necessary startup procedure. During the restart process, the vehicle entertainment system also performs a series of self-checking and initialization operations to ensure the correctness and stability of the new system software. After the restart is completed, the vehicle-mounted entertainment system runs a new system software version and provides updated functions and performances.
Flash CAN communication defines the communication flow and state machine in the upgrading process to ensure the correct execution and sequential control of each step. The method comprises the steps of defining a transmission format of a data packet through a Flash CAN communication protocol, defining a transmission flow and a check and error processing mechanism, wherein the transmission format of the data packet comprises a data packet head, a data body, a check code and a data packet tail, the data packet head comprises a packet sequence number, a packet total number and a data packet type, the data body comprises firmware data, the check code is used for checking data integrity, the data packet tail marks the end of the data packet, the transmission flow comprises an initialization stage, a data transmission stage, a data receiving and checking stage, a writing into a Flash memory and a finishing stage, and the state machine controls and manages all stages of the transmission flow through the state machine, wherein the state machine comprises idle, transmitting, receiving and error processing states, and carries out state conversion according to the current state and event triggering conditions.
The error handling mechanism is that during the upgrade process, the upgrade management module monitors the data transmission status in real time, including the integrity, checksum, transmission rate, etc. Once the data transmission errors or anomalies are found, the upgrade management module immediately stops the upgrade process and prompts the vehicle owner to try again. This can avoid upgrade failure or system abnormality caused by data transmission errors. The upgrade management module may also record error logs and status information for use by the owner or service center in subsequent analysis and troubleshooting.
The security guarantee is that the upgrade management module adopts encryption technology to protect the data security of the upgrade package. In the downloading and writing process, the upgrade package is encrypted to prevent virus infection or data leakage. Encryption techniques include both symmetric encryption and asymmetric encryption. The symmetric encryption is used for encrypting the data content of the upgrade package, ensuring confidentiality of the data in the transmission and storage processes, and the asymmetric encryption is used for verifying the signature and the integrity of the upgrade package, and ensuring the authenticity and the reliability of the data. In addition, the upgrade management module also verifies the identity of the vehicle, so that only the vehicle passing the verification can receive and apply the upgrade package. This may be accomplished by a Vehicle Identification Number (VIN) or other unique identifier.
The backup and rollback mechanism refers to that in the upgrading process, the upgrade management module automatically backs up the original system software so as to restore the system when the upgrade fails or rollback is needed. The backup data is typically stored in another area of Flash memory, separate from the new system software, to avoid data conflicts and corruption. If the upgrade fails or the owner needs to roll back to the old version, the upgrade management module may use the backup data recovery system. This typically involves writing back the backup data to a designated area of Flash memory and restarting the in-vehicle entertainment system.
As described above, although the present invention has been shown and described with reference to certain preferred embodiments, it is not to be construed as limiting the invention itself. Various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.