NVM variable access method and device, storage medium and vehicle

By selecting a highly reliable secondary ECU to back up NVM variables in the vehicle, the problem of vehicle state recovery caused by NVM variable failure is solved, thereby improving the effectiveness and security of NVM variables.

CN119025338APending Publication Date: 2024-11-26ZERON AUTOMOBILE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411141662.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

The failure of NVM variables in the vehicle prevents it from returning to the state it was in when it was last shut down, affecting the normal operation of the vehicle.

Method used

Select a highly reliable secondary ECU from among the vehicle's multiple ECUs. Back up the NVM variables to the secondary ECU's NVM via in-vehicle bus communication. Read the NVM variables from the secondary ECU when the main ECU is powered on to ensure the validity and security of the data.

Benefits of technology

The effectiveness and safety of NVM variables have been improved, ensuring that the vehicle can return to its last closed state after the main ECU is powered off.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025338A_ABST
    Figure CN119025338A_ABST
Patent Text Reader

Abstract

The invention discloses an NVM variable access method and device, a storage medium and a vehicle, and belongs to the technical field of vehicles. The method comprises the steps that when a main ECU in the vehicle is powered off, an NVM variable stored in a non-volatile memory NVM of the main ECU is obtained; selecting n ECUs from the plurality of ECUs as auxiliary ECUs according to the reliability parameters, wherein n is greater than or equal to 1; each auxiliary ECU is awakened; the NVM variables are backed up to the NVM of each auxiliary ECU in an in-vehicle bus communication mode; when the main ECU is powered on again, the NVM variable is read from the NVM of the main ECU or the auxiliary ECU. According to the method, the NVM variable can be backed up through the multiple ECUs, and the effectiveness and safety of the NVM variable are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of vehicle technology, and more particularly to a method, device, storage medium and vehicle for accessing NVM variables. Background Art

[0002] In the vehicle's Electronic Control Unit (ECU), non-volatile memory (NVM) variables are used to store data that needs to remain unchanged after the system is powered off. For example, NVM variables are used to store user or manufacturer configurations in the ECU, maintain the system state so that it can be read the next time it is restarted, and save learned fitness values.

[0003] If the stored NVM variables fail, the vehicle will not be able to recover to the state when it was last shut down because it cannot read the NVM variables. Therefore, how to ensure that the stored NVM variables are valid is an urgent problem to be solved. Summary of the invention

[0004] The present application provides a method, device, storage medium and vehicle for accessing NVM variables, which are used to solve the problem that the stored NVM variables fail and the vehicle cannot be restored to the state when it was last shut down. The technical solution is as follows:

[0005] According to a first aspect of the present application, a method for accessing NVM variables is provided, which is used in a vehicle equipped with multiple ECUs, and the method comprises:

[0006] When a main ECU in the vehicle is powered off, obtaining NVM variables stored in a non-volatile memory NVM of the main ECU;

[0007] Select n ECUs from multiple ECUs as slave ECUs according to reliability parameters, where n≥1;

[0008] Wake up each slave ECU;

[0009] Backing up the NVM variables to the NVM of each slave ECU via in-vehicle bus communication;

[0010] When the main ECU is powered on again, the NVM variables are read from the NVM of the main ECU or the slave ECU.

[0011] In a possible implementation, the selecting n ECUs from a plurality of ECUs as slave ECUs according to the reliability parameter includes:

[0012] Acquire reliability parameters of each ECU, wherein the reliability parameters include at least one of a process verification (PV) result and a design verification (DV) result;

[0013] Rank the reliability of each ECU according to the reliability parameter;

[0014] The top n ECUs are selected as slave ECUs.

[0015] In a possible implementation, the method further includes:

[0016] Obtaining the importance of the NVM variable;

[0017] The number n of the sub-ECUs is calculated according to the importance, and the importance is positively correlated with n.

[0018] In a possible implementation, the method further includes:

[0019] For each of the master ECU and the n slave ECUs, generating a random seed according to the NVM variable, wherein the random seed corresponding to each ECU is different;

[0020] Performing a predetermined operation on the random seed to generate a checksum;

[0021] The random seed and the checksum are stored in the corresponding ECU.

[0022] In a possible implementation, the reading the NVM variable from the NVM of the master ECU or the slave ECU includes:

