Diagnostic data transmission method and device, electronic equipment, vehicle and storage medium
By combining the diagnostic data reading method in the form of event triggering and periodic sampling, the problem that the receiving node cannot receive continuous diagnostic event data is solved, the integrity and accuracy of diagnostic data transmission is improved, and the integrity and accuracy of the data are ensured.
Patent Information
- Application Number
- CN202410666056.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-09-20
AI Technical Summary
During the transmission of diagnostic data, the controller of the receiving node may not be able to detect the triggering events of consecutive diagnostic events, resulting in the failure to successfully receive the corresponding diagnostic data, especially when the receiving node has not completed receiving the previous set of data and the next set of data has not yet been received. Reception cannot be triggered when data arrives.
Using a method that combines event triggering and periodic sampling, the diagnostic data is read from the communication protocol bus. By detecting the consistency and duration of the data, it is determined to output the data read in the periodic sampling form when it is inconsistent to ensure the integrity of the data. sex and accuracy.
It effectively avoids missed reading and loss of diagnostic data, improves the integrity and accuracy of diagnostic data transmission, and ensures that data from multiple consecutive diagnostic events can be successfully received.
Smart Images

Figure CN118677576A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle technology, and in particular to a diagnostic data transmission method, device, electronic equipment, vehicle and storage medium. Background Art
[0002] When transmitting diagnostic data through the communication protocol bus, the controller of the sending node sends the diagnostic data to the communication protocol bus, and the controller of the receiving node receives the diagnostic data accordingly. In such a transmission process, the transmission cycle of the diagnostic data is not fixed, but is sent in the form of events. The corresponding receiving method corresponding to this sending method is event-triggered reception, that is, only when the diagnostic data is transmitted to the controller of the receiving node, the controller of the receiving node will receive it. However, such a receiving method will be affected by the reception time interval of the diagnostic data corresponding to the continuous diagnostic events. When the controller of the receiving node has not completed the reception of the diagnostic data corresponding to the current diagnostic event, if the controller of the sending node sends the diagnostic data corresponding to another diagnostic event to it, it may cause the controller of the receiving node to be unable to detect the trigger event corresponding to the other diagnostic event, resulting in the failure to successfully receive the diagnostic data corresponding to the other diagnostic event. Summary of the invention
[0003] The purpose of the present application is to provide a diagnostic data transmission method, device, electronic device, vehicle and storage medium, which can ensure that multiple groups of diagnostic data corresponding to multiple consecutive diagnostic events can be received, thereby improving the integrity and accuracy of diagnostic data transmission.
[0004] To achieve the above objectives:
[0005] In a first aspect, an embodiment of the present application provides a method for transmitting diagnostic data, the method comprising:
[0006] Reading the diagnostic data corresponding to the diagnostic event from the communication protocol bus in the event triggering form and the periodic sampling form respectively;
[0007] Check whether the diagnostic data read in the event triggering form is consistent with the diagnostic data read in the periodic sampling form;
[0008] When it is determined that the diagnostic data read in the event trigger form and the diagnostic data read in the periodic sampling form are inconsistent, the diagnostic data read in the periodic sampling form is output.
[0009] In one embodiment, the reading of diagnostic data corresponding to the diagnostic event from the communication protocol bus in an event-triggered form and a periodic sampling form respectively includes:
[0010] Determine whether a diagnostic event is detected from the communication protocol bus;
[0011] If so, reading the diagnostic data corresponding to the diagnostic event in an event-triggered form;
[0012] If not, the diagnostic data corresponding to the diagnostic event is read in a periodic sampling form.
[0013] In one embodiment, the determining whether a diagnostic event is detected from the communication protocol bus includes:
[0014] It is detected whether the data frame received from the communication protocol bus contains the diagnostic ID. If so, it is determined that a diagnostic event is detected.
[0015] In one embodiment, before reading the diagnostic data corresponding to the diagnostic event in a periodic sampling form, the method further includes:
[0016] According to the transmission frequency of the diagnostic data frame on the communication protocol bus, the sampling period for reading the diagnostic data in the form of periodic sampling is determined.
[0017] In one embodiment, before detecting whether the diagnostic data read in the event-triggered form is consistent with the diagnostic data read in the periodic sampling form, the method further includes:
[0018] Determine whether the time taken to read the diagnostic data corresponding to the diagnostic event in an event-triggered manner is greater than or equal to a preset time interval; the preset time interval is used to represent the maximum time taken to read the diagnostic data in an event-triggered manner;
[0019] If yes, a step of detecting whether the diagnostic data read in the event-triggered form is consistent with the diagnostic data read in the periodic sampling form is performed.
[0020] In one embodiment, the diagnostic data transmission method further includes: when it is determined that the time length used to read the diagnostic data corresponding to the diagnostic event in an event-triggered manner is less than the preset time interval, outputting the diagnostic data read in an event-triggered manner.
[0021] In a second aspect, an embodiment of the present application provides a diagnostic data transmission device, including:
[0022] A reading module, used for reading diagnostic data corresponding to diagnostic events from the communication protocol bus in an event-triggered form and a periodic sampling form respectively;
[0023] A detection module, detecting whether the diagnostic data read in the event triggering form is consistent with the diagnostic data read in the periodic sampling form;
[0024] The output module outputs the diagnostic data read in the form of periodic sampling when it is determined that the diagnostic data read in the form of event triggering is inconsistent with the diagnostic data read in the form of periodic sampling.
[0025] In one embodiment, the diagnostic data transmission device further includes:
[0026] The judgment module is used to judge whether a diagnosis event is detected from the communication protocol bus.
[0027] The reading module is specifically used for:
[0028] If so, reading the diagnostic data corresponding to the diagnostic event in an event-triggered form;
[0029] If not, the diagnostic data corresponding to the diagnostic event is read in a periodic sampling form.
[0030] In one implementation, the judgment module is specifically used to:
[0031] It is detected whether the data frame received from the communication protocol bus contains the diagnostic ID. If so, it is determined that a diagnostic event is detected.
[0032] In one embodiment, the diagnostic data transmission device further includes:
[0033] The setting module is used to determine the sampling period for reading the diagnostic data in the form of periodic sampling according to the transmission frequency of the diagnostic data frame on the communication protocol bus.
[0034] In one implementation, the determination module is further configured to:
[0035] Determine whether the time taken to read the diagnostic data corresponding to the diagnostic event in an event-triggered manner is greater than or equal to a preset time interval; the preset time interval is used to represent the maximum time taken to read the diagnostic data in an event-triggered manner.
[0036] In one embodiment, the detection module is specifically used for:
[0037] When the time length used for reading the diagnostic data corresponding to the diagnostic event in the event-triggered form is greater than or equal to the preset time interval, a step of detecting whether the diagnostic data read in the event-triggered form is consistent with the diagnostic data read in the periodic sampling form is performed.
[0038] In one embodiment, the output module is specifically configured to: when it is determined that the time length used to read the diagnostic data corresponding to the diagnostic event in an event-triggered manner is less than the preset time interval, output the diagnostic data read in an event-triggered manner.
[0039] In a third aspect, the present application provides an electronic device, including: a processor;
[0040] a memory for storing instructions executable by the processor;
[0041] The processor is configured to execute the instructions to implement the diagnostic data transmission method described in any one of the first aspects.
[0042] In a fourth aspect, the present application provides a computer-readable storage medium. When instructions in the computer-readable storage medium are executed by a processor, the diagnostic data transmission method as described in any one of the first aspects is implemented.
[0043] In a fifth aspect, the present application provides a vehicle, comprising the electronic device described in the third aspect, wherein the communication protocol bus is a CAN bus or a LIN bus.
[0044] The present application provides a diagnostic data transmission method, device, electronic device, vehicle and storage medium, and the diagnostic data transmission method includes: reading diagnostic data corresponding to diagnostic events from a communication protocol bus in an event-triggered form and a periodic sampling form respectively; detecting whether the diagnostic data read in an event-triggered form is consistent with the diagnostic data read in a periodic sampling form; when it is determined that the diagnostic data read in an event-triggered form is inconsistent with the diagnostic data read in a periodic sampling form, outputting the diagnostic data read in a periodic sampling form. The diagnostic data transmission method provided in an embodiment of the present application, by adding a setting to read the diagnostic data corresponding to the diagnostic event from a communication protocol bus in a periodic sampling form, outputs the diagnostic data read in a periodic sampling form when it is determined that the diagnostic data read in an event-triggered form is inconsistent with the diagnostic data read in a periodic sampling form, thereby ensuring that multiple groups of diagnostic data corresponding to multiple consecutive diagnostic events can be received, thereby improving the integrity and accuracy of diagnostic data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A schematic diagram of a flow chart of a diagnostic data transmission method provided by an embodiment of the present invention;
[0046] Figure 2 A schematic diagram of a specific flow chart of a diagnostic data transmission method provided by an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of the structure of a diagnostic data transmission device provided by an embodiment of the present invention;
[0048] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0050] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are 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 includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, components, features, and elements with the same name in different embodiments of the present application may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.
[0051] It should be understood that, although the terms first, second, third, etc. may be used to describe various information in this article, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this article, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein can be interpreted as "at the time of..." or "when..." or "in response to determination". Furthermore, as used in this article, the singular forms "one", "one" and "the" are intended to also include plural forms, unless there is an opposite indication in the context. It should be further understood that the terms "comprising", "including" indicate that there are described features, steps, operations, elements, components, projects, kinds, and / or groups, but do not exclude the existence, occurrence or addition of one or more other features, steps, operations, elements, components, projects, kinds, and / or groups. The terms "or" and "and / or" used herein are interpreted as inclusive, or mean any one or any combination. Thus, “A, B, or C” or “A, B and / or C” means “any of the following: A; B; C; A and B; A and C; B and C; A, B, and C.” An exception to this definition will occur only when a combination of elements, functions, steps, or operations are inherently mutually exclusive in some manner.
[0052] It should be understood that, although the various steps in the flowchart in the embodiment of the present application are displayed in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and it can be performed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and their execution order is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0053] It should be noted that in this article, step codes such as S1 and S2 are used for the purpose of expressing the corresponding content more clearly and concisely, and do not constitute a substantial limitation on the order. When implementing the step, those skilled in the art may execute S2 first and then S1, etc., but these should all be within the scope of protection of this application.
[0054] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0055] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present application, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0056] See also Figure 1 , is a flowchart of a diagnostic data transmission method provided in an embodiment of the present application. The diagnostic data transmission method can be executed by a diagnostic data transmission device provided in an embodiment of the present application. The diagnostic data transmission device can be implemented in software and / or hardware, such as a controller or other electronic device. In this embodiment, taking the execution subject of the diagnostic data transmission method as an electronic device as an example, the diagnostic data transmission method provided in this embodiment includes:
[0057] Step S1, reading diagnostic data corresponding to a diagnostic event from a communication protocol bus in an event-triggered form and a periodic sampling form.
[0058] It can be understood that reading diagnostic data in an event-triggered form is a passive method of reading diagnostic data, that is, only when diagnostic data arrives at a receiving node such as an electronic device, will the receiving node be triggered to receive the diagnostic data. However, this will result in the situation where two or more groups of diagnostic data with relatively close transmission times cannot receive diagnostic data other than the first group of diagnostic data. Because, if the receiving node has not yet completed the reception of the previous group of diagnostic data, and another group of diagnostic data has arrived, then the receiving node is in a state of receiving diagnostic data, so that the other group of diagnostic data cannot trigger the receiving function of the receiving node again, so that the other group of diagnostic data cannot be successfully received. In this case, even if the other group of diagnostic data is stored in the communication protocol bus, it cannot be read by the receiving node in the end. Therefore, in this embodiment, on the basis of the original reading of diagnostic data corresponding to the diagnostic event in the form of event triggering, the diagnostic data corresponding to the diagnostic event is added in the form of periodic sampling to prevent the diagnostic data from being missed, thereby improving the integrity of the diagnostic data transmission. Among them, the communication protocol bus is a CAN bus or a LIN bus.
[0059] Here, reading diagnostic data in the form of periodic sampling is a process of periodically obtaining diagnostic data from the communication protocol bus at fixed time intervals. By reading diagnostic data in the form of periodic sampling, updated information can be obtained regularly to avoid the phenomenon of missing diagnostic data due to failure to normally trigger the receiving node to receive diagnostic data. Here, the sampling period corresponding to reading diagnostic data in the form of periodic sampling can be set according to actual needs, such as 1 millisecond, 2 milliseconds, etc.
[0060] In one embodiment, diagnostic data corresponding to a diagnostic event is read from a communication protocol bus in an event-triggered form and a periodic sampling form, respectively, including: determining whether a diagnostic event is detected from the communication protocol bus; if so, reading the diagnostic data corresponding to the diagnostic event in an event-triggered form; if not, reading the diagnostic data corresponding to the diagnostic event in a periodic sampling form.
[0061] Here, in the absence of a diagnostic event, it is impossible to read the diagnostic data in an event-triggered form, and when there are two or more groups of diagnostic data to be received, there may be a situation where the previous group of diagnostic data has not yet been received and the next group of diagnostic data has arrived, which may cause the receiving node to be unable to receive the signal of the next group of diagnostic data, thereby missing the reception of the next group of diagnostic data. Therefore, when a diagnostic event is detected, the diagnostic data corresponding to the diagnostic event can be received in an event-triggered form, and when no diagnostic event is detected, the diagnostic data can be cyclically read in a periodic sampling form to prevent the diagnostic data of the next diagnostic event from being successfully received due to the close intervals between the continuously sent diagnostic events arriving at the receiving node. In this way, it can be ensured that the diagnostic data corresponding to the continuously sent diagnostic events can be received, so as to ensure the integrity and accuracy of the diagnostic data transmission, and avoid the waste of computing resources caused by invalid diagnostic data reading operations.
[0062] In one embodiment, determining whether a diagnostic event is detected from the communication protocol bus includes: detecting whether a data frame received from the communication protocol bus includes a diagnostic ID, and if so, determining that a diagnostic event is detected.
[0063] It can be understood that the data frame includes a diagnostic data frame and a non-diagnostic data frame. The diagnostic data frame usually contains a diagnostic ID and diagnostic data, and when the sending node sends a diagnostic event, the diagnostic ID and the diagnostic data corresponding to the diagnostic event are sent simultaneously. The diagnostic ID is used to uniquely identify the diagnostic event. Therefore, if the receiving node detects the presence of a diagnostic ID in the data frame while receiving the data frame, it is considered that the data frame is a diagnostic data frame and determines that a diagnostic event is detected. In this way, it is possible to accurately and efficiently determine whether a diagnostic event is detected, facilitate the reading of the diagnostic data corresponding to the diagnostic event, and further improve the integrity and accuracy of diagnostic data transmission.
[0064] In one embodiment, before reading the diagnostic data corresponding to the diagnostic event in the form of periodic sampling, the method further includes: determining a sampling period corresponding to reading the diagnostic data in the form of periodic sampling according to the diagnostic data frame transmission frequency on the communication protocol bus.
[0065] Here, the sampling period corresponding to reading the diagnostic data in the form of periodic sampling can be set according to the different transmission frequencies of the diagnostic data frames on the communication protocol bus, so as to realize reading the transmitted diagnostic data and reduce resource consumption. For example, assuming that the transmission frequency of the diagnostic data frame on the communication protocol bus is 5 milliseconds each time, the sampling period corresponding to reading the diagnostic data in the form of periodic sampling can be set to 5 milliseconds, 6 milliseconds, etc., so as to ensure that the diagnostic data can be read and further improve the integrity of the diagnostic data transmission.
[0066] Step S2, detecting whether the diagnostic data read in the event triggering form is consistent with the diagnostic data read in the periodic sampling form.
[0067] It can be understood that if diagnostic events are triggered continuously in a short period of time, the diagnostic data read in the event-triggered form may be incomplete due to the lag in processing diagnostic data in the event-triggered form, that is, the diagnostic data of some diagnostic events may be missed. Reading diagnostic data in the form of periodic sampling means repeatedly reading diagnostic data from a preset data source such as a sending node within a sampling period. As long as there is diagnostic data in the communication protocol bus, even if it is not read in the current sampling period, it will be read in subsequent sampling periods, so there will be no omission of diagnostic data. Here, by judging whether the diagnostic data read in the event-triggered form is consistent with the diagnostic data read in the periodic sampling form, it is judged whether the output of the diagnostic data read in the event-triggered form will be incomplete.
[0068] In one embodiment, before detecting whether the diagnostic data read in an event-triggered form is consistent with the diagnostic data read in a periodic sampling form, it also includes: determining whether the time taken to read the diagnostic data corresponding to the diagnostic event in an event-triggered form is greater than or equal to a preset time interval; the preset time interval is used to represent the maximum time taken to read the diagnostic data in an event-triggered form; if so, executing the step of detecting whether the diagnostic data read in an event-triggered form is consistent with the diagnostic data read in a periodic sampling form.
[0069] Here, if the time taken to read the diagnostic data corresponding to the diagnostic event in an event-triggered form is longer than the preset time (i.e., the maximum time taken to read the diagnostic data corresponding to the diagnostic event in an event-triggered form determined based on empirical data), it may be because the controller of the receiving node has many running tasks, resulting in excessive load, which leads to a long time for receiving the diagnostic data. As a result, after the next diagnostic event arrives, the receiving node is still receiving the diagnostic data corresponding to the previous diagnostic event, and thus cannot receive the diagnostic data corresponding to the next diagnostic event, so that the diagnostic data read in the event-triggered form is incomplete. Therefore, when it is necessary to output diagnostic data, the time length used to read the diagnostic data corresponding to the diagnostic event in the form of event triggering and the size of the preset time interval can be first determined. If the time length used to read the diagnostic data corresponding to the diagnostic event in the form of event triggering is greater than or equal to the preset time interval, it means that the diagnostic data read by the receiving node in the form of event triggering may be incomplete, and then continue to perform the operation of detecting whether the diagnostic data read in the form of event triggering is consistent with the diagnostic data read in the form of periodic sampling. If the time length used to read the diagnostic data corresponding to the diagnostic event in the form of event triggering is less than the preset time interval, it means that the diagnostic data read by the receiving node in the form of event triggering may be complete, and then there is no need to perform the operation of detecting whether the diagnostic data read in the form of event triggering is consistent with the diagnostic data read in the form of periodic sampling. In this way, by determining whether the time length used to read the diagnostic data corresponding to the diagnostic event in the form of event triggering is greater than or equal to the preset time interval, it can avoid the need to detect whether the diagnostic data read in the form of event triggering is consistent with the diagnostic data read in the form of periodic sampling every time when outputting diagnostic data, effectively reducing the processing complexity and amount of calculation in the transmission of diagnostic data.
[0070] Step S3: when it is determined that the diagnostic data read in the event triggering form is inconsistent with the diagnostic data read in the periodic sampling form, output the diagnostic data read in the periodic sampling form.
[0071] It can be understood that in the embodiment of the present invention, by adding a periodic sampling form to read the diagnostic data, it is possible to read the diagnostic data that is omitted when the diagnostic data is read in an event-triggered form. When the diagnostic data read in an event-triggered form is inconsistent with the diagnostic data read in a periodic sampling form, it is proved that the diagnostic data read in an event-triggered form has omissions or errors and is not suitable to be output as the diagnostic data reading result. At this time, outputting the diagnostic data read in a periodic sampling form can avoid outputting incomplete or erroneous diagnostic data, thereby improving the integrity and accuracy of the output diagnostic data.
[0072] In one embodiment, the diagnostic data transmission method further includes: when it is determined that the time length used to read the diagnostic data corresponding to the diagnostic event in the event-triggered form is less than a preset time interval, outputting the diagnostic data read in the event-triggered form.
[0073] It can be understood that when the time used to read the diagnostic data corresponding to the diagnostic event in an event-triggered form is less than the preset time interval, it is considered that the diagnostic data of the continuous diagnostic event is received normally, the read diagnostic data is complete and correct, and the diagnostic data results read in a time-triggered form can be directly output.
[0074] The diagnostic data transmission method provided by the embodiment of the present invention adds a setting for reading diagnostic data corresponding to diagnostic events from a communication protocol bus in the form of periodic sampling, so that when the diagnostic data read in the event triggering form is inconsistent with the diagnostic data read in the form of periodic sampling, the diagnostic data read in the form of periodic sampling is output, thereby ensuring that multiple groups of diagnostic data corresponding to multiple consecutive diagnostic events can be received, reducing the phenomenon of diagnostic data loss, and improving the integrity and accuracy of diagnostic data transmission.
[0075] Based on the same inventive concept as the above-mentioned embodiment, the diagnostic data transmission method provided by the embodiment of the present invention is described in detail below through a specific example. Figure 2 .
[0076] Step S101, determine whether there is a diagnostic event, if yes, go to step S102, otherwise go to step S103.
[0077] Here, whether there is a diagnostic event can be determined specifically by the diagnostic ID. It can be understood that the diagnostic data frame generally includes the diagnostic ID of the diagnostic event and the corresponding diagnostic data, and the diagnostic ID and the diagnostic data are generally sent and delivered at the same time.
[0078] Step S102 , reading diagnostic data corresponding to a diagnostic event in an event-triggered form.
[0079] Step S103, reading the diagnostic data corresponding to the diagnostic event in a periodic sampling form.
[0080] Step S104, determine whether the reading time is greater than the preset time interval, if so, proceed to step S107, otherwise proceed to step S105.
[0081] Here, the reading duration refers to the time taken to receive the diagnostic data corresponding to the corresponding diagnostic event in an event-triggered form, and the preset duration interval refers to the maximum time taken to receive the diagnostic data corresponding to the diagnostic event in an event form, which is generally determined based on empirical values.
[0082] It can be understood that if the time taken to read the diagnostic data corresponding to a diagnostic event in an event-triggered form is longer than the preset time (i.e., the maximum time taken to read the diagnostic data corresponding to a diagnostic event in an event-triggered form determined based on empirical data), it may be because the controller of the receiving node has many running tasks, resulting in excessive load, which leads to a long time for receiving the diagnostic data. As a result, after the next diagnostic event arrives, the receiving node is still receiving the diagnostic data corresponding to the previous diagnostic event, and thus cannot receive the diagnostic data corresponding to the next diagnostic event, so that the diagnostic data read in the event-triggered form is incomplete. Therefore, when it is necessary to output diagnostic data, the time length used to read the diagnostic data corresponding to the diagnostic event in the form of event triggering and the size of the preset time interval can be first determined. If the time length used to read the diagnostic data corresponding to the diagnostic event in the form of event triggering is greater than or equal to the preset time interval, it means that the diagnostic data read by the receiving node in the form of event triggering may be incomplete, and then continue to perform the operation of detecting whether the diagnostic data read in the form of event triggering is consistent with the diagnostic data read in the form of periodic sampling. If the time length used to read the diagnostic data corresponding to the diagnostic event in the form of event triggering is less than the preset time interval, it means that the diagnostic data read by the receiving node in the form of event triggering may be complete, and then there is no need to perform the operation of detecting whether the diagnostic data read in the form of event triggering is consistent with the diagnostic data read in the form of periodic sampling. In this way, by determining whether the time length used to read the diagnostic data corresponding to the diagnostic event in the form of event triggering is greater than or equal to the preset time interval, it can avoid the need to detect whether the diagnostic data read in the form of event triggering is consistent with the diagnostic data read in the form of periodic sampling every time when outputting diagnostic data, effectively reducing the processing complexity and amount of calculation in the transmission of diagnostic data.
[0083] Step S105 , determining whether the diagnostic data read in the event triggering form is consistent with the diagnostic data read in the periodic sampling form, if so, proceeding to step S106 , otherwise proceeding to step S107 .
[0084] It is understandable that if diagnostic events are triggered continuously in a short period of time, the diagnostic data read in the form of events may miss some diagnostic data of diagnostic events due to the lag in processing speed, resulting in incomplete diagnostic data; while the diagnostic data read in the form of cycles is to repeatedly read the diagnostic data from the communication bus within the sampling cycle. As long as the diagnostic data exists in the communication protocol bus, even if the diagnostic data is not read in the current cycle, it will continue to be read in the subsequent reading cycle, so there will be no omission of diagnostic data. By judging the consistency of the diagnostic data read in the form of event triggering and the diagnostic data read in the form of periodic sampling, and determining the output result according to the judgment result, the correctness of the output diagnostic data can be guaranteed.
[0085] Step S106, outputting the diagnostic data read in an event-triggered form.
[0086] Step S107, outputting the diagnostic data read in the form of periodic sampling.
[0087] The diagnostic data transmission method provided by the embodiment of the present invention adds a setting for reading diagnostic data corresponding to diagnostic events from a communication protocol bus in the form of periodic sampling, so that when the diagnostic data read in the event triggering form is inconsistent with the diagnostic data read in the form of periodic sampling, the diagnostic data read in the form of periodic sampling is output, thereby ensuring that multiple groups of diagnostic data corresponding to multiple consecutive diagnostic events can be received, reducing the phenomenon of diagnostic data loss, and improving the integrity and accuracy of diagnostic data transmission.
[0088] Based on the same inventive concept as the above embodiments, the present invention provides a diagnostic data transmission device. Figure 3 As shown, the diagnostic data transmission device includes:
[0089] The reading module 1 is used to read the diagnostic data corresponding to the diagnostic event from the communication protocol bus in the event triggering form and the periodic sampling form respectively;
[0090] Detection module 2, detecting whether the diagnostic data read in the event triggering form is consistent with the diagnostic data read in the periodic sampling form;
[0091] The output module 3 outputs the diagnostic data read in the form of periodic sampling when it is determined that the diagnostic data read in the form of event triggering is inconsistent with the diagnostic data read in the form of periodic sampling.
[0092] In one embodiment, the diagnostic data transmission device further includes:
[0093] The judging module 4 is used to judge whether a diagnostic event is detected from the communication protocol bus.
[0094] The reading module 1 is specifically used for:
[0095] If a diagnostic event is detected, the diagnostic data corresponding to the diagnostic event is read in an event-triggered form;
[0096] If no diagnostic event is detected, the diagnostic data corresponding to the diagnostic event is read in a periodic sampling form.
[0097] In one implementation, the judgment module 4 is specifically used to:
[0098] It is detected whether the data frame received from the communication protocol bus contains the diagnostic ID. If so, it is determined that a diagnostic event is detected.
[0099] In one embodiment, the diagnostic data transmission device further includes:
[0100] The setting module 5 is used to determine the sampling period corresponding to reading the diagnostic data in the form of periodic sampling according to the transmission frequency of the diagnostic data frame on the communication protocol bus.
[0101] In one implementation, the judgment module 4 is further used for:
[0102] Determine whether the time taken to read the diagnostic data corresponding to the diagnostic event in an event-triggered manner is greater than or equal to a preset time interval; the preset time interval is used to represent the maximum time taken to read the diagnostic data in an event-triggered manner.
[0103] In one embodiment, the detection module 2 is specifically used for:
[0104] When the time length used for reading the diagnostic data corresponding to the diagnostic event in the event-triggered form is greater than or equal to the preset time interval, a step of detecting whether the diagnostic data read in the event-triggered form is consistent with the diagnostic data read in the periodic sampling form is performed.
[0105] In one embodiment, the output module 3 is specifically used to: when it is determined that the time length used to read the diagnostic data corresponding to the diagnostic event in the event-triggered form is less than the preset time interval, output the diagnostic data read in the event-triggered form.
[0106] The diagnostic data transmission device provided in the embodiment of the present invention reads the diagnostic data corresponding to the diagnostic event from the communication protocol bus in a periodic sampling form, thereby ensuring that multiple groups of diagnostic data continuously transmitted on the communication protocol bus can be successfully received, thereby improving the accuracy of diagnostic data transmission.
[0107] For the specific definition of the diagnostic data transmission device, please refer to the definition of the diagnostic data transmission method above, which will not be repeated here. Each module in the above-mentioned diagnostic data transmission device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor of the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0108] Based on the same inventive concept as the above embodiments, an embodiment of the present invention provides an electronic device, such as Figure 4 As shown, the electronic device includes: a processor 310 and a memory 311 storing a computer program; wherein, Figure 4 The processor 310 shown in the figure is not used to indicate that the number of the processor 310 is one, but is only used to indicate the positional relationship of the processor 310 relative to other devices. In actual applications, the number of the processor 310 may be one or more; similarly, Figure 4The memory 311 shown in the figure has the same meaning, that is, it is only used to refer to the position relationship of the memory 311 relative to other devices. In practical applications, the number of memories 311 can be one or more. When the processor 310 runs the computer program, the above diagnostic data transmission method is implemented.
[0109] The electronic device may also include: at least one network interface 312. The various components in the electronic device are coupled together via a bus system 313. It is understood that the bus system 313 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 313 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 313 is not used in the following examples. Figure 4 Various buses are labeled as bus system 313.
[0110] The memory 311 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. The nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory may be a disk memory or a tape memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), direct memory bus random access memory (DRRAM). The memory 311 described in the embodiments of the present invention is intended to include but is not limited to these and any other suitable types of memory.
[0111] The memory 311 in the embodiment of the present invention is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program used to operate on the electronic device.
[0112] Based on the same inventive concept as the above-mentioned embodiment, this embodiment further provides a computer-readable storage medium, in which a computer program is stored. The computer-readable storage medium may be a magnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); or various devices including one or any combination of the above-mentioned memories, such as a server. When the instructions stored therein are executed by a processor, the diagnostic data transmission method described in the above-mentioned embodiment is implemented.
[0113] Based on the same inventive concept as the aforementioned embodiments, the present application provides a vehicle, which includes the electronic device provided by the aforementioned embodiments, wherein the communication protocol bus is a CAN bus or a LIN bus.
[0114] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0115] In this document, the terms "comprises," "comprising," or any other variations thereof, are intended to cover a non-exclusive inclusion of elements other than those listed and may also include additional elements not expressly listed.
[0116] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A diagnostic data transmission method, characterized in that: include: Reading the diagnostic data corresponding to the diagnostic event from the communication protocol bus in the event triggering form and the periodic sampling form respectively; Check whether the diagnostic data read in the event triggering form is consistent with the diagnostic data read in the periodic sampling form; When it is determined that the diagnostic data read in the event trigger form and the diagnostic data read in the periodic sampling form are inconsistent, the diagnostic data read in the periodic sampling form is output.
2. The method according to claim 1, characterized in that: The method of reading the diagnostic data corresponding to the diagnostic event from the communication protocol bus in an event-triggered form and a periodic sampling form respectively includes: Determine whether a diagnostic event is detected from the communication protocol bus; If so, reading the diagnostic data corresponding to the diagnostic event in an event-triggered form; If not, the diagnostic data corresponding to the diagnostic event is read in a periodic sampling form.
3. The method according to claim 2, characterized in that The determining whether a diagnostic event is detected from the communication protocol bus includes: It is detected whether the data frame received from the communication protocol bus contains the diagnostic ID. If so, it is determined that a diagnostic event is detected.
4. The method according to claim 2, characterized in that: Before reading the diagnostic data corresponding to the diagnostic event in a periodic sampling form, the method further includes: According to the transmission frequency of the diagnostic data frame on the communication protocol bus, a sampling period corresponding to reading the diagnostic data in the form of periodic sampling is determined.
5. The method according to claim 1, characterized in that Before the detection of whether the diagnostic data read in the event triggering form is consistent with the diagnostic data read in the periodic sampling form, the method further includes: Determine whether the time taken to read the diagnostic data corresponding to the diagnostic event in an event-triggered manner is greater than or equal to a preset time interval; the preset time interval is used to represent the maximum time taken to read the diagnostic data in an event-triggered manner; If yes, a step of detecting whether the diagnostic data read in the event-triggered form is consistent with the diagnostic data read in the periodic sampling form is performed.
6. The method according to claim 5, characterized in that Also includes: When it is determined that the time length used to read the diagnostic data corresponding to the diagnostic event in an event-triggered manner is less than the preset time interval, the diagnostic data read in an event-triggered manner is output.
7. A diagnostic data transmission device, characterized in that: include: A reading module, used for reading diagnostic data corresponding to diagnostic events from the communication protocol bus in an event-triggered form and a periodic sampling form respectively; A detection module, detecting whether the diagnostic data read in the event triggering form is consistent with the diagnostic data read in the periodic sampling form; The output module outputs the diagnostic data read in the form of periodic sampling when it is determined that the diagnostic data read in the form of event triggering is inconsistent with the diagnostic data read in the form of periodic sampling.
8. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the diagnostic data transmission method according to any one of claims 1 to 6.
9. A vehicle, characterized in that: The vehicle comprises the electronic device as claimed in claim 8, wherein the communication protocol bus is a CAN bus or a LIN bus.
10. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor, the diagnostic data transmission method according to any one of claims 1 to 6 is implemented.
