Data reading method and device, electronic equipment, chip and medium
By using the data reading function and exception handling mechanism that can verify data in the vehicle electronic control unit, the abnormal situation detection and processing problems during data reading are solved, ensuring the normal operation of the software and the stability of the system.
Patent Information
- Application Number
- CN202311512463.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2025-05-16
AI Technical Summary
The vehicle electronic control unit lacks detection and processing of abnormal situations when reading data, resulting in data reading errors, affecting the normal operation of the software and even causing system downtime.
Data is read through a data read function that can be verified, and hardware and/or software processing is performed for the generated data read errors, including reading a copy of the data, verification of redundant check codes, and execution of callback functions until the reading is successful.
Effectively handle data reading errors, ensure the normal operation of the software in the electronic control unit, and improve the stability of the electronic control unit.
Smart Images

Figure CN120011128A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of vehicle electronic embedded software, and in particular to a data reading method, device, electronic device, chip and medium. Background Art
[0002] In the related art, when the vehicle's electronic control unit (ECU) stores data, it lacks the ability to handle abnormal situations, such as hardware failure, which results in data being unable to be read, or bit jumps in the flash memory, which causes the read data to be inconsistent with expectations.
[0003] In some existing data storage design schemes, the lack of checks for hardware errors such as data jumps will result in reading erroneous data. When the software runs with the erroneous data, it will produce erroneous program execution results. In severe cases, it may even affect the normal operation of the software and even cause the system to crash. Summary of the invention
[0004] The present disclosure provides a data reading method, device, electronic device, chip and medium to solve the problem of lack of abnormal situation detection and abnormal processing when the electronic control unit of a vehicle reads data. Data is read through a data reading function that can verify data, and the generated data reading error is processed by hardware and / or software to read data normally, thereby ensuring the normal operation of the software in the electronic control unit.
[0005] A first aspect of the present disclosure provides a data reading method, which is executed by an electronic control unit of a vehicle. The method includes:
[0006] Obtaining a first read error generated by reading first data using a first read function, where the first data includes a data identification code, a data body, and a redundancy check code;
[0007] In response to the first read error, reading is performed through a read mechanism until the read is successful, and the read mechanism includes at least one of the following: reading a first copy of the first data in the first storage space, reading a second copy of the first data in the second storage space, and executing a callback function of the first read function to perform reading.
[0008] In one embodiment of the present disclosure, in response to a first read error, reading is performed by a read mechanism until the reading is successful, including:
[0009] If at least two of the reading mechanisms are used to read data, the reading mechanisms are executed in descending order according to the priority of the reading mechanisms, wherein the priorities of reading the first copy of the first data in the first storage space, reading the second copy of the first data in the second storage space, and executing the callback function of the first reading function for reading decrease in sequence.
[0010] In one embodiment of the present disclosure, obtaining a first read error generated by reading first data with a first read function includes:
[0011] Verifying the identification code of the first reading function and the data identification code of the first data;
[0012] re-determining a redundant check code of the first data based on the data body of the first data;
[0013] verifying the redundant check code of the first data and the redundant check code copy in the first storage space;
[0014] If the data identification code of the first data and / or the redundancy check code of the first data fails to be verified, a first read error is generated.
[0015] In one embodiment of the present disclosure, before obtaining a first read error generated by reading the first data using the first read function, the method further includes:
[0016] Generate a data identification code for the data body;
[0017] Generate a data redundancy check code for the data body through a cyclic redundancy check algorithm;
[0018] The data identification code, data body and data redundancy check code of the data body are written into the storage space.
[0019] In one embodiment of the present disclosure, writing a data identification code data body and a data redundancy check code of a data body into a storage space includes:
[0020] Writing the data identification code of the data body, the data body and the data redundancy check code into the first storage space as a first copy of the first data;
[0021] The data identification code, the data body and the data redundancy check code of the data body are written into the second storage space as a second copy of the first data, and the writing priority of the second copy is lower than that of the first copy.
[0022] A second aspect of the present disclosure provides a data reading device, the device comprising:
[0023] An error acquisition module, used for acquiring a first read error generated by a first read function reading first data, where the first data includes a data identification code, a data body and a redundancy check code;
[0024] A reading module is used to respond to a first reading error and perform reading through a reading mechanism until the reading is successful. The reading mechanism includes at least one of the following: reading a first copy of the first data in a first storage space, reading a second copy of the first data in a second storage space, and executing a callback function of a first reading function to perform reading.
[0025] The third aspect embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the methods in the first aspect embodiment of the present disclosure.
[0026] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, characterized in that the computer instructions are used to enable a computer to execute the method in the first aspect embodiment of the present disclosure.
[0027] The fifth aspect embodiment of the present disclosure proposes a computer program product, characterized in that it includes a computer program, and the computer program implements any method in the first aspect embodiment of the present disclosure when executed by a processor.
[0028] The sixth aspect embodiment of the present disclosure proposes a chip, comprising at least one processor and a communication interface; the communication interface is used to receive signals input into the chip or signals output from the chip, the processor communicates with the communication interface and implements any one of the methods in the first aspect embodiment of the present disclosure through logic circuits or execution code instructions.
[0029] In summary, according to the data reading method proposed in the present disclosure, the first reading error generated by the first reading function reading the first data is obtained, the first data includes a data identification code, a data body and a redundant check code, and the data reading error is checked and verified, providing a trigger condition for error handling; in response to the first reading error, reading is performed through a reading mechanism until the reading is successful, and the reading mechanism includes at least one of the following: reading the first copy of the first data in the first storage space, reading the second copy of the first data in the second storage space, and executing the callback function of the first reading function for reading, providing exception handling when data reading errors occur, avoiding the problem of affecting the normal operation of the software due to reading erroneous data, and even causing the system to crash. The normal operation of the software in the electronic control unit of the vehicle is guaranteed, and the stability of the electronic control unit is improved.
[0030] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0032] Figure 1 is a flow chart of a data reading method according to an embodiment of the present disclosure;
[0033] Figure 2 is a flow chart of a data reading method according to an embodiment of the present disclosure;
[0034] Figure 3 A flowchart of obtaining a first read error generated by reading first data with a first read function according to an embodiment of the present disclosure;
[0035] Figure 4 A flowchart of obtaining first data written before a first read error generated by a first read function reading first data according to an embodiment of the present disclosure;
[0036] Figure 5 It is a flow chart of writing a data identification code data body and a data redundancy check code of a data body into a storage space according to an embodiment of the present disclosure;
[0037] Figure 6 A schematic diagram of NvM Block data structure according to an embodiment of the present disclosure;
[0038] Figure 7 is a flow chart of a data reading method of this embodiment;
[0039] Figure 8 It is a structural schematic diagram of a data reading device according to an embodiment of the present disclosure;
[0040] Fig. 9 is a block diagram of an electronic device for implementing the data reading method disclosed in the present invention according to an exemplary embodiment;
[0041] Fig.10 It is a schematic diagram showing the structure of a chip for implementing the data reading method of the present disclosure according to an exemplary embodiment. DETAILED DESCRIPTION
[0042] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout identify the same or similar originals or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0043] In the field of vehicle electronic embedded software, AUTomotive Open System ARchitecture (AUTOSAR) is an alliance dedicated to developing automotive electronic software standards (participants include global automakers, parts suppliers, and various research and service organizations). Founded in 2003, they have developed a set of open frameworks and industry standards specifically for automobiles, which will be used as the basic infrastructure for managing functions in future applications and standard software modules. In particular, software interfaces, exchange formats, and methodologies have been standardized.
[0044] In the AUTOSAR architecture, the Non-Volatile RAM Manager (NVRAMManager) module is responsible for reading and writing non-volatile memory and managing non-volatile data. It is the core component of the AUTOSAR storage service layer and is responsible for organizing the ECU's persistent data storage facilities in a separately manageable unit called a "Non-Volatile Memory (NvM) block".
[0045] NvM is located in the service layer of the basic software and is used for initialization, reading, writing, and control of all NvM data. It provides various synchronous / asynchronous services for the maintenance and management of NvM.
[0046] The present disclosure aims to solve the problem of lack of abnormal situation detection and abnormal processing when the electronic control unit of the vehicle reads data, so that the data reading in the electronic control unit can run stably. In some existing data storage design schemes, the lack of checking for hardware errors such as data jumps will lead to reading wrong data, and when the software runs with the wrong data, it will produce wrong program execution results, which may even affect the normal operation of the software and cause the system to crash.
[0047] The method proposed in the present disclosure is applied to the electronic control unit of a vehicle, and its application has a wide range of scenarios, and can be widely used in the fields of vehicle driving, vehicle assisted driving, unmanned driving, stability evaluation of the vehicle electronic control unit, etc. The application scenarios are not limited in the embodiments of the present disclosure.
[0048] The data reading method provided by the present application is described in detail below with reference to the accompanying drawings.
[0049] Figure 1 FIG. 1 is a flow chart of a data reading method according to an embodiment of the present disclosure. Figure 1 In the embodiment shown, the data reading method includes:
[0050] Step 101 : obtaining a first read error generated by reading first data with a first read function, where the first data includes a data identification code, a data body, and a redundancy check code.
[0051] In this embodiment, the first data is NvM block data, including three parts: block header (Block Header), block data (Block Data) and block cyclic redundancy check code (Block Cycle Redundancy Check, Block CRC). Among them, the Block Header stores the block number (Block ID) for a data identification code that uniquely identifies the current NvM block. The Block Data stores the data stored in the NvM block of the Block ID, and the data can be any form of data as the data content stored in the NvM block. Block CRC is a cyclic redundancy check code (Cycle Redundancy Check, CRC) calculated based on the data body to be stored. In the present disclosure, this CRC is referred to as a redundancy check code. The first read function is a function for reading the first data, and the first read error is an error caused by the first read function in the process of reading the first data.
[0052] Step 102, in response to a first read error, reading is performed through a reading mechanism until the reading is successful, the reading mechanism comprising at least one of: reading a first copy of the first data in a first storage space, reading a second copy of the first data in a second storage space, and executing a callback function of a first read function to perform reading.
[0053] In this embodiment, the reading mechanism is a data reading measure taken in order to successfully read the data when an error or anomaly occurs in the data reading. The reading mechanism is at least one of the following three mechanisms, wherein Mechanism 1: Reading the first copy of the first data in the first storage space, that is, reading a copy of the first data in the first storage space that is different from the storage area of the first data. For example, the first data is one or more NvM Blocks in Flash, and the first copy of the first data is a backup data of the NvM Block in Flash. Mechanism 2: Reading the second copy of the first data in the second storage space, that is, reading the backup data of the first data in the second storage space that is different from the first storage space. For example, the second storage space is a read-only memory (ROM), in which a default value of the first data is stored. When a read error occurs, the default value is read from the ROM for use. Mechanism 3: Executing the callback function of the first read function for reading. In other words, when an error occurs in reading the first data, the reading of the first data is realized through the callback function of the first read function. For example, in the callback function, the first data can be replaced by the value of other variables through custom logic, thereby completing the reading of the first data. The above three mechanisms can be used alone or in combination to read the first data.
[0054] In this embodiment, the copy of the first data is data having the same data content as the first data but having a different storage address. The callback function of the first read function is used to pass the first read function as a parameter to another function, and when the other function is executed, the first read function is executed. By reading the copy of the first data, the data read error is processed at the hardware level, and by the callback function of the first read function, the data read error is processed at the software level. These two processing methods can complete the processing of the data read error separately, or they can be combined to complete the processing of the data read error.
[0055] In summary, according to the data reading method proposed in the present invention, a first read error generated by a first read function reading first data is obtained, the first data includes a data identification code, a data body and a redundant check code, the data read error is checked and verified, and the data read error is detected, providing a trigger condition for error handling; in response to the first read error, reading is performed through a reading mechanism until the reading is successful, and the reading mechanism includes at least one of the following: reading a first copy of the first data in a first storage space, reading a second copy of the first data in a second storage space, and executing a callback function of the first read function for reading, which provides exception handling when data reading errors occur, ensures the normal operation of the software in the electronic control unit of the vehicle, and improves the stability of the electronic control unit.
[0056] Figure 2 FIG. 1 is a flow chart of a data reading method according to an embodiment of the present disclosure. Figure 2 In the embodiment shown, the data reading method includes:
[0057] Step 201, if at least two of the reading mechanisms are used to read data, the reading mechanisms are executed in descending order according to the priority of the reading mechanisms, wherein the priorities of reading the first copy of the first data in the first storage space, reading the second copy of the first data in the second storage space, and executing the callback function of the first reading function for reading are decreased in sequence.
[0058] In this embodiment, if two or more reading mechanisms are used to read data, the reading mechanisms are executed in descending order according to the priority of each mechanism in the reading mechanisms used. With respect to the priority of the reading mechanism, the priority of reading the first copy of the first data in the first storage space is the highest, the priority of reading the second copy of the first data in the second storage space is in the middle, and the priority of executing the callback function of the first reading function for reading is the lowest. That is, when multiple reading mechanisms exist, the backup data stored in the hardware is first run to complete the reading of the data. When multiple reading mechanisms exist and a software-level reading process is required, the software-level reading process is finally executed to complete the reading of the data.
[0059] In this embodiment, combined with Figure 1 Mechanisms 1, 2, and 3 in step 102 illustrate the reading priority, and the reading order of each situation is executed from front to back, and there are 7 reading situations in total.
[0060] Scenario 1: Mechanism 1.
[0061] Scenario 2: Mechanism 2.
[0062] Scenario 3: Mechanism 3.
[0063] Scenario 4: Mechanism 1, Mechanism 2.
[0064] Scenario 5: Mechanism 1, Mechanism 3.
[0065] Scenario 6: Mechanism 2, Mechanism 3.
[0066] Scenario 7: Mechanism 1, Mechanism 2, Mechanism 3.
[0067] When an error occurs in data reading, the electronic control unit of the vehicle uses any one of the above 7 situations to read the data. The data identification code and the redundant check code involved in the detection of the reading error of the first data are executed Figure 2 The embodiments previously require pre-written data.
[0068] Figure 3The present invention is a flowchart of obtaining a first read error generated by reading first data with a first read function according to an embodiment of the present invention. Figure 3 Yes Figure 1 Further explanation of step 101 is based on Figure 3 The embodiment shown comprises the following steps:
[0069] Step 301 : verifying an identification code of a first reading function and a data identification code of first data.
[0070] In this embodiment, the identification code of the first read function is the identification of the function dedicated to reading the first data, and the identification code of the first data is the Block ID saved in the Block Header of the current NvM block. It is checked whether the BlockID of the first data is the same as the identification code of the first read function dedicated to reading the first data. If they are the same, it means that the identification of the current read function is consistent with that of the read data. If they are consistent, the check succeeds and the operation of checking whether the CRC is consistent can continue. Otherwise, it means that the current read function is not a function for reading the first data, the check fails, and a data reading error is caused.
[0071] Step 302: re-determine the redundancy check code of the first data based on the data body of the first data.
[0072] In this embodiment, the redundancy check code of the data body of the first data is recalculated as the redundancy check code of the first data, wherein the redundancy check code of the data body of the first data can be calculated by any one of CRC8, CRC16, and CRC32 algorithms to obtain a CRC redundancy check code.
[0073] Step 303: verify the redundant check code of the first data and the redundant check code copy in the first storage space.
[0074] In this embodiment, the first storage space is a storage space different from the first data storage area, such as a flash memory (Flash), in which a copy of the redundant check code of the data body of the first data is stored. The redundant check code copy is data that is completely identical to the CRC content of the first data, and is actually backup data of the redundant check code generated according to the first data. Check whether the redundant check code of the first data is consistent with the redundant check code copy in the first storage space. If they are consistent, the check passes, indicating that the redundant check code copy in the first storage space is an accurate backup data of the redundant check code of the first data. If they are inconsistent, an error occurs in reading the first data.
[0075] Step 304: If the data identification code of the first data and / or the redundancy check code of the first data fails to be checked, a first read error is generated.
[0076] In this embodiment, if any one of the failure types of checking the data identification code of the first data and the failure type of checking the redundant check code of the first data is detected, or if both types of check failures are detected, a first read error is generated, indicating that an error occurs in the first read function when reading the first data, and the error is taken as the first read error.
[0077] In this embodiment, by checking whether the first reading function matches the first data to be read, and checking the redundant check code of the data body of the recalculated first data, it is detected whether a reading error occurs in the first data. When an error occurs, the data where the reading error occurs is further recorded, thereby completing the detection and capture of the data reading error. This provides preparation for the processing of data reading errors. The data identification code and redundant check code involved in the detection of the reading error of the first data are used to perform Figure 3 The embodiments previously require pre-written data.
[0078] Figure 4 The present invention provides a flowchart of obtaining the writing of first data before a first read error generated by reading first data by a first read function according to an embodiment of the present invention. Figure 4 Yes Figure 1 The specific instructions before step 101 are based on Figure 3 The embodiment shown comprises the following steps:
[0079] Step 401: Generate a data identification code for a data body.
[0080] In this embodiment, the data body is the data content to be processed into the form of NvM Block, and a data identification code Block ID is generated based on the data body, and the Block ID is stored in the Block Header of the NvM Block. Optionally, the generation sequence is used as the data identification code of the NvM Block.
[0081] Step 402: Generate a data redundancy check code for the data body using a cyclic redundancy check algorithm.
[0082] In this embodiment, a data redundancy check code of the data body is generated by a cyclic redundancy check algorithm, such as a check code generation algorithm such as CRC8, CRC16, CRC32, etc.
[0083] Step 403: write the data identification code, the data body and the data redundancy check code of the data body into the storage space.
[0084] In this embodiment, the data identification code of the data body, the data body itself, and the redundant check code of the data body are written into the storage space as a whole NvM Block. For example, the data identification code, the data body, and the redundant check code are three variables in a structure data, which are saved in Flash. The write storage space backs up and saves the data in different storage spaces.
[0085] Figure 5 The present invention is a flowchart of writing a data identification code data body and a data redundancy check code of a data body into a storage space according to an embodiment of the present invention. Figure 5 Yes Figure 4 Step 403 is specifically described based on Figure 5 The embodiment shown comprises the following steps:
[0086] Step 501: write a data identification code, a data body and a data redundancy check code of a data body into a first storage space as a first copy of first data.
[0087] In this embodiment, preferably, the first storage space is Flash. The first data is composed of a data identification code of a data body, the data body itself, and a data redundancy check code. In the first storage space, the NvM Block composed of the data identification code of the data body, the data body, and the data redundancy check code, that is, the first data is written and saved as a first copy of the first data.
[0088] Step 502: write the data identification code, the data body and the data redundancy check code of the data body into the second storage space as a second copy of the first data, and the writing priority of the second copy is lower than that of the first copy.
[0089] In this embodiment, preferably, the second storage space is ROM. A NvM Block data backup is made in the ROM for the first data, and the data backup is used as the second copy of the first data. Compared with the first copy in the first storage space of the first data, the writing priority of the second copy is lower than that of the first copy. That is, after the first data is generated, when the data is backed up, the backup is written in the first storage space first, and then the backup is written in the second storage space. Thus, there are multiple backup data to provide more reliable data recovery when a read error occurs, so as to correctly read the data.
[0090] Figure 6 FIG. 1 is a schematic diagram of an NvM Block data structure according to an embodiment of the present disclosure. Figure 6In the illustrated embodiment, the NvM module constructs an NvM Block logical object for data storage, wherein the block header (Block Header) stores the block number (Block ID), and each NvM Block is uniquely identified by the Block ID; the block data (Block Data) stores the data to be stored; the block cyclic redundancy check code (Block CRC) is the CRC calculated based on the stored data, and CRC8, CRC16 or CRC32 can be selected through configuration. When performing a write operation, the NvM module stores the contents of the entire NvM Block in the Flash. When performing a read operation, all the contents of the entire NvM Block are read out at once. The NvM module verifies the Block Header and Block CRC. The Block ID in the Block Header should be consistent with the Block ID that initiated the read request. The read Block Data will recalculate the CRC and compare it with the Block CRC read in the Flash. Only when the Block ID and CRC checks are consistent can the data read this time be considered correct.
[0091] Figure 7 The flowchart of a data reading method of an embodiment of the present disclosure is shown. In this embodiment, when a data reading error occurs in the ECU of a vehicle, it is checked whether the NvM Block currently being read is configured with a redundant block. If the redundant block is not configured, it is further checked whether the ROM block is configured. If the redundant block has been configured for the NvM Block, another block, that is, the redundant block of the NvMBlock, is read to check whether the redundant block can be successfully read. If the redundant block is successfully read, the reading operation is completed. If the redundant block cannot be successfully read, it is further checked whether the ROM block is configured. If the ROM block has been configured for the NvM Block, the Block block data is read from the ROM to restore the data reading. It is determined whether the data is successfully read from the ROM. If the reading is successful, the reading operation is completed. If the data is not successfully read from the ROM, it is determined whether a callback function is configured. If the ROM block is not configured for the NvM Block, it is further determined whether the callback function is configured. If the callback function is not configured for the NvM Block, the reading operation is completed. If the callback function is configured for the NvM Block, the data is recovered from the callback function, thereby completing the data reading operation.
[0092] Above Figures 1 to 7 The illustrated embodiments can be implemented individually or in combination.
[0093] Through the data reading method provided by the embodiment of the present disclosure, a first read error generated by a first read function reading first data is obtained, the first data includes a data identification code, a data body and a redundant check code, the data read error is checked and verified, and a trigger condition is provided for error handling; in response to the first read error, reading is performed through a reading mechanism until the reading is successful, and the reading mechanism includes at least one of the following: reading a first copy of the first data in a first storage space, reading a second copy of the first data in a second storage space, and executing a callback function of the first read function for reading, which provides exception handling when data reading errors occur, ensures the normal operation of the software in the electronic control unit of the vehicle, and improves the stability of the electronic control unit.
[0094] Corresponding to the methods provided in the above-mentioned embodiments, the present disclosure also provides a data reading device. Since the device provided in the embodiment of the present disclosure corresponds to the methods provided in the above-mentioned embodiments, the implementation method of the method is also applicable to the device provided in this embodiment and will not be described in detail in this embodiment.
[0095] Figure 8 FIG. 8 is a schematic diagram of the structure of a data reading device 800 according to an embodiment of the present disclosure. Figure 8 As shown, the data reading device comprises:
[0096] An error acquisition module 810 is used to acquire a first read error generated by a first read function reading first data, where the first data includes a data identification code, a data body, and a redundancy check code;
[0097] The reading module 820 is used to respond to the first reading error and perform reading through a reading mechanism until the reading is successful. The reading mechanism includes at least one of the following: reading the first copy of the first data in the first storage space, reading the second copy of the first data in the second storage space, and executing a callback function of the first reading function to perform reading.
[0098] In some embodiments, the reading module 820 is used to:
[0099] If at least two of the reading mechanisms are used to read data, the reading mechanisms are executed in descending order according to the priority of the reading mechanisms, wherein the priorities of reading the first copy of the first data in the first storage space, reading the second copy of the first data in the second storage space, and executing the callback function of the first reading function for reading decrease in sequence.
[0100] In some embodiments, the error acquisition module 810 is used to:
[0101] Verifying the identification code of the first reading function and the data identification code of the first data;
[0102] re-determining a redundant check code of the first data based on the data body of the first data;
[0103] Verifying the redundant check code of the first data and the redundant check code copy in the first storage space;
[0104] If the data identification code of the first data and / or the redundancy check code of the first data fails to be checked, a first read error is generated.
[0105] In some embodiments, before obtaining a first read error generated by reading the first data using the first read function, the error acquisition module 810 is configured to:
[0106] Generate a data identification code for the data body;
[0107] Generate a data redundancy check code for the data body through a cyclic redundancy check algorithm;
[0108] The data identification code, data body and data redundancy check code of the data body are written into the storage space.
[0109] In some embodiments, the error acquisition module 810 writes the data identification code, the data body, and the data redundancy check code of the data body into the storage space in the following manner:
[0110] Writing the data identification code of the data body, the data body and the data redundancy check code into the first storage space as a first copy of the first data;
[0111] The data identification code, the data body and the data redundancy check code of the data body are written into the second storage space as a second copy of the first data, and the writing priority of the second copy is lower than that of the first copy.
[0112] In summary, through the data reading device, the first reading error generated by the first reading function reading the first data is obtained, and the first data includes a data identification code, a data body and a redundant check code; in response to the first reading error, reading is performed through the reading mechanism until the reading is successful, and the reading mechanism includes at least one of the following: reading the first copy of the first data in the first storage space, reading the second copy of the first data in the second storage space, and executing the callback function of the first reading function for reading. This device solves the problem of the lack of abnormal situation detection and handling when the electronic control unit of the vehicle reads data, ensures the normal operation of the software, and improves the stability of the electronic control unit.
[0113] In the embodiments provided in the present application, the methods and devices provided in the embodiments of the present application are introduced. In order to implement the functions in the methods provided in the embodiments of the present application, the electronic device may include a hardware structure and a software module, and implement the functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. A function of the functions may be executed in the form of a hardware structure, a software module, or a hardware structure plus a software module.
[0114] Fig. 9 is a block diagram of an electronic device 900 for implementing the above data reading method according to an exemplary embodiment.
[0115] For example, the electronic device 900 may be a mobile phone, a computer, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0116] Reference Fig. 9 , the electronic device 900 may include one or more of the following components: a processing component 902 , a memory 904 , a power component 906 , a multimedia component 908 , an audio component 910 , an input / output (I / O) interface 912 , a sensor component 914 , and a communication component 916 .
[0117] The processing component 902 generally controls the overall operation of the electronic device 900, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 902 may include one or more modules to facilitate the interaction between the processing component 902 and other components. For example, the processing component 902 may include a multimedia module to facilitate the interaction between the multimedia component 908 and the processing component 902.
[0118] The memory 904 is configured to store various types of data to support operations on the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 900, contact data, phone book data, messages, pictures, videos, etc. The memory 904 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0119] The power supply component 906 provides power to the various components of the electronic device 900. The power supply component 906 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 900.
[0120] The multimedia component 908 includes a screen that provides an output interface between the electronic device 900 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 908 includes a front camera and / or a rear camera. When the electronic device 900 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0121] The audio component 910 is configured to output and / or input audio signals. For example, the audio component 910 includes a microphone (MIC), and when the electronic device 900 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 904 or sent via the communication component 916. In some embodiments, the audio component 910 also includes a speaker for outputting audio signals.
[0122] I / O interface 912 provides an interface between processing component 902 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0123] The sensor assembly 914 includes one or more sensors for providing various aspects of status assessment for the electronic device 900. For example, the sensor assembly 914 can detect the open / closed state of the electronic device 900, the relative positioning of components, such as the display and keypad of the electronic device 900, and the sensor assembly 914 can also detect the position change of the electronic device 900 or a component of the electronic device 900, the presence or absence of user contact with the electronic device 900, the orientation or acceleration / deceleration of the electronic device 900, and the temperature change of the electronic device 900. The sensor assembly 914 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 914 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 914 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0124] The communication component 916 is configured to facilitate wired or wireless communication between the electronic device 900 and other devices. The electronic device 900 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio) or a combination thereof. In an exemplary embodiment, the communication component 916 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 916 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0125] In an exemplary embodiment, the electronic device 900 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0126] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 904 including instructions, and the instructions can be executed by the processor 920 of the electronic device 900 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0127] The embodiments of the present disclosure further provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the data reading method described in the above embodiments of the present disclosure.
[0128] An embodiment of the present disclosure further provides a computer program product, including a computer program, and the computer program executes the data reading method described in the above embodiment of the present disclosure when a processor is used.
[0129] Fig.10 is a schematic structural diagram of a chip 1000 for implementing the above data reading method according to an exemplary embodiment.
[0130] Reference Fig.10 The chip 1000 includes at least one communication interface 1001 and a processor 1002; the communication interface 1001 is used to receive a signal input to the chip 1000 or a signal output from the chip 1000, and the processor 1002 communicates with the communication interface 1001 and implements the data reading method described in the above embodiment through a logic circuit or executing code instructions.
[0131] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0132] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0133] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.
[0134] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.
[0135] It should be understood that the various parts of the embodiments of the present disclosure can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0136] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0137] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0138] Although the embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present disclosure. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present disclosure.
Claims
1. A data reading method, characterized in that: The method comprises: Obtaining a first read error generated by reading first data using a first read function, wherein the first data includes a data identification code, a data body, and a redundancy check code; In response to the first read error, reading is performed through a reading mechanism until the reading is successful, and the reading mechanism includes at least one of the following: reading a first copy of the first data in a first storage space, reading a second copy of the first data in a second storage space, and executing a callback function of the first read function to perform reading.
2. The method according to claim 1, characterized in that In response to the first read error, performing reading by a read mechanism until the reading is successful, comprises: If at least two of the reading mechanisms are used to read data, the reading mechanisms are executed in descending order according to the priorities of the reading mechanisms, wherein the priorities of reading the first copy of the first data in the first storage space, reading the second copy of the first data in the second storage space, and executing the callback function of the first reading function decrease in sequence.
3. The method according to claim 1, characterized in that The obtaining a first read error generated by reading the first data using the first read function includes: verifying the identification code of the first reading function and the data identification code of the first data; re-determining a redundant check code of the first data based on the data body of the first data; verifying the redundant check code of the first data and the redundant check code copy in the first storage space; If the data identification code of the first data and / or the redundant check code of the first data fails to be verified, the first read error is generated.
4. The method according to claim 1, characterized in that Before obtaining a first read error generated by reading the first data using the first read function, the method further includes: generating the data identification code of the data body; Generate the data redundancy check code of the data body by a cyclic redundancy check algorithm; The data identification code of the data body, the data body and the data redundancy check code are written into a storage space.
5. The method according to claim 4, characterized in that Writing the data identification code of the data body, the data body and the data redundancy check code into the storage space comprises: writing the data identification code of the data body, the data body, and the data redundancy check code into the first storage space as the first copy of the first data; The data identification code of the data body, the data body and the data redundancy check code are written into the second storage space as the second copy of the first data, and the writing priority of the second copy is lower than that of the first copy.
6. A data reading device, characterized in that: The device comprises: An error acquisition module, used for acquiring a first read error generated by a first read function reading first data, wherein the first data includes a data identification code, a data body and a redundancy check code; A reading module is used to respond to the first read error and perform reading through a reading mechanism until the reading is successful. The reading mechanism includes at least one of the following: reading a first copy of the first data in a first storage space, reading a second copy of the first data in a second storage space, and executing a callback function of the first read function to perform reading.
7. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5.
9. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 5.
10. A chip, characterized in that: It includes at least one processor and a communication interface; the communication interface is used to receive a signal input to the chip or a signal output from the chip, and the processor communicates with the communication interface and implements the method according to any one of claims 1-5 through a logic circuit or executing code instructions.