[0023] When the main ECU is powered on again, verifying the NVM of the main ECU;

[0024] If it is determined that the NVM of the master ECU is valid, reading the NVM variable from the NVM of the master ECU;

[0025] If it is determined that the NVM of the master ECU is invalid, the NVM variables are read from the NVM of the slave ECU.

[0026] In a possible implementation, the reading the NVM variable from the NVM of the slave ECU includes:

[0027] Select the slave ECU to wake up;

[0028] Detecting whether the slave ECU can communicate normally;

[0029] If the slave ECU can communicate normally, verify the NVM of the slave ECU;

[0030] If it is determined that the NVM of the slave ECU is valid, the NVM variable is read from the NVM of the slave ECU.

[0031] In a possible implementation, the verifying the NVM of the master ECU includes:

[0032] Reading a random seed and a checksum from the master ECU;

[0033] Performing a predetermined operation on the random seed to generate a checksum;

[0034] If the generated checksum is equal to the read checksum, determining that the NVM of the master ECU is valid;

[0035] If the generated checksum is not equal to the read checksum, it is determined that the NVM of the master ECU is invalid.

[0036] According to a second aspect of the present application, there is provided a device for accessing NVM variables, which is used in a vehicle equipped with multiple ECUs, and the device comprises:

[0037] An acquisition module, used for acquiring NVM variables stored in a non-volatile memory NVM of the main ECU when the main ECU in the vehicle is powered off;

[0038] A selection module, used for selecting n ECUs as slave ECUs from a plurality of ECUs according to reliability parameters, where n≥1;

[0039] Wake-up module, used to wake up each slave ECU;

[0040] A backup module, used for backing up the NVM variables to the NVM of each slave ECU through an in-vehicle bus communication method;

[0041] A reading module is used to read the NVM variable from the NVM of the main ECU or the slave ECU when the main ECU is powered on again.

[0042] According to a third aspect of the present application, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement the NVM variable access method as described above.

[0043] According to a fourth aspect of the present application, a vehicle is provided, comprising a storage device for accessing the above-mentioned NVM variables.

[0044] The beneficial effects of the technical solution provided by this application include at least:

[0045] When the main ECU in the vehicle is powered off, the NVM variables stored in the NVM of the main ECU are obtained; n ECUs are selected from multiple ECUs as slave ECUs according to reliability parameters; the NVM variables are backed up to the NVM of each slave ECU through the in-vehicle bus communication method; in this way, when the main ECU is powered on again, the NVM variables can be read from the NVM of the main ECU or the slave ECU, thereby backing up the NVM variables through multiple ECUs, thereby improving the effectiveness and safety of the NVM variables.

[0046] After the random seed and the checksum are stored in the ECU, the random seed and the checksum can be read from the ECU; a predetermined operation is performed on the random seed to generate a checksum; if the generated checksum is equal to the read checksum, it is determined that the NVM of the ECU is valid; if the generated checksum is not equal to the read checksum, it is determined that the NVM of the main ECU is invalid, thereby realizing the judgment of the validity of the NVM in the ECU. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0048] Figure 1 is a flow chart of a method for accessing NVM variables provided by one embodiment of the present application;

[0049] Figure 2 is a flow chart of a method for accessing NVM variables provided by one embodiment of the present application;

[0050] Figure 3 is a corresponding diagram of ECU, NVM variables and NVM provided by one embodiment of the present application;

[0051] Figure 4 It is a verification diagram of the validity of NVM provided by an embodiment of the present application;

[0052] Figure 5 It is a structural block diagram of an NVM variable access device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0054] like Figure 1As shown, it shows a method flow chart of a method for accessing NVM variables provided by an embodiment of the present application. The method for accessing NVM variables can be used in a vehicle equipped with multiple ECUs. The method for accessing NVM variables may include:

[0055] Step 101, when the main ECU in the vehicle is powered off, obtain the NVM variables stored in the NVM of the main ECU.

[0056] There are multiple ECUs in the vehicle. Each ECU generates multiple NVM variables after the vehicle is started and stores these NVM variables in its own NVM.

[0057] When the vehicle is turned off, all ECUs will be powered off. For each ECU, the NVM variables generated by it need to be backed up to at least one slave ECU before it is powered off, thereby improving the security and effectiveness of the NVM variables.

