Bus diagnosis file generation method and device, electronic equipment and storage medium
By extracting message signals from the hardware schematic diagram and automatically generating bus diagnostic files, the problem of low efficiency in generating bus diagnostic files in the prior art is solved, efficient file generation is achieved, process is simplified, efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411072236.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-11-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology generates bus diagnostic files inefficiently, and developers need to manually add messages and organize signal tables. The process is complicated and cumbersome, especially in large semaphore projects, which requires a lot of time and effort.
By obtaining the hardware schematic diagram of the target device, determining the pin properties of each pin, classifying the pins based on these properties, generating messages of various pin types, and generating bus diagnostic files based on the messages, reducing manual Adding messages and sorting out signal tables.
It realizes automatic generation of bus diagnostic files, improves generation efficiency, reduces repetitive work, simplifies processes, and improves efficiency and accuracy.
Smart Images

Figure CN118939492A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and computer-readable storage medium for generating a bus diagnostic file. Background Art
[0002] In order to debug the bus, a bus test tool can be used and a bus diagnostic file can be loaded into it, so that a test signal can be sent to the bus of the device under test or a signal can be read from the device under test, and the signal analysis function can be realized.
[0003] For example, the bus diagnostic file can be a DBC (Database Container) file, which is a CAN (Controller Area Network) bus database file that contains all communication information on the CAN bus, such as message ID, signal, signal parsing rules, etc. The DBC file describes the communication information on the CAN bus and provides key information for parsing and analyzing CAN bus data, thereby realizing data exchange and communication in the CAN bus network.
[0004] Usually, bus diagnostic files are generated by signal tables or by manually adding signals and messages using software. The method of generating bus diagnostic files from signal tables has a relatively complicated operation process, and the method of manually adding signals is particularly cumbersome, especially for projects with a large number of signals. Generating a bus diagnostic file requires a lot of time and effort. Summary of the invention
[0005] In view of this, in order to solve some or all of the above technical problems, the embodiments of the present application provide a method, device, electronic device and computer-readable storage medium for generating a bus diagnostic file.
[0006] In a first aspect, an embodiment of the present application provides a method for generating a bus diagnostic file, the method comprising: obtaining a hardware schematic diagram of a target device; determining the pin attributes of each pin of the target device from the hardware schematic diagram; classifying the pins of the target device based on the pin attributes to obtain at least one pin type; for each pin type of at least one pin type, generating a message corresponding to the pin type based on the pin attributes of each pin included in the pin type; and generating a bus diagnostic file for performing bus diagnosis on the target device based on the generated message corresponding to each pin type.
[0007] In a possible implementation, determining the pin attributes of each pin of the target device from the hardware schematic diagram includes: determining the name and signal transmission direction of each pin of the target device from the hardware schematic diagram; and determining the name and signal transmission direction as the pin attributes of the pin.
[0008] In one possible implementation, for each pin type in at least one pin type, a message corresponding to the pin type is generated based on the pin attributes of each pin included in the pin type, including: for each pin type in at least one pin type, based on the pin attributes of each pin included in the pin type, generating message attributes corresponding to the pin type; based on the message attributes, generating a message number; based on the message number and the message attributes, generating a message corresponding to the pin type.
[0009] In one possible implementation, pin attributes include a pin name and a signal transmission direction; based on the pin attributes of each pin included in the pin type, a message attribute corresponding to the pin type is generated, including: based on the pin name of each pin included in the pin type, a message name is generated; based on the signal transmission direction of the pins included in the pin type, message direction information is generated; signal length information corresponding to the pins included in the pin type is determined; a message data volume corresponding to the pin type is determined; based on the message name, message direction information, signal length information, and message data volume, a message attribute corresponding to the pin type is generated.
[0010] In one possible implementation, based on the message name, message direction information, signal length information, and message data volume, message attributes corresponding to the pin type are generated, including: obtaining the message period corresponding to the set pin type; based on the message name, message direction information, signal length information, message data volume and message period, generating the message attributes corresponding to the pin type.
[0011] In one possible implementation, based on a message number and a message attribute, a message corresponding to the pin type is generated, including: determining the total amount of data transmitted by the pins included in the pin type; if the total amount of data exceeds a preset amount of data, splitting the pins included in the pin type to obtain at least two pin groups, wherein the preset amount of data is the maximum amount of data for each message; based on the message attributes corresponding to the pin type, generating sub-message attributes corresponding to each pin group; based on the message number, determining the sub-message number corresponding to each pin group; and based on the sub-message attributes and sub-message numbers corresponding to at least two pin groups, generating at least two messages corresponding to the pin type.
[0012] In one possible implementation, based on the message attributes corresponding to the pin type, sub-message attributes corresponding to each pin group are generated, including: on the basis of the message name contained in the message attributes corresponding to the pin type, according to a preset message name naming rule, the sub-message name corresponding to each pin group is set in sequence; based on the sub-message name corresponding to each pin group, the signal length information corresponding to the pins included in each pin group, the message data volume corresponding to each pin group and the signal transmission direction information of the pins included in each pin group, the sub-message attributes corresponding to each pin group are generated.
[0013] In a second aspect, an embodiment of the present application provides a device for generating a bus diagnostic file, the device comprising: an acquisition module for acquiring a hardware schematic diagram of a target device; a determination module for determining the pin attributes of each pin of the target device from the hardware schematic diagram; a classification module for classifying the pins of the target device based on the pin attributes to obtain at least one pin type; a first generation module for generating, for each pin type in at least one pin type, a message corresponding to the pin type based on the pin attributes of each pin included in the pin type; and a second generation module for generating a bus diagnostic file for performing bus diagnosis on the target device based on the generated message corresponding to each pin type.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory for storing a computer program; a processor for executing the computer program stored in the memory, and when the computer program is executed, a method of any embodiment of the method for generating a bus diagnostic file of the first aspect of the present application is implemented.
[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method of any embodiment of the method for generating a bus diagnostic file of the first aspect described above is implemented.
[0016] In a fifth aspect, an embodiment of the present application provides a computer program, which includes a computer readable code. When the computer readable code runs on a device, the processor in the device implements a method of any embodiment of the method for generating a bus diagnostic file in the first aspect mentioned above.
[0017] The bus diagnostic file generation method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application obtain the hardware schematic diagram of the target device, determine the pin attributes of each pin of the target device from the hardware schematic diagram, classify the pins of the target device based on the pin attributes, generate a message corresponding to each pin type for the pin attributes of each pin included in each pin type, and finally generate a bus diagnostic file for bus diagnosis of the target device based on the generated messages. The embodiments of the present application realize the generation of bus diagnostic files using hardware schematic diagrams, without the need for developers to manually add messages or organize signal tables, reducing a large amount of repetitive work, thereby improving the efficiency of generating bus diagnostic files. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0019] In order to more clearly illustrate the embodiments of the present application 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.
[0020] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0021] Figure 1 A flowchart of a method for generating a bus diagnostic file provided in an embodiment of the present application;
[0022] Figure 2 A flowchart of another method for generating a bus diagnostic file provided in an embodiment of the present application;
[0023] Figure 3 A flowchart of another method for generating a bus diagnostic file provided in an embodiment of the present application;
[0024] Figure 4 A flowchart of another method for generating a bus diagnostic file provided in an embodiment of the present application;
[0025] Figure 5 A flowchart of another method for generating a bus diagnostic file provided in an embodiment of the present application;
[0026] Figure 6A schematic diagram of the structure of a device for generating a bus diagnostic file provided in an embodiment of the present application;
[0027] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. It should be noted that unless otherwise specifically stated, the relative arrangement of the components and steps, the numerical expressions and the numerical values described in these embodiments do not limit the scope of the present application.
[0029] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of the present application are only used to distinguish between different steps, devices, modules and other objects, and do not represent any specific technical meanings, nor do they indicate the logical order between them.
[0030] It should also be understood that in this embodiment, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.
[0031] It should also be understood that any component, data or structure mentioned in the embodiments of the present application can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.
[0032] In addition, the term "and / or" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.
[0033] It should also be understood that the description of the various embodiments in this application focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.
[0034] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present application, its application, or uses.
[0035] Technologies, circuits, and devices known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the above-mentioned technologies, circuits, and devices should be considered as part of the specification.
[0036] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0037] It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. To facilitate the understanding of the embodiments of the present application, the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0038] In order to solve the technical problem of low efficiency in generating bus diagnostic files in the prior art, the present application provides a method for generating a bus diagnostic file, which can extract message signals from hardware schematics and automatically generate a bus diagnostic file, thereby improving the efficiency of generating a bus diagnostic file.
[0039] Figure 1 A flow chart of a method for generating a bus diagnostic file provided in an embodiment of the present application. This method can be applied to one or more electronic devices such as desktop computers, portable computers, notebook computers, smart phones, servers, etc., and one or more electronic devices analyze the schematic diagram to generate a bus diagnostic file. In addition, the execution subject of this method can be hardware or software. When the above-mentioned execution subject is hardware, the execution subject can be one or more of the above-mentioned electronic devices. For example, a single electronic device can execute this method, or multiple electronic devices can cooperate with each other to execute this method. When the above-mentioned execution subject is software, this method can be implemented as multiple software or software modules, or it can be implemented as a single software or software module. It is not specifically limited here.
[0040] like Figure 1 As shown, the method specifically includes:
[0041] Step 101, obtaining a hardware schematic diagram of a target device.
[0042] In this embodiment, the target device may be a chip or a circuit composed of discrete components. The hardware schematic diagram may be in various formats, such as schdoc, ddb, pdf, etc.
[0043] Step 102: Determine the pin attribute of each pin of the target device from the hardware schematic diagram.
[0044] In this embodiment, the pin attributes can be set when drawing the schematic diagram. The pin attributes may include information such as the pin name, pin number, and signal transmission direction. Generally, if the hardware schematic diagram is an original file generated using schematic drawing software, such as a file in a format such as schdoc, ddb, etc., the hardware schematic diagram may contain the pin attributes of each pin, and the electronic device may directly extract the pin attributes. If the hardware schematic diagram is an image file, the image can be recognized, the information marked on each pin can be extracted, and the pin attributes can be obtained.
[0045] Step 103: classify the pins of the target device based on the pin attributes to obtain at least one pin type.
[0046] In this embodiment, the pin attribute of each pin can indicate the type to which the pin belongs, thereby classifying each pin. For example, the pin type may include ADC, CAN, LIN, DIO, PWM, ICU, etc. Further, each type in the above examples may be further classified. For example, it may be classified according to the signal transmission direction, that is, ADC is further divided into ADC_IN, ADC_OUT, etc., and CAN is further divided into CAN_DO, CAN_DI, etc. The further divided type is one of the types included in the above at least one type.
[0047] When classifying pins, it is also necessary to determine whether each pin is a pin that needs to generate a message. Usually, when a pin is classified as ADC, DIO, CAN, PWM, ICU, etc., the pin needs to be configured to generate the corresponding message. When the pin is SPI, IIC, etc., since the data transmitted by the pin is usually verified in the code, there is no need to configure the pin to generate a message.
[0048] As an example, when the pin is classified as CAN, a CAN communication message needs to be generated. One CAN generates two groups of communication messages, namely, a send message and a receive message. Taking the MCU as the host as an example, the send message is a communication content containing 5 bytes. In addition, it can be determined whether to add a new signal based on whether there is a CAN chip control signal. The CAN chip control signal includes CAN1_DO_EN, CAN1_DO_STB, etc. The naming feature of the control signal is that the name contains both DO and CAN. When a pin with this naming feature is found, the signal generated by this pin is added to the send message; the receive message is a communication content containing 5 bytes. In addition, it can be determined whether to add a new signal based on the diagnostic information signal. The diagnostic information signal includes CAN1_DI_ERR, CAN1_DI_INH, etc. The naming feature of the diagnostic information signal is that the name contains both DI and CAN. When a pin with this naming feature is found, the signal generated by this pin is added to the receive message.
[0049] Step 104: for each pin type in at least one pin type, generate a message corresponding to the pin type based on the pin attribute of each pin included in the pin type.
[0050] In this embodiment, different pin types may correspond to one or more messages. The key information of the message may be generated according to the pin attributes, and the message may contain data transmitted by at least one pin of the same type. As an example, the key information of the message may include information such as the message number (ID), the message name, the length of the signal carried, the transmission direction, etc. The signal carried by the message and the above key information are combined to generate a message.
[0051] Step 105: Generate a bus diagnosis file for performing bus diagnosis on the target device based on the generated message corresponding to each pin type.
[0052] In this embodiment, the bus diagnostic file is used to diagnose bus data on the target device that complies with a certain protocol. The bus diagnostic file can be imported into a bus diagnostic tool (such as CANoe), and the technician can use the tool to perform diagnostic tests on the target device.
[0053] Usually, the various information included in the above message attributes (such as message name, message direction information, message ID, message data volume, message cycle, etc.) can be set as a database, and then all the contents of this database, as well as the message type, the data contained in the message, and other information set in advance are written to the array in the script. When the developer needs to use this script to generate a bus diagnostic file, run this script, and the script code will output all the signals and message information in all arrays as a bus diagnostic file. If the developer needs to add custom signals and messages later, they can add them based on this bus diagnostic file.
[0054] As an example, the bus diagnostic file can be a DBC (Database Container) file, which is a file format used to describe messages and signals on the CAN bus. The DBC file contains information such as the ID of each message, the start bit and length of the signal, the unit, factor and offset of the signal. (A message is composed of one or more signals. The signal is the part of the message that carries data and describes the meaning, unit, range, etc. of specific data in the message).
[0055] The meanings of the above parameters are as follows:
[0056] Message ID (Identifier): A unique identifier used to identify a message. In CAN bus communication, different messages are distinguished by their IDs. The ID usually consists of 11 bits or 29 bits, depending on the CAN standard used. The ID can distinguish which node sent the message.
[0057] The start bit and length of the signal: describes the position of the signal in the message and the number of bits it occupies. The start bit indicates the starting position of the signal in the message (starting from the highest or lowest bit), while the length indicates the number of bits occupied by the signal.
[0058] Signal unit: indicates the data unit of the signal, such as temperature, speed, voltage, etc. The unit enables the receiver to correctly interpret and process the value of the signal.
[0059] Factor: A multiplication factor used to convert a signal into a numerical value. The received raw signal value will be multiplied by the factor to obtain the final physical value.
[0060] Offset: The offset used to convert the signal into a numerical value. The offset is added to the received raw signal value before it is multiplied by the factor to get the final physical value.
[0061] DBC files are usually used to configure node devices on the CAN bus, such as communication between automotive electronic control units (ECUs). DBC files can also be used to parse and analyze CAN bus data so that developers can better understand and process data on the CAN bus.
[0062] When using the DBC file, you can first configure the node device on the CAN bus, then configure the above signal parameters, and finally import the DBC file into the node device, such as into the ECU, so that the ECU can perform CAN bus communication according to the rules defined in the DBC file.
[0063] Developers can also use the message structure and signal attributes defined in the DBC file to parse the raw data transmitted on the CAN bus. By identifying the message ID and the signal start bit, the corresponding signal data can be extracted. According to the properties of the signal such as unit, factor and offset, the raw data is converted into a numerical value with physical meaning. In this way, developers can understand the meaning of the data transmitted on the CAN bus. The physical values obtained by parsing can be used for applications such as data analysis, system status monitoring, and fault diagnosis. Developers can make relevant logical judgments and processing based on these data.
[0064] DBC files can also be used to debug and optimize CAN bus communications, such as checking the sending and receiving of messages, optimizing message transmission efficiency, etc.
[0065] The method for generating a bus diagnostic file provided in an embodiment of the present application obtains a hardware schematic diagram of a target device, determines the pin attributes of each pin of the target device from the hardware schematic diagram, classifies the pins of the target device based on the pin attributes, generates a message corresponding to each pin type for the pin attributes of each pin included in each pin type, and finally generates a bus diagnostic file for bus diagnosis of the target device based on the generated messages. The embodiment of the present application realizes the generation of a bus diagnostic file using a hardware schematic diagram, without the need for developers to manually add messages or organize signal tables, reducing a large amount of repetitive work, thereby improving the efficiency of generating a bus diagnostic file.
[0066] In some optional implementations of this embodiment, such as Figure 2 As shown, step 102 includes:
[0067] Step 1021, determine the name and signal transmission direction of each pin of the target device from the hardware schematic diagram.
[0068] Step 1022: determine the name and signal transmission direction as pin attributes of the pin.
[0069] Specifically, the pin name and transmission direction indicate the main characteristics of the pin. According to the pin name and transmission direction, the signal type, data length, physical meaning and other information transmitted by the pin can be determined.
[0070] Generally, in order to improve the accuracy and efficiency of generating bus diagnostic files, the embodiments of the present application have certain format requirements for the pin names and transmission directions of the hardware schematic diagram. Specifically, they include:
[0071] 1. The chip (e.g. MCU) tab needs to be named as the chip type (e.g. the name contains MCU).
[0072] 2. The pins of each module need to be named with common English abbreviations. For example, the pin name of the ADC module is ADC_XX_XX, the pin name of the DIO module is DI_XX_XX or DO_XX_XX, the pin name of the CAN module is CANX_XX_XX, the pin name of the LIN module is LINX_XX_XX, etc.
[0073] 3. Pins with input and output directions need to have arrows drawn according to the directions, and the names need to be related to the input and output directions. For example, the name of the DO signal needs to have the word OUT, and the arrow of this pin faces outward; the name of the DI signal needs to have the word IN, and the arrow of this pin faces inward.
[0074] As an example, all pins can be classified according to the names of the pins on the MCU in the hardware schematic diagram. For example, the first letter of the ADC module signal is ADC_, the first letter of the DO module signal is DO_, the first letter of the HSD module signal is HSD_ (which can be HSD1_DO_EN, HSD2_2A_OUT1), etc. All signals are classified according to the letters before the first horizontal line of the signal name. If a horizontal line is preceded by a combination of the same letters and different numbers, such as HSD1_DO_EN, HSD2_DO_EN, then they need to be divided into two different categories, and different categories correspond to different messages.
[0075] According to the direction of signal transmission, the above initial pin types can be further classified. For example, according to the direction of the arrows of each pin of the MCU on the schematic diagram, determine whether the signal generated by the pin is a sending signal or a receiving signal. The arrow facing inward indicates that it is an input signal for the MCU end, that is, the MCU receives the signal, and the arrow facing outward indicates that it is an output signal for the MCU end, that is, the MCU sends the signal. After determining whether the signal corresponding to each pin is a sending signal or a receiving signal, pins with the same initial pin type and the same signal direction can be classified into the same pin type.
[0076] This embodiment extracts the pin name and signal transmission direction of each pin as pin attributes, and can effectively utilize the pin attribute format specified in the schematic diagram to accurately divide each pin into at least one type, thereby helping to improve the generation efficiency and accuracy of the message corresponding to each pin type.
[0077] In some optional implementations of this embodiment, such as Figure 3 As shown, step 104 includes:
[0078] Step 1041: for each pin type in at least one pin type, based on the pin attributes of each pin included in the pin type, generate a message attribute corresponding to the pin type.
[0079] The message attributes include key information of the message, and the function of the message can be limited based on the key information. For example, the key information includes the message name, signal transmission direction, signal length, etc.
[0080] Step 1042: Generate a message number based on the message attributes.
[0081] Among them, the message number can also be called the message ID, which is used to distinguish different messages. Optionally, the setting principle of the message number can be related to the signal transmission direction. For example, the ID can be specified as starting from hexadecimal 0x100 (the highest bit is 1, indicating that this message is a received message) and 0x200 (the highest bit is 2, indicating that this message is a sent message), and the final message ID is determined according to the letter and Arabic numeral sequence of the message name. For example, if the ID of message ADC1_OUT is 0x200, the ID of message ADC2_OUT is 0x201; if the ID of message DO1_IN is 0x105, the ID of message DO2_IN is 0x106.
[0082] Step 1043: Generate a message corresponding to the pin type based on the message number and message attributes.
[0083] Specifically, the above-mentioned message attributes and message numbers may be combined, and may also be combined with other information (such as signal units, factors, offsets, etc.) to generate a message corresponding to the pin type.
[0084] This embodiment can automatically generate messages corresponding to different types of pins by generating message attributes and message numbers. The generated messages can accurately distinguish the functions of the messages, which helps to improve the accuracy of generating bus diagnostic files.
[0085] In some optional implementations of this embodiment, the pin attributes include pin names and signal transmission directions. The pin names and signal transmission directions can refer to the above Figure 2 The content described in the corresponding embodiment.
[0086] like Figure 4 As shown, step 1041 includes:
[0087] Step 10411, generating a message name based on the pin name of each pin included in the pin type.
[0088] The message name can be generated based on the pin name. For example, if the pin names of multiple pins of a pin type all contain ADC_OUT_XXX, the message name is ADC_OUT.
[0089] Step 10412: Generate message direction information based on the signal transmission direction of the pin included in the pin type.
[0090] Each pin type in the at least one pin type corresponds to the same signal transmission direction, that is, the message direction information of a message can indicate that the message is a receiving message or a sending message.
[0091] Step 10413, determine the signal length information corresponding to the pins included in the pin type.
[0092] The signal length information indicates the length of a single signal transmitted by the generated message, for example, the length of an ADC signal is 16 bits, the length of a DO signal is 2 bits, the length of a DI signal is 1 bit, and so on.
[0093] Step 10414, determine the amount of message data corresponding to the pin type.
[0094] The message data volume is the total number of bytes of the signal sent or received by the message.
[0095] Step 10415, based on the message name, message direction information, signal length information, and message data volume, generate the message attributes corresponding to the pin type.
[0096] The message name, message direction information, signal length information, and message data volume can be used as key information of the message, that is, these key information can be used as message attributes. In addition, other information can also be used as message attributes, such as signal units, factors, offsets, etc.
[0097] This embodiment generates a message name, message direction information, message signal length information, and message data volume, and generates message attributes from this information, thereby setting attributes for messages corresponding to different types of pins, so that the generated messages can express the functions of the corresponding types of pins, thereby improving the accuracy of the generated messages and improving the pertinence of diagnosing the target device using the bus diagnostic file.
[0098] In some optional implementations of this embodiment, the above step 10415 may include the following sub-steps:
[0099] First, obtain the message period corresponding to the set pin type.
[0100] The message period is the period for sending or receiving messages to or from the target device. The message period can be set in advance. Usually, the period of ordinary messages can be set to 10ms, and the period of memory-related messages can be set to 100ms.
[0101] Then, based on the message name, message direction information, signal length information, message data volume and message period, the message attributes corresponding to the pin type are generated.
[0102] This embodiment uses the message period as one of the key information of the message, so that the sending and receiving of the message can be more accurately controlled by using the message attribute, and the pertinence of using the bus diagnostic file to diagnose the target device is further improved.
[0103] In some optional implementations of this embodiment, such as Figure 5 As shown, step 1043 includes:
[0104] Step 10431, determine the total amount of data transmitted by the pins included in the pin type.
[0105] The pin type in this embodiment and one of the above-mentioned at least one pin type. The total data volume can be determined based on the number of pins included in the pin type, the length of the signal transmitted by each pin each time, and other information. For a pin type, the length of the signal transmitted by each pin in the pin type can be accumulated to determine the total quantity.
[0106] Step 10432: If the total data volume exceeds the preset data volume, the pins included in the pin type are split to obtain at least two pin groups.
[0107] The preset data volume is the maximum data volume of each message. As an example, usually, the preset data volume is 8 bytes, that is, each message transmits a maximum of 8 bytes of data. When grouping pins, the transmitted data volume can be accumulated. If it exceeds the preset data volume, a new message is created until the pins under the pin type are grouped.
[0108] Step 10433: Generate sub-message attributes corresponding to each pin group based on the message attributes corresponding to the pin type.
[0109] Among them, the sub-message attributes can be generated based on the message attributes of the corresponding pin type. For example, the data volume corresponding to each pin group can be used as the data volume of the newly created message. A new message name can also be set based on the original message name to generate sub-message attributes.
[0110] Step 10434, based on the message number, determine the sub-message number corresponding to each pin group.
[0111] Specifically, on the basis of the above message numbers, the sub-message numbers corresponding to each pin group can be set in sequence according to the preset number sorting rules. For example, after the pins of the ADC_OUT type are grouped, the message numbers of each pin group can be increased by 1 one by one on the basis of the message number 0x200, that is, if the ID of ADC1_OUT is 0x200, the ID of message ADC2_OUT is 0x201. If the ID of message DIO1_IN is 0x105, the ID of message DIO2_IN is 0x106.
[0112] Step 10435: Generate at least two messages corresponding to the pin type based on the sub-message attributes and sub-message numbers corresponding to at least two pin groups.
[0113] Specifically, corresponding sub-message attributes and sub-message numbers, as well as signals transmitted by corresponding pin groups, are combined to generate at least two messages. The generated at least two messages correspond to the same pin type, for example, a pin of type ADC_OUT corresponds to two messages ADC1_OUT and ADC2_OUT.
[0114] This embodiment sets an upper limit on the data volume of each message, and decomposes the message corresponding to each pin classification into multiple messages based on the upper limit, thereby helping to standardize the message format, facilitate management of messages of the same type, and improve the accuracy of diagnosis of the target device based on the bus diagnostic file.
[0115] In some optional implementations of this embodiment, the above step 10433 may include the following sub-steps:
[0116] Step 1: On the basis of the message name contained in the message attribute corresponding to the pin type, and according to a preset message name naming rule, the sub-message name corresponding to each pin group is set in sequence.
[0117] As an example, for a message corresponding to the ADC_OUT type, a number can be added to each sub-message name corresponding to each pin branch based on the message name ADC_OUT, that is, the sub-message name is ADC1_OUT, ADC2_OUT, etc. For a message corresponding to the DIO_IN type, the sub-message name is DIO1_IN, DIO2_IN, etc.
[0118] Step two, based on the sub-message name corresponding to each pin group, the signal length information corresponding to the pins included in each pin group, the message data volume corresponding to each pin group and the signal transmission direction information of the pins included in each pin group, generate the sub-message attributes corresponding to each pin group.
[0119] The maximum value of the message data volume included in the sub-message attribute is the above-mentioned preset data volume. The signal transmission direction information and signal length information remain unchanged.
[0120] This embodiment sets the sub-message name according to the naming rule of the message name, thereby achieving orderly management of messages of the same type and improving the efficiency of diagnosing the target device based on the bus diagnosis file.
[0121] Figure 6 A schematic diagram of a bus diagnostic file generation device provided in an embodiment of the present application. Specifically comprising:
[0122] An acquisition module 601 is used to acquire a hardware schematic diagram of a target device;
[0123] A determination module 602 is used to determine the pin attribute of each pin of the target device from the hardware schematic diagram;
[0124] A classification module 603, configured to classify pins of a target device based on pin attributes to obtain at least one pin type;
[0125] A first generating module 604 is used to generate, for each pin type in at least one pin type, a message corresponding to the pin type based on the pin attribute of each pin included in the pin type;
[0126] The second generating module 605 is used to generate a bus diagnosis file for performing bus diagnosis on the target device based on the generated message corresponding to each pin type.
[0127] In some optional implementations of this embodiment, the determination module includes: a first determination unit, used to determine the name and signal transmission direction of each pin of the target device from the hardware schematic diagram; and a second determination unit, used to determine the name and signal transmission direction as pin attributes of the pin.
[0128] In some optional implementations of this embodiment, the first generation module includes: a first generation unit, used to generate, for each pin type in at least one pin type, a message attribute corresponding to the pin type based on the pin attributes of each pin included in the pin type; a second generation unit, used to generate a message number based on the message attributes; and a third generation unit, used to generate a message corresponding to the pin type based on the message number and the message attributes.
[0129] In some optional implementations of this embodiment, the pin attributes include a pin name and a signal transmission direction; the first generating unit includes: a first generating sub-unit, used to generate a message name based on the pin name of each pin included in the pin type; a second generating sub-unit, used to generate message direction information based on the signal transmission direction of the pins included in the pin type; a first determining sub-unit, used to determine the signal length information corresponding to the pins included in the pin type; a second determining sub-unit, used to determine the message data volume corresponding to the pin type; the second generating sub-unit, used to generate the message attributes corresponding to the pin type based on the message name, message direction information, signal length information, and message data volume.
[0130] In some optional implementations of this embodiment, the second generating subunit is further used to: obtain the message period corresponding to the set pin type; generate message attributes corresponding to the pin type based on the message name, message direction information, signal length information, message data volume and message period.
[0131] In some optional implementations of this embodiment, the third generation unit includes: a third determination subunit, used to determine the total data volume transmitted by the pins included in the pin type; a splitting subunit, used to split the pins included in the pin type if the total data volume exceeds the preset data volume, so as to obtain at least two pin groups, wherein the preset data volume is the maximum data volume of each message; a third generation subunit, used to generate sub-message attributes corresponding to each pin group based on the message attributes corresponding to the pin type; a fourth determination subunit, used to determine the sub-message number corresponding to each pin group based on the message number; and a fourth generation subunit, used to generate at least two messages corresponding to the pin type based on the sub-message attributes and sub-message numbers corresponding to at least two pin groups respectively.
[0132] In some optional implementations of this embodiment, the third generating sub-unit is further used to: on the basis of the message name contained in the message attribute corresponding to the pin type, set the sub-message name corresponding to each pin group in sequence according to a preset message name naming rule; based on the sub-message name corresponding to each pin group, the signal length information corresponding to the pins included in each pin group, the message data volume corresponding to each pin group and the signal transmission direction information of the pins included in each pin group, generate the sub-message attributes corresponding to each pin group.
[0133] The bus diagnostic file generation device provided in this embodiment may be as follows: Figure 6 The bus diagnostic file generation device shown in can execute all steps of the above bus diagnostic file generation methods, thereby achieving the technical effects of the above bus diagnostic file generation methods. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.
[0134] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 7 The electronic device 700 shown includes: at least one processor 701, a memory 702, at least one network interface 704 and other user interfaces 703. The various components in the electronic device 700 are coupled together via a bus system 705. It is understood that the bus system 705 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 705 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 705 is not described in detail. Figure 7 Various buses are labeled as bus system 705.
[0135] The user interface 703 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).
[0136] It can be understood that the memory 702 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can 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), or a flash memory. The volatile memory can 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), 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) and direct RAM bus random access memory (DRRAM). The memory 702 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0137] In some implementations, the memory 702 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 7021 and an application 7022 .
[0138] The operating system 7021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 7022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present application can be included in the application 7022.
[0139] In this embodiment, by calling the program or instruction stored in the memory 702, specifically, the program or instruction stored in the application 7022, the processor 701 is used to execute the method steps provided by each method embodiment, for example, including:
[0140] Obtain a hardware schematic diagram of a target device; determine the pin attributes of each pin of the target device from the hardware schematic diagram; classify the pins of the target device based on the pin attributes to obtain at least one pin type; for each pin type in the at least one pin type, generate a message corresponding to the pin type based on the pin attributes of each pin included in the pin type; and generate a bus diagnostic file for performing bus diagnosis on the target device based on the generated message corresponding to each pin type.
[0141] The method disclosed in the above embodiment of the present application can be applied to the processor 701, or implemented by the processor 701. The processor 701 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 701 or the instruction in the form of software. The above processor 701 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 702, and the processor 701 reads the information in the memory 702 and completes the steps of the above method in combination with its hardware.
[0142] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the above functions of the present application, or a combination thereof.
[0143] For software implementation, the technology described above in this article can be implemented by a unit that performs the functions described above in this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0144] The electronic device provided in this embodiment may be Figure 7 The electronic device shown in can execute all the steps of the above-mentioned methods for generating each bus diagnostic file, thereby achieving the technical effects of the above-mentioned methods for generating each bus diagnostic file. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.
[0145] The embodiment of the present application also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.
[0146] When one or more programs in the storage medium can be executed by one or more processors, the bus diagnostic file generation method executed on the electronic device side can be implemented.
[0147] The processor is used to execute the program stored in the memory to implement the following steps of the bus diagnostic file generation method executed on the electronic device side:
[0148] Obtain a hardware schematic diagram of a target device; determine the pin attributes of each pin of the target device from the hardware schematic diagram; classify the pins of the target device based on the pin attributes to obtain at least one pin type; for each pin type in the at least one pin type, generate a message corresponding to the pin type based on the pin attributes of each pin included in the pin type; and generate a bus diagnostic file for performing bus diagnosis on the target device based on the generated message corresponding to each pin type.
[0149] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different circuits to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0150] The steps of the circuits or algorithms described in conjunction with the embodiments disclosed herein may be implemented using hardware, software modules executed by a processor, or a combination of the two. The software modules may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0151] It should be understood that the terms used in the text are only for the purpose of describing specific example embodiments, and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The steps, processes, and operations described in the text are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0152] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A method for generating a bus diagnostic file, characterized in that: The method comprises: Get the hardware schematic of the target device; Determining a pin attribute of each pin of the target device from the hardware schematic diagram; Based on the pin attributes, classify the pins of the target device to obtain at least one pin type; For each pin type of the at least one pin type, based on the pin attributes of each pin included in the pin type, generate a message corresponding to the pin type; Based on the generated message corresponding to each pin type, a bus diagnosis file for performing bus diagnosis on the target device is generated.
2. The method according to claim 1, characterized in that Determining the pin attribute of each pin of the target device from the hardware schematic diagram includes: Determine the name and signal transmission direction of each pin of the target device from the hardware schematic diagram; The name and the signal transmission direction are determined as pin attributes of the pin.
3. The method according to claim 1, characterized in that The step of generating, for each pin type of the at least one pin type, a message corresponding to the pin type based on the pin attribute of each pin included in the pin type, comprises: For each pin type of the at least one pin type, based on the pin attributes of each pin included in the pin type, generate a message attribute corresponding to the pin type; Based on the message attributes, generate a message number; Based on the message number and the message attribute, a message corresponding to the pin type is generated.
4. The method according to claim 3, characterized in that The pin attributes include pin name and signal transmission direction; The generating of the message attribute corresponding to the pin type based on the pin attribute of each pin included in the pin type includes: Generate a message name based on the pin name of each pin included in the pin type; Generate message direction information based on the signal transmission direction of the pin included in the pin type; Determine the signal length information corresponding to the pins included in the pin type; Determine the amount of message data corresponding to the pin type; Based on the message name, the message direction information, the signal length information, and the message data volume, a message attribute corresponding to the pin type is generated.
5. The method according to claim 4, characterized in that The generating a message attribute corresponding to the pin type based on the message name, the message direction information, the signal length information, and the message data volume includes: Get the message period corresponding to the set pin type; Based on the message name, the message direction information, the signal length information, the message data volume and the message period, a message attribute corresponding to the pin type is generated.
6. The method according to claim 4, characterized in that The generating a message corresponding to the pin type based on the message number and the message attribute includes: Determine the total amount of data transmitted by the pins included in the pin type; If the total data volume exceeds the preset data volume, the pins included in the pin type are split to obtain at least two pin groups, wherein the preset data volume is the maximum data volume of each message; Based on the message attribute corresponding to the pin type, generate sub-message attributes corresponding to each pin group; Based on the message number, determine the sub-message number corresponding to each pin group; Based on the sub-message attributes and sub-message numbers respectively corresponding to the at least two pin groups, at least two messages corresponding to the pin type are generated.
7. The method according to claim 6, characterized in that The generating of sub-message attributes corresponding to each pin group based on the message attributes corresponding to the pin type includes: On the basis of the message name contained in the message attribute corresponding to the pin type, and according to the preset message name naming rule, the sub-message name corresponding to each pin group is sequentially set; Based on the sub-message name corresponding to each pin group, the signal length information corresponding to the pins included in each pin group, the message data volume corresponding to each pin group and the signal transmission direction information of the pins included in each pin group, the sub-message attributes corresponding to each pin group are generated.
8. A device for generating a bus diagnostic file, characterized in that: The device comprises: An acquisition module is used to obtain the hardware schematic diagram of the target device; A determination module, used to determine the pin attribute of each pin of the target device from the hardware schematic diagram; A classification module, configured to classify the pins of the target device based on the pin attributes to obtain at least one pin type; A first generating module, configured to generate, for each pin type of the at least one pin type, a message corresponding to the pin type based on a pin attribute of each pin included in the pin type; The second generating module is used to generate a bus diagnosis file for performing bus diagnosis on the target device based on the generated message corresponding to each pin type.
9. An electronic device, characterized in that: include: Memory for storing computer programs; The processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method for generating a bus diagnostic file described in any one of claims 1 to 7 is implemented.
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 for generating a bus diagnostic file as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Digital circuit net list data processing method
CN102323964A
Method for automatically wiring and generating report
CN108563810A
Whole vehicle control unit local area network message calibration monitoring device
CN110120904A
File generation method and device, equipment and storage medium
CN117093329A
DBC file generation method and device, electronic equipment and storage medium
CN117251142A
