Diagnostic data dump method and device, equipment and medium
By storing the diagnostic data of the fault event into the event buffer in the AUTOSAR architecture and writing it to the nonvolatile memory when needed, the problem of low diagnostic data dump performance in the prior art is solved, and a more efficient data writing operation is achieved.
Patent Information
- Application Number
- CN202311227278.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-21
- Publication Date
- 2025-03-21
AI Technical Summary
Diagnostic data dump schemes in the existing AUTOSAR architecture require frequent large amounts of data writing operations, resulting in poor dump performance.
By storing diagnostic data for a single failure event into the target buffer in the event buffer array, and when a dump indication signal is heard, the data in the target buffer is written to the corresponding target memory block in nonvolatile memory.
Reduces write operations when dumping diagnostic data and improves dumping performance of diagnostic data.
Smart Images

Figure CN119669111A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data storage, and in particular to a diagnostic data dump method, device, equipment and medium. Background Art
[0002] In the diagnostic event processing process based on the Automotive Open System Architecture (AUTOSAR), after the Diagnostic Event Manager (DEM) determines a diagnostic event as a fault event, the diagnostic data of the fault event will be dumped into the Non-Volatile RAM Manager (NVM) for non-volatile storage.
[0003] The diagnostic data of a fault event usually includes the fault event information of the fault event (that is, the annotation information of the diagnostic event itself, usually represented by a diagnostic trouble code (DTC), the extended data (DTC Extended Data) of the fault event, and the freeze frame (Freeze Frame) data of the fault event. The design of the dump scheme in the current AUTOSAR architecture usually divides three memory areas independently for the fault event information, the extended data, and the freeze frame data in the running memory allocated to the DEM module. The three memory areas are used to temporarily store the fault event information, the extended data, and the freeze frame data, respectively, and each of the three memory areas corresponds to a storage block (Block) in an NVM module. These storage blocks belong to the non-volatile memory (NVRAM, Non Volatile RAM) managed by the NVM module. When dumping, the fault event information, the extended data, and the freeze frame data are transferred from the memory area where they are temporarily stored to the Block of the NVM module corresponding to the memory area for non-volatile storage.
[0004] The above dump scheme is simple in design and easy to implement, but its drawbacks are also obvious. The fault event information, extended data and frozen frames of all fault events are stored in a memory area of the DEM module. When the extended data or frozen frame of any fault event changes, all the data in the memory area storing the extended data or frozen frame needs to be copied to the storage block, which results in a large number of data write operations and reduces the dump performance. Summary of the invention
[0005] In order to solve the above technical problems, the present disclosure provides a diagnostic data dump method, apparatus, device and medium.
[0006] In a first aspect, the present disclosure provides a diagnostic data dump method, comprising:
[0007] Storing diagnostic data of a single fault event in a target buffer in an event buffer array, wherein the target buffer is only used to store the diagnostic data of the single fault event, and the event buffer array is in a running memory;
[0008] When a dump indication signal is monitored, the diagnostic data stored in the target buffer is written into a corresponding target storage block in a non-volatile memory, and each storage block in the non-volatile memory corresponds one-to-one to each buffer in the event buffer array.
[0009] Optionally, before storing the diagnostic data of the single fault event into the target buffer in the event buffer array, the method further includes:
[0010] Acquire fault event configuration information, where the fault event configuration information includes the number of all fault events and the size of the upper limit of the total amount of diagnostic data configured for each fault event;
[0011] Constructing the event buffer array in the running memory according to the fault event configuration information, the number of buffers in the event buffer array is equal to the number of all fault events, the size of the buffer is equal to the size of the maximum configured total amount of diagnostic data in all fault events, and the size of each buffer in the event buffer array is equal;
[0012] A storage block in the non-volatile memory is allocated to each buffer in the event buffer array, and a corresponding relationship between each buffer and the allocated storage block is established, wherein the storage block has a size equal to that of the buffer.
[0013] Optionally, constructing the event buffer array in the running memory according to the fault event configuration information includes:
[0014] Calculating the data capacity of the event buffer array according to the size and number of buffers in the event buffer array;
[0015] Allocating a memory area of the data capacity in the running memory, and dividing the memory area into the number of sub-areas;
[0016] A first subscript is assigned to each sub-region, and each sub-region is used as a buffer in the event buffer array.
[0017] Optionally, allocating a storage block in the non-volatile memory to each buffer in the event buffer array and establishing a corresponding relationship between each buffer and the allocated storage block includes:
[0018] Dividing the number of storage blocks in the non-volatile memory, the size of each storage block being equal to the size of the buffer in the event buffer array;
[0019] Assign a second subscript to each storage block;
[0020] A storage block is allocated to each buffer, a first subscript of each buffer is bound to a second subscript of the allocated storage block, and a binding relationship between each first subscript and the second subscript is recorded as the corresponding relationship.
[0021] Optionally, writing the diagnostic data stored in the target buffer into a corresponding target storage block in a non-volatile memory includes:
[0022] Obtain a target first subscript of the target buffer, and search for a target second subscript bound to the target first subscript from the binding relationship;
[0023] The diagnostic data stored in the target buffer is written into a storage block in the non-volatile memory that is assigned the target second index.
[0024] Optionally, the method further includes:
[0025] When the number of all fault events in the fault event configuration information increases, the sub-areas with the increased number of all fault events are added to the memory area in the running memory, and a first subscript is assigned to each of the added sub-areas as a newly added buffer in the event buffer array;
[0026] Adding and dividing the increased number of storage blocks in the non-volatile memory, and assigning a second subscript to each of the increased and divided storage blocks as a newly added storage block;
[0027] Allocate a new storage block to each newly added buffer, and bind the first subscript and the second subscript of both parties as the corresponding relationship between the newly added buffer and the newly added storage block;
[0028] When the number of all fault events in the fault event configuration information decreases, selecting a buffer whose number of all fault events decreases from the buffers of the event buffer array as a buffer to be deleted;
[0029] Searching the binding relationship for a second subscript bound to the first subscript of the buffer to be deleted as the second subscript to be deleted, and using the storage block assigned with the second subscript to be deleted as the storage block to be deleted;
[0030] The first subscript of the buffer to be deleted is deleted in the event buffer array and the running memory occupied by the buffer to be deleted is released, and the second subscript of the storage block to be deleted is deleted in the non-volatile memory and the memory space occupied by the storage block to be deleted is released.
[0031] Optionally, the dump indication signal is generated by user operation or automatically generated when the system is powered off.
[0032] In a second aspect, the present disclosure provides a diagnostic data dump device, comprising:
[0033] A flash memory module, used to store diagnostic data of a single fault event into a target buffer in an event buffer array, wherein the target buffer is only used to store the diagnostic data of the single fault event, and the event buffer array is in a running memory;
[0034] The dump module is used to write the diagnostic data stored in the target buffer into the corresponding target storage block in the non-volatile memory when a dump indication signal is monitored, and each storage block in the non-volatile memory corresponds one-to-one to each buffer in the event buffer array.
[0035] Optionally, the device also includes a configuration module, which is used to obtain fault event configuration information before storing diagnostic data of a single fault event in a target buffer in the event buffer array, the fault event configuration information including the number of all fault events and the size of the upper limit of the total amount of diagnostic data configured for each fault event; construct the event buffer array in the running memory according to the fault event configuration information, the number of buffers in the event buffer array is equal to the number of all fault events, the size of the buffer is equal to the size of the maximum configured upper limit of the total amount of diagnostic data in all fault events, and the size of each buffer in the event buffer array is equal; allocate a storage block in the non-volatile memory to each buffer in the event buffer array, and establish a correspondence between each buffer and the allocated storage block, and the storage block is equal to the size of the buffer.
[0036] Optionally, when the configuration module constructs the event buffer array in the running memory according to the fault event configuration information, it is specifically used to calculate the data capacity of the event buffer array according to the size and number of buffers in the event buffer array; allocate a memory area with the data capacity in the running memory, and divide the memory area into the said number of sub-areas; assign a first subscript to each sub-area, and use each sub-area as a buffer in the event buffer array.
[0037] Optionally, when the configuration module allocates a storage block in the non-volatile memory to each buffer in the event buffer array and establishes a corresponding relationship between each buffer and the allocated storage block, it is specifically used to divide the number of storage blocks in the non-volatile memory, and the size of each storage block is equal to the size of the buffer in the event buffer array; assign a second subscript to each storage block; allocate a storage block to each buffer, bind the first subscript of each buffer to the second subscript of the allocated storage block, and record the binding relationship between each first subscript and the second subscript as the corresponding relationship.
[0038] Optionally, when the dump module writes the diagnostic data stored in the target buffer into the corresponding target storage block in the non-volatile memory, it is specifically used to obtain the target first subscript of the target buffer, and search for the target second subscript bound to the target first subscript from the binding relationship; and write the diagnostic data stored in the target buffer into the storage block in the non-volatile memory that is assigned the target second subscript.
[0039] Optionally, the configuration module is also used to, when the number of all fault events in the fault event configuration information increases, add sub-areas to the memory area in the running memory that divide the increased number of all fault events, and assign a first subscript to each of the added sub-areas as a newly added buffer in the event buffer array; add and divide the increased number of storage blocks in the non-volatile memory, and assign a second subscript to each of the added storage blocks as a newly added storage block; allocate a newly added storage block to each newly added buffer, and bind the first subscript and the second subscript of both parties as the corresponding relationship between the newly added buffer and the newly added storage block;
[0040] When the number of all fault events in the fault event configuration information decreases, a buffer with a reduced number of all fault events is selected from the buffers of the event buffer array as a buffer to be deleted; the second subscript bound to the first subscript of the buffer to be deleted is searched in the binding relationship as the second subscript to be deleted, and the storage block assigned the second subscript to be deleted is used as the storage block to be deleted; the first subscript of the buffer to be deleted is deleted in the event buffer array and the running memory occupied by the buffer to be deleted is released, and the second subscript of the storage block to be deleted is deleted in the non-volatile memory and the memory space occupied by the storage block to be deleted is released.
[0041] Optionally, the dump indication signal is generated by user operation or automatically generated when the system is powered off.
[0042] In a third aspect, the present disclosure provides a computer device, comprising:
[0043] Memory;
[0044] Processor; and
[0045] Computer programs;
[0046] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in any one of the first aspects.
[0047] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method as described in any one of the first aspects.
[0048] In a fifth aspect, the present disclosure provides a vehicle, comprising the diagnostic data dump device as described in the second aspect and / or the computer device as described in the second aspect.
[0049] The diagnostic data dumping method, device, equipment and medium provided by the present disclosure store the diagnostic data of a single fault event in a target buffer in an event buffer array, and when a dump indication signal is monitored, write the diagnostic data stored in the target buffer into a corresponding target storage block in a non-volatile memory, thereby completing the dumping of the diagnostic data of the fault event. Since each buffer in the event buffer array is only used to store the diagnostic data of a single fault event, and each storage block in the non-volatile memory corresponds one-to-one to each buffer in the event buffer array, the diagnostic data of a single fault event has a corresponding storage block in the non-volatile memory, so that when the diagnostic data of the fault event changes, only the data in the buffer where the diagnostic data has changed needs to be copied to the corresponding storage block in the non-volatile memory, without the need to copy the diagnostic data of all fault events stored in the memory area into the storage block as in the existing solution, thereby reducing the write operation when dumping the diagnostic data and improving the dumping performance of the diagnostic data. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0052] Figure 1 It is a schematic diagram of the existing dumping scheme;
[0053] Figure 2A flow chart of a diagnostic data dump method provided by an embodiment of the present disclosure;
[0054] Figure 3 A schematic diagram of an application scenario of the diagnostic data dump method provided in an embodiment of the present disclosure;
[0055] Figure 4 A schematic diagram of the structure of a diagnostic data dump device provided in an embodiment of the present disclosure;
[0056] Figure 5 It is a structural schematic diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0057] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0058] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0059] In the disclosed embodiment, dumping refers to storing the fault event diagnostic data stored in the DEM module in NVRAM as non-volatile storage. NVRAM is a memory technology with non-volatility and can maintain stored data in the event of power failure or power interruption. Compared with traditional volatile memory (such as RAM), it does not require continuous power supply to maintain data storage. The fault event diagnostic data stored in the DEM module itself will be cleared when the system is powered off, while the fault event diagnostic data stored in the NVRAM will be retained when the system is powered off. Therefore, when the system is powered on next time, the NVM module will rewrite the fault event diagnostic data stored in the NVRAM into the DEM module to ensure that the fault event diagnostic data can maintain the data storage state during the power-off and power-on process, so that it is still available after power-on.
[0060] Figure 2 The present invention provides a flowchart of a diagnostic data dump method, which can be executed by a diagnostic data dump device, which can be implemented in software and / or hardware, and can be configured in an electronic device, such as a vehicle computer, a vehicle-mounted computer, a domain controller, etc. Figure 2 As shown, the diagnostic data dump method includes the following steps:
[0061] S201. Storing diagnostic data of a single fault event in a target buffer in an event buffer array. The target buffer is only used to store diagnostic data of a single fault event. The event buffer array is in a running memory.
[0062] Figure 3 A schematic diagram of an application scenario of the diagnostic data dump method provided in an embodiment of the present disclosure, the scenario includes fault event information 301, extended data 302, and freeze frame 303 of a fault event 30; a memory area 31 of a DEM module, the memory area 31 being a storage area in the system running memory, wherein an event buffer array 310 (Event Record Buffer Array) is constructed; and an NVRAM memory 32 of an NVM module. The event buffer array 310 includes multiple buffers (DTC Buffer) such as buffers 311, 312, 314, 314, and each buffer has the same size. The NVRAM memory 32 includes multiple storage blocks such as storage blocks 321, 322, 323, 324, and each storage block has a size equal to the size of each buffer. Running memory refers to the memory required when a program is running, which can only temporarily store data for high-speed cache data exchange with the CPU. Running memory generally refers to random access memory (Random Access Memory, RAM).
[0063] Exemplarily, when a diagnostic event is reported to the DEM module, the DEM module receives the fault event information 301 of the diagnostic event. The fault event information 301 can be represented by DTC, which is a coding system for representing vehicle electronic system faults. When the vehicle's electronic system or sensor detects a possible fault, they will generate a fault code. Through this fault code, technicians can more easily diagnose and solve vehicle faults. Each DTC corresponds to a specific fault type and fault location, and is important reference information in the fault diagnosis and repair process.
[0064] Then the DEM module will debounce the diagnostic event corresponding to the DTC. Debounce is to monitor the maturity of the fault and to avoid false alarms of the fault. When the diagnostic event is reported to the DEM module, the DEM module will immediately collect the freeze frame 303 of the diagnostic event. The freeze frame refers to the operating status information of the vehicle system where the diagnostic event occurs when the diagnostic event occurs. When the DEM module debounces the diagnostic event, the DEM module will collect the extended data 302 of the diagnostic event. After the diagnostic event is debounced, it is determined by the DEM module as a fault event 30. The diagnostic data of the fault event 30 includes fault event information 301, extended data 302, and freeze frame 303.
[0065] Afterwards, the DEM module will store the diagnostic data of the fault event 30 in the event buffer array 310 in the running memory. When the DEM module stores the diagnostic data of the fault event 30 in the event buffer array 310, it can select the first free buffer in the event buffer array 310 to store the diagnostic data of the fault event 30 in a first-come-first-served manner. Figure 3 In the illustrated scenario, since the buffers in the event buffer array 310 are all idle, and the buffer 311 is the first buffer in the event buffer array 310, the DEM module determines the buffer 311 in the buffer array 310 as the first idle buffer, i.e., the target buffer. The DEM module then stores the diagnostic data of the fault event 30 in the buffer 311. In addition, each DTC may be bound to a buffer in advance so that one DTC corresponds to one buffer, and then when the diagnostic data of the fault event is stored in the event buffer array, the buffer bound to the DTC of the fault event is used as the target buffer for storing the diagnostic data of the fault event. For example, if the DTC of the fault event 30 is bound to the buffer 312, then the buffer 312 is used as the target buffer for storing the diagnostic data of the fault event 30.
[0066] S202: When a dump indication signal is monitored, the diagnostic data stored in the target buffer is written into a corresponding target storage block in the non-volatile memory, and each storage block in the non-volatile memory corresponds one-to-one to each buffer in the event buffer array.
[0067] A storage block is a group of continuous storage units in a memory (such as a hard disk) for storing data. A storage block usually has a fixed size. For example, in a hard disk, a storage block can be the size of several sectors (for example, usually 512 bytes) or larger. A storage block is the smallest addressable unit of a memory and is used to read and write data.
[0068] When the DEM module detects the dump indication signal, it will dump the diagnostic data stored in each buffer in the event buffer array 310 to the corresponding storage block in the NVRAM memory 32 .
[0069] In some embodiments, the dump indication signal is generated by user operation or automatically generated when the system is powered off. For example, a user can enter the diagnostic event management system of the AUTOSAR architecture through the vehicle computer, and by clicking on the backup option of the fault event diagnostic data, the diagnostic event management system of the AUTOSAR architecture generates a dump indication signal. In addition, when the diagnostic event management system of the AUTOSAR architecture is powered off, for example, the user turns off the vehicle power supply system, causing the diagnostic event management system of the AUTOSAR architecture to be powered off, or a vehicle power supply system failure causes the diagnostic event management system of the AUTOSAR architecture to be powered off, etc., the diagnostic event management system of the AUTOSAR architecture will automatically generate a dump indication signal. The dump indication signal can instruct the system to dump diagnostic data.
[0070] For example, Figure 3 In the illustrated scenario, the storage blocks 321, 322, 323, and 324 in the NVRAM memory 32 correspond to the buffers 311, 312, 313, and 314, respectively. Then the DEM module writes the diagnostic data stored in the buffer 311 into the storage block 321, writes the diagnostic data stored in the buffer 312 into the storage block 322, writes the diagnostic data stored in the buffer 313 into the storage block 323, and writes the diagnostic data stored in the buffer 314 into the storage block 324. In this way, the diagnostic data of the fault event 30 is dumped to the storage block 321 in the NVRAM memory 32. Similarly, the diagnostic data of a single diagnostic event stored in the buffer 312 is dumped to the storage block 322 in the NVRAM memory 32, the diagnostic data of a single diagnostic event stored in the buffer 313 is dumped to the storage block 323 in the NVRAM memory 32, and the diagnostic data of a single diagnostic event stored in the buffer 314 is dumped to the storage block 324 in the NVRAM memory 32.
[0071] In this way, when the diagnostic data of fault event 30 changes, the DEM module only needs to rewrite the diagnostic data updated in buffer 311 into storage block 321, without having to rewrite the changed diagnostic data into storage block as a whole. For example, when the number of occurrences of fault event 30 increases once, the total number of occurrences of fault event 30 will be updated in extended data 302 of fault event 30, the occurrence time of the new event will be added, etc., and the freeze frame data of the new event will be updated in freeze frame 303 of fault data. In this case, if the diagnostic data is dumped according to the existing scheme, refer to Figure 1 , it is necessary to rewrite the extended data of all fault events in the memory area 2 of the DEM module into the storage block B, and rewrite the frozen frames of all fault events in the memory area 3 of the DEM module into the storage block C. Figure 2, it is only necessary to rewrite the diagnostic data in the buffer 311 into the storage block 321 , which greatly reduces the data that needs to be rewritten into the NVRAM memory 32 compared to the existing solution, thereby improving the dump performance.
[0072] The disclosed embodiment stores the diagnostic data of a single fault event in a target buffer in an event buffer array, and when a dump indication signal is detected, writes the diagnostic data stored in the target buffer into a corresponding target storage block in a non-volatile memory, thereby completing the dumping of the diagnostic data of the fault event. Since each buffer in the event buffer array is only used to store the diagnostic data of a single fault event, and each storage block in the non-volatile memory corresponds one-to-one to each buffer in the event buffer array, the diagnostic data of a single fault event has a corresponding storage block in the non-volatile memory, so that when the diagnostic data of the fault event changes, only the data in the buffer where the diagnostic data has changed needs to be copied to the corresponding storage block in the non-volatile memory, without the need to copy the diagnostic data of all fault events stored in the memory area into the storage block as in the existing solution, thereby reducing the write operation when dumping the diagnostic data and improving the dumping performance of the diagnostic data.
[0073] In some embodiments, before storing the diagnostic data of a single fault event in a target buffer in an event buffer array, it also includes: obtaining fault event configuration information, the fault event configuration information includes the number of all fault events and the size of the upper limit of the total amount of diagnostic data configured for each fault event; constructing an event buffer array in a memory according to the fault event configuration information, the number of buffers in the event buffer array is equal to the number of all fault events, the size of the buffer is equal to the size of the maximum configured upper limit of the total amount of diagnostic data in all fault events, and the size of each buffer in the event buffer array is equal; allocating a storage block in a non-volatile memory to each buffer in the event buffer array, and establishing a corresponding relationship between each buffer and the allocated storage block, and the size of the storage block is equal to the buffer.
[0074] When the diagnostic event processing software of the AUTOSAR architecture is first installed, the configuration information of the fault event is obtained, that is, the configuration information of the diagnostic event. In the embodiment of the present disclosure, the fault event refers to the diagnostic event after debounce is completed, so the configuration information of the fault event is the configuration information of the diagnostic event. The fault event configuration information usually includes the number of all fault events and the size of the upper limit of the total amount of diagnostic data configured for each fault event.
[0075] In one embodiment, an event buffer array is constructed in a memory according to fault event configuration information, including: calculating the data capacity of the event buffer array according to the size and number of buffers in the event buffer array; allocating a memory area in the running memory with a size equal to the data capacity, and dividing the memory area into the number of sub-areas; assigning a first subscript to each sub-area, and treating each sub-area as a buffer in the event buffer array.
[0076] In some embodiments, a storage block in a non-volatile memory is allocated to each buffer in an event buffer array, and a corresponding relationship between each buffer and the allocated storage block is established, including: dividing the above number of storage blocks in the non-volatile memory, and the size of each storage block is equal to the size of the buffer in the event buffer array; assigning a second subscript to each storage block; allocating a storage block to each buffer, binding the first subscript of each buffer to the second subscript of the allocated storage block, and recording the binding relationship between each first subscript and the second subscript as a corresponding relationship.
[0077] For example, all fault events include four fault events, namely, abnormal vehicle voltage fault, abnormal vehicle acceleration fault, and abnormal vehicle air conditioning fault, so the number of all fault events is 4. Then the number of buffers in the event buffer array to be constructed can be determined to be 4.
[0078] Next, taking the abnormal vehicle voltage fault as an example, if the DTC size of the abnormal vehicle voltage fault event is 1kb, since the DTC size of the fault event is fixed, the upper limit of the total amount of data configured for the DTC of the abnormal vehicle voltage fault event can be set to 1kb.
[0079] The total amount of data of the extended data and frozen frame of the vehicle voltage abnormal fault event will increase each time the vehicle voltage abnormal fault event is reported. Therefore, the upper limit of the total amount of data configured for the extended data and frozen frame of the vehicle voltage abnormal fault event is a preset value determined according to demand. For example, the upper limit of the total amount of data configured for the extended data of the vehicle voltage abnormal fault event is 100kb, and the upper limit of the total amount of data configured for the frozen frame of the vehicle voltage abnormal fault event is 400kb. Then the upper limit of the total amount of data configured for the diagnostic data of the vehicle voltage abnormal fault event is 1kb+100kb+400kb=501kb.
[0080] If among the five fault events of vehicle voltage abnormal fault, vehicle acceleration abnormal fault and vehicle air conditioning abnormal fault, the total amount of diagnostic data configured for the vehicle voltage abnormal fault event has the largest upper limit, then the size of the total amount of diagnostic data configured for the vehicle voltage abnormal fault event is used as the size of each buffer in the event buffer array to be constructed, that is, 501kb. Then the data capacity of the event buffer array is 501kb*4=2004kb, which is the memory size of 2004kb required to construct the event buffer array.
[0081] When constructing the event buffer array, a memory area of 2004kb is allocated from the memory allocated to the DEM module, and this memory area is divided into 4 sub-areas of equal size. Each sub-area is assigned a first subscript for marking the sub-area, and each sub-area is used as a buffer in an event buffer array. In this way, the divided memory area is constructed as an event buffer array. For example Figure 3 In the illustrated scenario, the subscripts of buffers 311, 312, 313, and 314 are A001, A002, A003, and A004, respectively, and the subsequent buffers are analogous. Thus, an event buffer array that can store diagnostic data of all fault events is constructed in the memory according to the fault event configuration information.
[0082] Similarly, the non-volatile memory is divided into four storage blocks of 501 kb each, and each sub-storage block is assigned a second subscript for marking the storage block. Figure 3 In the illustrated scenario, the subscripts of storage blocks 321, 322, 323, and 324 are B001, B002, B003, and B004, respectively. Then, a buffer is allocated to each buffer in the event buffer array constructed above, which can be randomly allocated or allocated in sequence, which is not limited in the embodiment of the present disclosure. Figure 3In the illustrated scenario, storage block 321 is allocated to buffer 311 in event buffer array 310, storage block 322 is allocated to buffer 312, storage block 323 is allocated to buffer 313, storage block 324 is allocated to buffer 314, and so on. Then, the subscript A001 of the buffer 311 is bound to the subscript B001 of the storage block 321, the subscript A002 of the buffer 312 is bound to the subscript B002 of the storage block 322, the subscript A003 of the buffer 313 is bound to the subscript B003 of the storage block 323, the subscript A004 of the buffer 314 is bound to the subscript B004 of the storage block 324, and so on. The first subscript of each buffer in the event buffer array 310 is bound to the second subscript of the storage block allocated to it, and the binding relationship between each first subscript and second subscript is recorded. This binding relationship can serve as the corresponding relationship between each buffer in the event buffer array 310 and the storage block allocated to it in the non-volatile memory.
[0083] Correspondingly, the diagnostic data stored in the target buffer is written into the corresponding target storage block in the non-volatile memory, including: obtaining the target first subscript of the target buffer, and searching for the target second subscript bound to the target first subscript from the binding relationship; and writing the diagnostic data stored in the target buffer into the storage block in the non-volatile memory that is assigned the target second subscript.
[0084] Exemplarily, when the diagnostic data of the fault event 30 is written into the corresponding storage block in the non-volatile memory, according to the subscript of the location where the diagnostic data of the fault event 30 is stored in the event buffer array 310, that is, the subscript A001 of the buffer 311, the second subscript B001 corresponding to the first subscript A001 is searched from the binding relationship of the above record, and then the diagnostic data stored in the buffer 311 is written into the storage block with the subscript B001, that is, the storage block 321. In this way, the diagnostic data dump of the fault event 30 is completed, and the diagnostic data dump process of other fault events is similar to the diagnostic data dump process of the fault event 30.
[0085] In some embodiments, the method further includes: when the number of all fault events in the fault event configuration information increases, adding sub-regions to divide the increased number of all fault events to the memory area in the running memory, and assigning a first subscript to each of the added sub-regions as a newly added buffer in the event buffer array; adding an increased number of storage blocks to divide the non-volatile memory, and assigning a second subscript to each of the added storage blocks as a newly added storage block; allocating a newly added storage block to each newly added buffer, and binding the first subscript and the second subscript of both parties as a corresponding relationship between the newly added buffer and the newly added storage block;
[0086] When the number of all fault events in the fault event configuration information decreases, a buffer with a reduced number of all fault events is selected from the buffers in the event buffer array as the buffer to be deleted; the second subscript bound to the first subscript of the buffer to be deleted is searched in the binding relationship as the second subscript to be deleted, and the storage block assigned the second subscript to be deleted is used as the storage block to be deleted; the first subscript of the buffer to be deleted is deleted in the event buffer array and the running memory occupied by the buffer to be deleted is released, and the second subscript of the storage block to be deleted is deleted in the non-volatile memory and the memory space occupied by the storage block to be deleted is released.
[0087] exist Figure 1 In the dump scheme shown, when some fault events are added or deleted during software update, the sizes of the various memory areas for storing fault event information, extended data and frozen frames need to be recalculated. If the sizes of the various memory areas for storing fault event information, extended data and frozen frames are not recalculated, it is very likely that the storage space required for storing fault events of the updated software version is inconsistent with the size of the memory area and storage block used to store fault events of the previous version of the software, resulting in data crossing the boundary in the originally allocated memory areas, causing the problem of contaminating other data. In the disclosed embodiment, since the sizes of multiple buffers in the event buffer array are equal and correspond one-to-one with the storage blocks in the non-volatile memory, when some fault events are added or deleted during software update, it is only necessary to allocate a corresponding number of buffers and storage blocks for the newly added fault events, or delete a corresponding number of buffers and storage blocks for the deleted fault events, so that the buffers and storage blocks for storing fault events can be consistent with the storage space required for the fault events of the updated software version, thereby avoiding data crossing the boundary.
[0088] Specifically, when the number of all fault events is increased in the fault event configuration information of the diagnostic event processing software of the new version of the AUTOSAR architecture, the increased number of all fault events will be synchronized to the event buffer array configuration item, thereby increasing the length of the event buffer array, that is, a corresponding memory area will be allocated in the running memory allocated to the DEM module to increase the number of buffers in the event buffer array. For example, if the increased number of all fault events is 2 and the size of the buffer is 501kb, then a memory area of 1002kb will be allocated in the memory allocated to the DEM module, which will be evenly divided into 2 sub-areas of 501kb, and then the first subscripts will be assigned to the two sub-areas as two buffers and incorporated into the event buffer array. Assuming that the subscript of the last buffer in the original buffer of the event buffer array is A004, the subscripts of the two newly added buffers are A005 and A006 respectively. Then, two new storage blocks of the same size of 501kb will be added to the non-volatile memory, and the second subscripts will be assigned to the two new storage blocks respectively. Assuming that the subscript of the last storage block in the original storage block in the non-volatile memory is B004, the subscripts of the two new buffers will be B005 and B006 respectively. Finally, the first subscripts of the two new buffers and the second subscripts of the two new storage blocks are bound respectively, for example, A005 and B005 are bound, and A006 and B006 are bound, so that the two new buffers and the two new storage blocks correspond one to one. In addition, if the length of the event buffer array is not increased, the replacement strategy can also be used to replace the low-priority fault events stored in the buffer when the high-priority fault event is reported and stored, and copied to the corresponding storage block.
[0089] When the number of all fault events is deleted in the fault event configuration information of the diagnostic event processing software of the new version of the AUTOSAR architecture, the deleted number of all fault events will be synchronized to the event buffer array configuration item, thereby reducing the length of the event buffer array. For example, if the number of all fault events increased is 1, and the original length of the event buffer array is 4, that is, the number of buffers in the event buffer array is 4, then only one buffer needs to be selected from the end of the event buffer array as the buffer to be deleted, that is, the last buffer in the original buffer of the event buffer array, and then the first subscript of the buffer to be deleted is deleted, and the 501kb running memory occupied by the buffer is released. Assuming that the first subscript of the buffer to be deleted is A004, the second subscript bound to A004 will be searched, and after finding that the second subscript bound to A004 is B004, the storage block with the subscript B004 will be deleted in the non-volatile memory to release the storage space occupied by the diagnostic data stored in the deleted storage block.
[0090] The disclosed embodiment can add storage blocks for dumping diagnostic data of newly added fault events according to the increased number of all fault events, and can also directly delete a corresponding number of buffers and storage blocks according to the deleted number of all fault events. Compared with the existing scheme, there is no need to recalculate the size of each memory area for storing the fault event information, extended data and freeze frames of all fault events, and the size of each storage block for dumping the fault event information, extended data and freeze frames of all fault events. This reduces the computational complexity when upgrading the diagnostic event processing software of the AUTOSAR architecture, and avoids data cross-border or data pollution when dumping diagnostic data after the diagnostic event processing software of the AUTOSAR architecture is upgraded.
[0091] Figure 4 The structure diagram of the diagnostic data dump device provided by the embodiment of the present disclosure is shown in FIG. The diagnostic data dump device can execute the processing flow provided by the diagnostic data dump method embodiment, such as Figure 4 As shown, the diagnostic data dumping device 400 includes:
[0092] Flash memory module 401, used to store diagnostic data of a single fault event into a target buffer in an event buffer array, the target buffer is only used to store diagnostic data of a single fault event, and the event buffer array is in the running memory;
[0093] The dump module 402 is used to write the diagnostic data stored in the target buffer into the corresponding target storage block in the non-volatile memory when a dump indication signal is monitored. Each storage block in the non-volatile memory corresponds to each buffer in the event buffer array.
[0094] In some embodiments, the device also includes a configuration module 403, which is used to obtain fault event configuration information before storing the diagnostic data of a single fault event in a target buffer in the event buffer array, the fault event configuration information including the number of all fault events and the size of the upper limit of the total amount of diagnostic data configured for each fault event; construct an event buffer array in the running memory according to the fault event configuration information, the number of buffers in the event buffer array is equal to the number of all fault events, the size of the buffer is equal to the size of the maximum configured upper limit of the total amount of diagnostic data in all fault events, and the size of each buffer in the event buffer array is equal; allocate a storage block in a non-volatile memory to each buffer in the event buffer array, and establish a correspondence between each buffer and the allocated storage block, and the size of the storage block is equal to the buffer.
[0095] In some embodiments, when the configuration module 403 constructs an event buffer array in the running memory according to the fault event configuration information, it is specifically used to calculate the data capacity of the event buffer array according to the size and number of buffers in the event buffer array; allocate a running memory area with data capacity in the running memory, and divide the running memory area into a number of sub-areas; assign a first subscript to each sub-area, and use each sub-area as a buffer in the event buffer array.
[0096] In some embodiments, when the configuration module 403 allocates a storage block in a non-volatile memory to each buffer in the event buffer array and establishes a corresponding relationship between each buffer and the allocated storage block, it is specifically used to divide a number of storage blocks in the non-volatile memory, and the size of each storage block is equal to the size of the buffer in the event buffer array; assign a second subscript to each storage block; allocate a storage block to each buffer, bind the first subscript of each buffer to the second subscript of the allocated storage block, and record the binding relationship between each first subscript and the second subscript as a corresponding relationship.
[0097] In some embodiments, when the dump module 402 writes the diagnostic data stored in the target buffer into the corresponding target storage block in the non-volatile memory, it is specifically used to obtain the target first subscript of the target buffer, and search for the target second subscript bound to the target first subscript from the binding relationship; and write the diagnostic data stored in the target buffer into the storage block in the non-volatile memory that is assigned the target second subscript.
[0098] In some embodiments, the configuration module 403 is also used to add sub-regions to the memory area in the running memory to divide the increased number of all fault events when the number of all fault events in the fault event configuration information increases, and assign a first subscript to each of the added sub-regions as a newly added buffer in the event buffer array; add an increased number of storage blocks to the non-volatile memory, and assign a second subscript to each of the added storage blocks as a newly added storage block; allocate a newly added storage block to each newly added buffer, and bind the first subscript and the second subscript of both parties as the corresponding relationship between the newly added buffer and the newly added storage block;
[0099] When the number of all fault events in the fault event configuration information decreases, a buffer with a reduced number of all fault events is selected from the buffers in the event buffer array as the buffer to be deleted; the second subscript bound to the first subscript of the buffer to be deleted is searched in the binding relationship as the second subscript to be deleted, and the storage block assigned the second subscript to be deleted is used as the storage block to be deleted; the first subscript of the buffer to be deleted is deleted in the event buffer array and the running memory occupied by the buffer to be deleted is released, and the second subscript of the storage block to be deleted is deleted in the non-volatile memory and the memory space occupied by the storage block to be deleted is released.
[0100] In some embodiments, the dump indication signal is generated by a user operation or automatically when the system is powered off.
[0101] Figure 4 The diagnostic data dump device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0102] Figure 5 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 5 , which shows a structural schematic diagram of an electronic device 500 suitable for implementing the embodiments of the present disclosure. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0103] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503 to implement the diagnostic data dump method of the embodiment described in the present disclosure. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0104] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0105] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the diagnostic data dump method as described above. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0106] The embodiments of the present disclosure further provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the diagnostic data dump method in the above embodiments.
[0107] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0108] The embodiments of the present disclosure also provide a vehicle, which includes the diagnostic data dump device and / or the computer equipment as described in the above embodiments.
[0109] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A diagnostic data dump method, characterized in that: include: Storing diagnostic data of a single fault event in a target buffer in an event buffer array, wherein the target buffer is only used to store the diagnostic data of the single fault event, and the event buffer array is in a running memory; When a dump indication signal is monitored, the diagnostic data stored in the target buffer is written into a corresponding target storage block in a non-volatile memory, and each storage block in the non-volatile memory corresponds one-to-one to each buffer in the event buffer array.
2. The method according to claim 1, characterized in that Before storing the diagnostic data of the single fault event into the target buffer in the event buffer array, the method further includes: Acquire fault event configuration information, where the fault event configuration information includes the number of all fault events and the size of the upper limit of the total amount of diagnostic data configured for each fault event; Constructing the event buffer array in the running memory according to the fault event configuration information, the number of buffers in the event buffer array is equal to the number of all fault events, the size of the buffer is equal to the size of the maximum configured total amount of diagnostic data in all fault events, and the size of each buffer in the event buffer array is equal; A storage block in the non-volatile memory is allocated to each buffer in the event buffer array, and a corresponding relationship between each buffer and the allocated storage block is established, wherein the storage block has a size equal to that of the buffer.
3. The method according to claim 2, characterized in that The step of constructing the event buffer array in the running memory according to the fault event configuration information includes: Calculating the data capacity of the event buffer array according to the size and number of buffers in the event buffer array; Allocating a memory area of the data capacity in the running memory, and dividing the memory area into the number of sub-areas; A first subscript is assigned to each sub-region, and each sub-region is used as a buffer in the event buffer array.
4. The method according to claim 3, characterized in that The allocating a storage block in the non-volatile memory to each buffer in the event buffer array and establishing a corresponding relationship between each buffer and the allocated storage block includes: Dividing the number of storage blocks in the non-volatile memory, the size of each storage block being equal to the size of the buffer in the event buffer array; Assign a second subscript to each storage block; A storage block is allocated to each buffer, a first subscript of each buffer is bound to a second subscript of the allocated storage block, and a binding relationship between each first subscript and the second subscript is recorded as the corresponding relationship.
5. The method according to claim 4, characterized in that The step of writing the diagnostic data stored in the target buffer into a corresponding target storage block in the non-volatile memory comprises: Obtain a target first subscript of the target buffer, and search for a target second subscript bound to the target first subscript from the binding relationship; The diagnostic data stored in the target buffer is written into a storage block in the non-volatile memory that is assigned the target second index.
6. The method according to claim 4, characterized in that The method further comprises: When the number of all fault events in the fault event configuration information increases, the sub-areas with the increased number of all fault events are added to the memory area in the running memory, and a first subscript is assigned to each of the added sub-areas as a newly added buffer in the event buffer array; Adding and dividing the increased number of storage blocks in the non-volatile memory, and assigning a second subscript to each of the increased and divided storage blocks as a newly added storage block; Allocate a new storage block to each newly added buffer, and bind the first subscript and the second subscript of both parties as the corresponding relationship between the newly added buffer and the newly added storage block; When the number of all fault events in the fault event configuration information decreases, selecting a buffer whose number of all fault events decreases from the buffers of the event buffer array as a buffer to be deleted; Searching the binding relationship for a second subscript bound to the first subscript of the buffer to be deleted as the second subscript to be deleted, and using the storage block assigned with the second subscript to be deleted as the storage block to be deleted; The first subscript of the buffer to be deleted is deleted in the event buffer array and the running memory occupied by the buffer to be deleted is released, and the second subscript of the storage block to be deleted is deleted in the non-volatile memory and the memory space occupied by the storage block to be deleted is released.
7. The method according to claim 1, characterized in that The dump indication signal is generated by a user operation or automatically generated when the system is powered off.
8. A diagnostic data dump device, characterized in that: include: A flash memory module, used to store diagnostic data of a single fault event into a target buffer in an event buffer array, wherein the target buffer is only used to store diagnostic data of the single fault event, and the event buffer array is in a running memory; The dump module is used to write the diagnostic data stored in the target buffer into the corresponding target storage block in the non-volatile memory when a dump indication signal is monitored, and each storage block in the non-volatile memory corresponds one-to-one to each buffer in the event buffer array.
9. A computer device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Fault diagnosis method, system and device and computer readable storage medium
CN121276197A