[0058] For each NVM variable, the ECU that generates the NVM variable is called the primary ECU, and the ECU that backs up the NVM variable is called the secondary ECU.

[0059] Step 102: Select n ECUs from a plurality of ECUs as slave ECUs according to reliability parameters, where n≥1.

[0060] Multiple ECUs are installed in different locations in the vehicle. For example, some ECUs are installed inside the vehicle, and some ECUs are installed outside the vehicle. The installation location of the ECU may affect the reliability of the ECU. For example, the ECU installed outside the vehicle will be exposed to high and low temperature environments and is prone to aging, resulting in poor reliability of the ECU. In order to improve the effectiveness of NVM variables, we can select a reliable slave ECU from multiple ECUs to back up the NVM variables.

[0061] The reliability of the ECU may be measured by a reliability parameter, which may be obtained based on test results or may be obtained by measurement, and is not limited in this embodiment.

[0062] Step 103, wake up each slave ECU.

[0063] The selected slave ECU may be in a dormant state, so it is necessary to wake up the slave ECU to perform data backup. This embodiment does not limit the way to wake up the slave ECU.

[0064] Step 104 , backing up the NVM variables to the NVM of each slave ECU via the in-vehicle bus communication method.

[0065] The main ECU and the slave ECU are both installed in the vehicle, and the NVM variables stored in the main ECU can be sent to each slave ECU through the in-vehicle bus communication method. After receiving the NVM variables, each slave ECU will store them in its own NVM to realize the backup of the NVM variables. Among them, there can be many in-vehicle bus communication methods, such as controller area network (Controller Area Network, CAN) communication, local interconnect network (Local interconnect Network, LIN) communication, etc., which are not limited in this embodiment. Of course, the NVM variables can also be backed up to the NVM of each slave ECU through Ethernet communication.

[0066] Step 105, when the main ECU is powered on again, the NVM variables are read from the NVM of the main ECU or the slave ECU.

[0067] When the vehicle is started again, all ECUs will be powered on again. At this time, it is necessary to read the NVM variables from the main ECU or the slave ECU and configure the vehicle according to the NVM variables to restore the vehicle to the state when it was last shut down.

[0068] Among them, when the NVM variables in the main ECU are valid, the NVM variables are read from the main ECU; when the NVM variables in the main ECU are invalid, the NVM variables are read from the slave ECU.

[0069] In summary, the NVM variable access method provided in the embodiment of the present application obtains the NVM variables stored in the NVM of the main ECU when the main ECU in the vehicle is powered off; selects n ECUs from multiple ECUs as slave ECUs according to reliability parameters; and backs up the NVM variables to the NVM of each slave ECU through the in-vehicle bus communication method; in this way, when the main ECU is powered on again, the NVM variables can be read from the NVM of the main ECU or the slave ECU, thereby backing up the NVM variables through multiple ECUs, thereby improving the effectiveness and security of the NVM variables.

[0070] After the random seed and the checksum are stored in the ECU, the random seed and the checksum can be read from the ECU; a predetermined operation is performed on the random seed to generate a checksum; if the generated checksum is equal to the read checksum, it is determined that the NVM of the ECU is valid; if the generated checksum is not equal to the read checksum, it is determined that the NVM of the main ECU is invalid, thereby realizing the judgment of the validity of the NVM in the ECU.

[0071] like Figure 2 As shown, it shows a flow chart of a method for accessing NVM variables provided by an embodiment of the present application, and the method for accessing NVM variables can be used in a vehicle equipped with multiple ECUs. The method for accessing NVM variables may include:

[0072] Step 201, when the main ECU in the vehicle is powered off, obtain the NVM variables stored in the NVM of the main ECU.

[0073] There are multiple ECUs in the vehicle. Each ECU generates multiple NVM variables after the vehicle is started and stores these NVM variables in its own NVM.

[0074] When the vehicle is turned off, all ECUs will be powered off. For each ECU, the NVM variables generated by it need to be backed up to at least one slave ECU before it is powered off, thereby improving the security and effectiveness of the NVM variables.

[0075] For each NVM variable, the ECU that generates the NVM variable is called the primary ECU, and the ECU that backs up the NVM variable is called the secondary ECU.

[0076] Step 202: select n ECUs from a plurality of ECUs as slave ECUs according to reliability parameters, where n≥1.

[0077] n may be a fixed value greater than or equal to 1. For example, n may be set to 1, or n may be set to 2, or n may be set to 3, and so on.

[0078] n can also be a non-fixed value determined according to the importance of the NVM variable. In this case, the importance of the NVM variable needs to be obtained; the number of sub-ECUs n is calculated according to the importance, and the importance is positively correlated with n. In other words, the higher the importance of the NVM variable, the larger the value of n; the lower the importance of the NVM variable, the smaller the value of n.

[0079] In this embodiment, a flag bit indicating the importance of each NVM variable may be set, and different importance levels may be represented by different characters. When the NVM variable needs to be backed up, the flag bit indicating the importance of the NVM variable may be read first, and then the value of n may be determined according to the value of the flag bit. Specifically, the value of n may be calculated according to the value of the flag bit, or a mapping relationship between the value of the flag bit and the value of n may be obtained, and the value of n corresponding to the value of the flag bit may be read from the mapping relationship.

[0080] After the value of n is determined, n ECUs need to be selected from multiple ECUs of the vehicle as slave ECUs. There are many specific selection methods, which are not limited in this embodiment.

[0081] Multiple ECUs are installed in different locations in the vehicle. For example, some ECUs are installed inside the vehicle, and some ECUs are installed outside the vehicle. The installation location of the ECU may affect the reliability of the ECU. For example, the ECU installed outside the vehicle will be exposed to high and low temperature environments and is prone to aging, resulting in poor reliability of the ECU. In order to improve the effectiveness of NVM variables, we can select a reliable slave ECU from multiple ECUs to back up the NVM variables.

[0082] The reliability of the ECU may be measured by a reliability parameter, which may be obtained based on test results, or may be obtained by measurement or calculation, which is not limited in this embodiment.

[0083] When the reliability parameters include at least one of the PV (Process Verification) results and the DV (Design Verification) results, the reliability parameters of each ECU can be obtained; the reliability of each ECU is sorted according to the reliability parameters; and the top n ECUs are selected as slave ECUs.

[0084] For example, ECU1 to 5 are installed in the vehicle. If ECU1 is the main ECU and two ECUs need to be selected as slave ECUs, ECU2 to 4 can be sorted according to the reliability parameter. If the sorting result is ECU2, ECU5, ECU4 and ECU3, ECU2 and ECU5 are selected as slave ECUs.

[0085] Step 203, wake up each slave ECU.

[0086] The selected slave ECU may be in a dormant state, so it is necessary to wake up the slave ECU to perform data backup. This embodiment does not limit the way to wake up the slave ECU.

[0087] Step 204 , backing up the NVM variables to the NVM of each slave ECU via the in-vehicle bus communication method.

[0088] The main ECU and the slave ECU are both installed in the vehicle, and the NVM variables stored in the main ECU can be sent to each slave ECU through the in-vehicle bus communication method. After receiving the NVM variables, each slave ECU will store them in its own NVM to realize the backup of the NVM variables. Among them, there can be many in-vehicle bus communication methods, such as CAN communication, LIN communication, etc., which are not limited in this embodiment. Of course, the NVM variables can also be backed up to the NVM of each slave ECU through Ethernet communication.

[0089] like Figure 3As shown, ECU1 includes NVM1, ECU2 includes NVM2, ECU3 includes NVM3, NVM variables include Var1 and Var2, Var1 is stored in NVM1, NVM2 and NVM3 respectively, and Var2 is stored in NVM1, NVM2 and NVM3 respectively.

[0090] After successfully backing up the NVM variables, it is also necessary to set a backup list in the master ECU, in which a mapping relationship between the NVM variables and the identifiers of the backed-up slave ECUs is stored.

[0091] After the NVM in the ECU is powered on again, some problems may occur, resulting in inaccurate NVM variables stored in the NVM. Therefore, the validity of the NVM needs to be verified. In this embodiment, specific data can be stored in the NVM before the ECU is powered off, and the specific data can be read from the NVM after the ECU is powered on again. The validity of the NVM is verified by comparing whether the specific data is the same.

[0092] Specifically, for the main ECU and each of the n slave ECUs, a random seed is generated according to the NVM variable, wherein the random seed corresponding to each ECU is different; a predetermined operation is performed on the random seed to generate a checksum; and the random seed and the checksum are stored in the corresponding ECU.

[0093] like Figure 4 As shown, when the ECU is awakened for the Nth time (that is, before the Nth power-off), the random seed Seed and the calculated checksum Checksum are stored in the ECU.

[0094] Step 205: When the main ECU is powered on again, the NVM of the main ECU is verified.

[0095] When the vehicle is started again, all ECUs will be powered on again. At this time, it is necessary to read the NVM variables from the main ECU or the slave ECU and configure the vehicle according to the NVM variables to restore the vehicle to the state when it was last shut down.

[0096] When the NVM variable in the main ECU is valid, the NVM variable is read from the main ECU; when the NVM variable in the main ECU is invalid, the NVM variable is read from the slave ECU. Whether the NVM variable is valid can be determined by verifying whether the NVM is valid.

[0097] Specifically, verifying the NVM of the main ECU may include: reading a random seed and a checksum from the main ECU; performing a predetermined operation on the random seed to generate a checksum; if the generated checksum is equal to the read checksum, determining that the NVM of the main ECU is valid; if the generated checksum is not equal to the read checksum, determining that the NVM of the main ECU is invalid.

[0098] like Figure 4 As shown, when the ECU is woken up for the N+1th time (that is, the N+1th power-on), the random seed Seed and the checksum Checksum are read, and the checksum Checksum is calculated based on the random seed Seed. If the calculated checksum Checksum is equal to the read checksum Checksum, the NVM is determined to be valid; if the calculated checksum Checksum is not equal to the read checksum Checksum, the NVM is determined to be invalid.

[0099] Step 206: If it is determined that the NVM of the master ECU is valid, then read the NVM variables from the NVM of the master ECU.

[0100] Step 207: If it is determined that the NVM of the master ECU is invalid, then read the NVM variables from the NVM of the slave ECU.

[0101] In this embodiment, n sub-ECUs can be determined by reading the identifier from the backup list, and the n sub-ECUs are polled according to the predetermined rules, that is, a sub-ECU is selected from the n sub-ECUs, and then the NVM variables are read from the NVM of the sub-ECU. If the NVM variables are read, the polling is stopped. Among them, the predetermined rules can be set according to the needs. For example, the predetermined rule is to select a sub-ECU with the highest reliability. Taking the reliability ranking results of sub-ECU2, sub-ECU5, sub-ECU4 and sub-ECU3 as an example, the NVM variables in sub-ECU2 are selected. For another example, the preset rule is to select a sub-ECU according to the risk sharing principle. Assuming that a sub-ECU is selected by hashing a random value, if the current vehicle speed is an odd number, it is preferred to read the NVM variables stored in sub-ECU1 and sub-ECU3. If the current vehicle speed is an even number, it is preferred to read the NVM variables stored in sub-ECU2 and sub-ECU4.

[0102] Then, it is necessary to select the slave ECU to wake up; detect whether the slave ECU can communicate normally; if the slave ECU can communicate normally, verify the NVM of the slave ECU; if it is determined that the NVM of the slave ECU is valid, read the NVM variables from the NVM of the slave ECU.

[0103] Specifically, the heartbeat mechanism can be used to detect whether the slave ECU can communicate normally; if the slave ECU can communicate normally, the validity of the NVM of the slave ECU is verified; if the slave ECU cannot communicate normally, the next slave ECU in the backup list is polled.

[0104] Among them, verifying the validity of the NVM of the slave ECU may include: reading a random seed and a checksum from the slave ECU; performing a predetermined operation on the random seed to generate a checksum; if the generated checksum is equal to the read checksum, determining that the NVM of the slave ECU is valid; if the generated checksum is not equal to the read checksum, determining that the NVM of the slave ECU is invalid.

[0105] Among them, the verification method of the slave ECU is the same as that of the main ECU, which will not be repeated here.

[0106] In summary, the NVM variable access method provided in the embodiment of the present application obtains the NVM variables stored in the NVM of the main ECU when the main ECU in the vehicle is powered off; selects n ECUs from multiple ECUs as slave ECUs according to reliability parameters; and backs up the NVM variables to the NVM of each slave ECU through the in-vehicle bus communication method; in this way, when the main ECU is powered on again, the NVM variables can be read from the NVM of the main ECU or the slave ECU, thereby backing up the NVM variables through multiple ECUs, thereby improving the effectiveness and security of the NVM variables.

[0107] After the random seed and the checksum are stored in the ECU, the random seed and the checksum can be read from the ECU; a predetermined operation is performed on the random seed to generate a checksum; if the generated checksum is equal to the read checksum, it is determined that the NVM of the ECU is valid; if the generated checksum is not equal to the read checksum, it is determined that the NVM of the main ECU is invalid, thereby realizing the judgment of the validity of the NVM in the ECU.

[0108] like Figure 5 As shown, it shows a structural block diagram of an NVM variable access device provided by an embodiment of the present application, and the NVM variable access device can be used in a vehicle equipped with multiple ECUs. The NVM variable access device may include:

[0109] An acquisition module 510, configured to acquire NVM variables stored in the NVM of the main ECU when the main ECU in the vehicle is powered off;

[0110] A selection module 520, configured to select n ECUs from a plurality of ECUs as slave ECUs according to a reliability parameter, where n≥1;

[0111] A wake-up module 530 is used to wake up each slave ECU;

[0112] A backup module 540 is used to back up the NVM variables to the NVM of each slave ECU through an in-vehicle bus communication method;

[0113] The reading module 550 is used to read the NVM variable from the NVM of the main ECU or the slave ECU when the main ECU is powered on again.

[0114] In an optional embodiment, the selection module 520 is further configured to:

[0115] Acquire reliability parameters of each ECU, wherein the reliability parameters include at least one of a process verification (PV) result and a design verification (DV) result;

[0116] Rank the reliability of each ECU according to the reliability parameter;

[0117] The top n ECUs are selected as slave ECUs.

[0118] In an optional embodiment, the selection module 520 is further configured to:

[0119] Obtaining the importance of the NVM variable;

[0120] The number n of the sub-ECUs is calculated according to the importance, and the importance is positively correlated with n.

[0121] In an optional embodiment, the device further includes a generating module, configured to:

[0122] For each of the master ECU and the n slave ECUs, generating a random seed according to the NVM variable, wherein the random seed corresponding to each ECU is different;

[0123] Performing a predetermined operation on the random seed to generate a checksum;

[0124] The random seed and the checksum are stored in the corresponding ECU.

[0125] In an optional embodiment, the reading module 550 is further configured to:

[0126] When the main ECU is powered on again, verifying the NVM of the main ECU;

[0127] If it is determined that the NVM of the master ECU is valid, reading the NVM variable from the NVM of the master ECU;

[0128] If it is determined that the NVM of the master ECU is invalid, the NVM variables are read from the NVM of the slave ECU.

[0129] In an optional embodiment, the reading module 550 is further configured to:

[0130] Select the slave ECU to wake up;

[0131] Detecting whether the slave ECU can communicate normally;

[0132] If the slave ECU can communicate normally, verify the NVM of the slave ECU;

[0133] If it is determined that the NVM of the slave ECU is valid, the NVM variable is read from the NVM of the slave ECU.

[0134] In an optional embodiment, the reading module 550 is further configured to:

[0135] Reading a random seed and a checksum from the master ECU;

[0136] Performing a predetermined operation on the random seed to generate a checksum;

[0137] If the generated checksum is equal to the read checksum, determining that the NVM of the master ECU is valid;

[0138] If the generated checksum is not equal to the read checksum, it is determined that the NVM of the master ECU is invalid.

[0139] To summarize, the NVM variable access device provided in the embodiment of the present application obtains the NVM variables stored in the NVM of the main ECU when the main ECU in the vehicle is powered off; selects n ECUs from multiple ECUs as slave ECUs according to reliability parameters; and backs up the NVM variables to the NVM of each slave ECU through the in-vehicle bus communication method; in this way, when the main ECU is powered on again, the NVM variables can be read from the NVM of the main ECU or the slave ECU, thereby backing up the NVM variables through multiple ECUs, thereby improving the effectiveness and security of the NVM variables.

[0140] After the random seed and the checksum are stored in the ECU, the random seed and the checksum can be read from the ECU; a predetermined operation is performed on the random seed to generate a checksum; if the generated checksum is equal to the read checksum, it is determined that the NVM of the ECU is valid; if the generated checksum is not equal to the read checksum, it is determined that the NVM of the main ECU is invalid, thereby realizing the judgment of the validity of the NVM in the ECU.

[0141] An embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the NVM variable access method as described above.

[0142] An embodiment of the present application provides a vehicle, comprising a storage device for accessing any of the above-mentioned NVM variables.

[0143] It should be noted that: the NVM variable access device provided in the above embodiment only uses the division of the above functional modules as an example when accessing NVM variables. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the NVM variable access device is divided into different functional modules to complete all or part of the functions described above. In addition, the NVM variable access device and the NVM variable access method embodiment provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0144] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0145] The above description is not intended to limit the embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the protection scope of the embodiments of the present application.

Claims

1. A method for accessing NVM variables, characterized in that: Used in a vehicle equipped with multiple electronic controllers ECU, the method comprises: When a main ECU in the vehicle is powered off, obtaining NVM variables stored in a non-volatile memory NVM of the main ECU; Select n ECUs from multiple ECUs as slave ECUs according to reliability parameters, where n≥1; Wake up each slave ECU; Backing up the NVM variables to the NVM of each slave ECU via in-vehicle bus communication; When the main ECU is powered on again, the NVM variables are read from the NVM of the main ECU or the slave ECU.

2. The method for accessing NVM variables according to claim 1, characterized in that: The step of selecting n ECUs from a plurality of ECUs as slave ECUs according to the reliability parameter comprises: Acquire reliability parameters of each ECU, wherein the reliability parameters include at least one of a process verification (PV) result and a design verification (DV) result; Rank the reliability of each ECU according to the reliability parameter; The top n ECUs are selected as slave ECUs.

3. The method for accessing NVM variables according to claim 1, characterized in that: The method further comprises: Obtaining the importance of the NVM variable; The number n of the sub-ECUs is calculated according to the importance, and the importance is positively correlated with n.

4. The method for accessing NVM variables according to claim 1, wherein: The method further comprises: For each of the master ECU and the n slave ECUs, generating a random seed according to the NVM variable, wherein the random seed corresponding to each ECU is different; Performing a predetermined operation on the random seed to generate a checksum; The random seed and the checksum are stored in the corresponding ECU.

5. The method for accessing NVM variables according to any one of claims 1 to 4, characterized in that: The step of reading the NVM variable from the NVM of the master ECU or the slave ECU includes: When the main ECU is powered on again, verifying the NVM of the main ECU; If it is determined that the NVM of the master ECU is valid, reading the NVM variable from the NVM of the master ECU; If it is determined that the NVM of the master ECU is invalid, the NVM variables are read from the NVM of the slave ECU.

6. The method for accessing NVM variables according to claim 5, characterized in that: The step of reading the NVM variable from the NVM of the slave ECU comprises: Select the slave ECU to wake up; Detecting whether the slave ECU can communicate normally; If the slave ECU can communicate normally, verify the NVM of the slave ECU; If it is determined that the NVM of the slave ECU is valid, the NVM variable is read from the NVM of the slave ECU.

7. The method for accessing NVM variables according to claim 5, characterized in that: The verifying of the NVM of the main ECU includes: Reading a random seed and a checksum from the master ECU; Performing a predetermined operation on the random seed to generate a checksum; If the generated checksum is equal to the read checksum, determining that the NVM of the master ECU is valid; If the generated checksum is not equal to the read checksum, it is determined that the NVM of the master ECU is invalid.

8. A device for accessing NVM variables, characterized in that: Used in a vehicle equipped with multiple electronic controllers ECU, the device comprises: An acquisition module, used for acquiring NVM variables stored in a non-volatile memory NVM of the main ECU when the main ECU in the vehicle is powered off; A selection module, used for selecting n ECUs as slave ECUs from a plurality of ECUs according to reliability parameters, where n≥1; Wake-up module, used to wake up each slave ECU; A backup module, used for backing up the NVM variables to the NVM of each slave ECU through an in-vehicle bus communication method; A reading module is used to read the NVM variable from the NVM of the main ECU or the slave ECU when the main ECU is powered on again.

9. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the NVM variable access method as described in any one of claims 1 to 7.

10. A vehicle, characterized in that: The vehicle comprises: a device for accessing the NVM variables as claimed in claim 8.