CAN-to-LIN diagnosis method and device based on AUTOSAR, equipment and storage medium
Through the CAN to LIN diagnostic method of AUTOSAR, the automatic protocol and wiring harness adaptation of the diagnostic instrument and the whole vehicle are realized, solving the cost and complexity of the individual design and adaptation of the diagnostic instrument and the whole vehicle in the existing technology, and reducing the entire vehicle Maintenance cost.
Patent Information
- Application Number
- CN202411392198.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-10-08
AI Technical Summary
In the prior art, the diagnostic instrument and the entire vehicle need to design a software communication protocol and hardware wiring harness that are adapted to LIN diagnosis, resulting in higher costs and increased complexity.
Using the CAN to LIN diagnostic method based on AUTOSAR, the CAN diagnostic message request is received through the gateway, the packet is converted, and the diagnostic result is transmitted to the LIN driver, and the diagnostic result is feedback, and the results are converted back to the CAN diagnostic result, which is transmitted to the diagnostic device through the CAN driver. Implement automatic adaptation of software protocols and hardware wiring harnesses.
It saves the development cost of LIN diagnostic computers, and realizes the diagnostic functions of CAN and LIN controllers through CAN computers, reducing the maintenance cost of the entire vehicle.
Smart Images

Figure CN119299355A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of automotive gateway software diagnosis, and in particular to an AUTOSAR-based CAN-to-LIN diagnosis method, device, equipment and storage medium. Background Art
[0002] Embedded controller software design involves software flash upgrades and software configuration updates. Vehicle controller communication is generally CAN and LIN communication. When updating the diagnostic configuration of different controllers, because the CAN and LIN protocols are inconsistent, the diagnostic instrument and the vehicle must be separately designed to adapt to the software communication protocol and hardware harness for LIN diagnosis. The existing solution is basically to adapt the diagnostic instrument to LIN communication, design the hardware, and design the CAN to LIN circuit at the hardware level, which is very costly.
[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of this application is to provide a CAN-to-LIN diagnostic method, device, equipment and storage medium based on AUTOSAR, aiming to solve the technical problem that the current diagnostic instrument and the whole vehicle must be separately designed with software communication protocols and hardware wiring harnesses adapted to LIN diagnosis.
[0005] To achieve the above object, the present application proposes a CAN to LIN diagnostic method based on AUTOSAR, and the CAN to LIN diagnostic method based on AUTOSAR includes:
[0006] When the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, it receives the CAN diagnostic message request transmitted by the CAN driver;
[0007] Performing message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request;
[0008] Transmitting the LIN diagnostic message request to a LIN driver, and receiving a LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request;
[0009] The LIN diagnostic result is converted into a message to obtain a CAN diagnostic result, and the CAN diagnostic result is transmitted to the diagnostic instrument through a CAN driver.
[0010] In one embodiment, after the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, the step of receiving the CAN diagnostic message request transmitted by the CAN driver includes:
[0011] When the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, it transmits the CAN diagnostic message request to the CAN transmission layer through the CAN interface layer;
[0012] Obtain a format check result of the CAN transport layer on the CAN diagnostic message request, and when the check result is qualified, receive the CAN diagnostic message request transmitted by the CAN transport layer.
[0013] In one embodiment, the step of performing message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request includes:
[0014] The CAN diagnostic message request is stored in a receiving buffer, and the receiving buffer state is switched to an occupied state, and the session state of the receiving state machine is switched to a receiving ongoing state;
[0015] Determine a session state of a sending state machine corresponding to the receiving state machine and a cache state corresponding to a sending cache corresponding to the receiving cache;
[0016] When the session state of the sending state machine corresponding to the receiving state machine is in an idle state, and the buffer state corresponding to the sending buffer corresponding to the receiving buffer is in an idle state, the CAN diagnostic request message is message converted to obtain a LIN diagnostic message request.
[0017] In one embodiment, the steps of storing the CAN diagnostic message request in a receiving buffer, switching the receiving buffer state to an occupied state, and switching the session state of the receiving state machine to a receiving progress state include:
[0018] Determine a frame processing function according to a frame type obtained by the CAN transport layer performing frame judgment on the CAN diagnostic message request;
[0019] Determine the length and usage status of the receiving buffer based on the frame processing function;
[0020] When the length of the receiving buffer is greater than the frame length of the CAN diagnostic message request and the usage status of the receiving buffer is an idle state, the CAN diagnostic message request is stored in the receiving buffer, and the receiving buffer state is switched to an occupied state, and the session state of the receiving state machine is switched to a receiving state.
[0021] In one embodiment, the step of transmitting the LIN diagnostic message request to a LIN driver and receiving a LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request includes:
[0022] The LIN diagnostic message request is transmitted to the LIN transmission layer, and the LIN diagnostic message request is transmitted to the LIN driver layer through the LIN transmission layer, so that the LIN driver layer generates a LIN diagnostic result according to the LIN diagnostic message request;
[0023] The diagnostic result generated by the LIN driver layer according to the LIN diagnostic message request is received through the LIN transport layer.
[0024] In one embodiment, the step of converting the LIN diagnostic result into a message to obtain a CAN diagnostic result, and transmitting the CAN diagnostic result to the diagnostic instrument via a CAN driver includes:
[0025] The LIN diagnostic result is stored in a receiving buffer, and the receiving buffer state is switched to an occupied state, and the session state of the receiving state machine is switched to a receiving ongoing state;
[0026] Determine a session state of a sending state machine corresponding to the receiving state machine and a cache state corresponding to a sending cache corresponding to the receiving cache;
[0027] When the session state of the sending state machine corresponding to the receiving state machine is idle, and the cache state corresponding to the sending cache corresponding to the receiving cache is idle, the LIN diagnostic result is converted into a message to obtain a CAN diagnostic result, and the CAN diagnostic result is transmitted to the diagnostic instrument through a CAN driver.
[0028] In one embodiment, the steps of storing the LIN diagnostic result in a receiving buffer, switching the receiving buffer state to an occupied state, and switching the session state of the receiving state machine to a receiving progress state include:
[0029] Determine a frame processing function according to the frame type obtained by performing frame judgment on the LIN diagnostic result by the basic software layer mode management module;
[0030] Determine the length and usage status of the receiving buffer based on the frame processing function;
[0031] When the length of the receiving buffer is greater than the frame length of the LIN diagnostic result and the usage status of the receiving buffer is an idle state, the LIN diagnostic result is stored in the receiving buffer, and the receiving buffer state is switched to an occupied state, and the session state of the receiving state machine is switched to a receiving state.
[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes a CAN-to-LIN diagnostic device based on AUTOSAR, and the CAN-to-LIN diagnostic device based on AUTOSAR includes:
[0033] A message request module, which receives the CAN diagnostic message request transmitted by the CAN driver after the gateway receives the CAN diagnostic message request sent by the diagnostic instrument;
[0034] A message conversion module, used for performing message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request;
[0035] A message transmission module, used for transmitting the LIN diagnostic message request to a LIN driver, and receiving a LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request;
[0036] The result feedback module is used to convert the LIN diagnostic result into a message to obtain a CAN diagnostic result, and transmit the CAN diagnostic result to the diagnostic instrument through a CAN driver.
[0037] In addition, to achieve the above-mentioned objectives, the present application also proposes a CAN-to-LIN diagnostic device based on AUTOSAR, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the CAN-to-LIN diagnostic method based on AUTOSAR as described above.
[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the AUTOSAR-based CAN to LIN diagnostic method as described above are implemented.
[0039] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the AUTOSAR-based CAN to LIN diagnostic method as described above.
[0040] One or more technical solutions proposed in the present application have at least the following technical effects: when the gateway receives a CAN diagnostic message request issued by the diagnostic instrument, it receives the CAN diagnostic message request transmitted by the CAN driver; performs message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request; transmits the LIN diagnostic message request to the LIN driver, and receives the LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request; performs message conversion on the LIN diagnostic result to obtain a CAN diagnostic result, and transmits the CAN diagnostic result to the diagnostic instrument through the CAN driver, thereby saving the development cost of the LIN diagnostic host computer and realizing the CAN and LIN controller diagnostic functions through the CAN host computer. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] 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.
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or 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.
[0043] Figure 1 A flow chart of the first embodiment of the CAN to LIN diagnostic method based on AUTOSAR of the present application;
[0044] Figure 2 A schematic diagram of network nodes provided for an embodiment of a CAN to LIN diagnostic method based on AUTOSAR of the present application;
[0045] Figure 3 A data transmission flow diagram provided for an embodiment of a CAN to LIN diagnostic method based on AUTOSAR of this application;
[0046] Figure 4 A schematic diagram of a session state machine provided for an embodiment of a CAN to LIN diagnostic method based on AUTOSAR of the present application;
[0047] Figure 5 A data transmission flow chart provided for an embodiment of a CAN to LIN diagnostic method based on AUTOSAR of this application;
[0048] Figure 6 This is a schematic diagram of the module structure of the AUTOSAR-based CAN-to-LIN diagnostic device according to an embodiment of the present application;
[0049] Figure 7 Schematic diagram of the device structure of the hardware operating environment involved in the AUTOSAR-based CAN to LIN diagnostic method in the embodiment of the present application.
[0050] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0051] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0052] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0053] The main solution of the embodiment of the present application is: when the gateway receives the CAN diagnostic message request issued by the diagnostic instrument, it receives the CAN diagnostic message request transmitted by the CAN driver; performs message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request; transmits the LIN diagnostic message request to the LIN driver, and receives the LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request; performs message conversion on the LIN diagnostic result to obtain a CAN diagnostic result, and transmits the CAN diagnostic result to the diagnostic instrument through the CAN driver.
[0054] In this embodiment, for the convenience of description, the following description is made by taking the identification of AUTOSAR-based CAN-to-LIN diagnostic equipment as the execution subject.
[0055] Due to the differences in communication methods of different controllers on automobiles in the prior art, the two most common protocols are CAN protocol and LIN protocol. Currently, to perform real-time communication diagnosis on these two controllers, it is necessary to lead out the CAN line and LIN line respectively, and the diagnostic equipment must also support both CAN and LIN communication protocols. This method will increase the complexity of the controller and is not conducive to the maintenance of the controller line, thereby increasing the maintenance cost of the controller.
[0056] The present application provides a solution to realize the conversion between CAN protocol and LIN protocol in the gateway controller through software, without adding additional hardware cost, low cost and reliable method.
[0057] It can be seen from the above embodiments that the present application receives the CAN diagnostic message request transmitted by the CAN driver after the gateway receives the CAN diagnostic message request issued by the diagnostic instrument; performs message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request; transmits the LIN diagnostic message request to the LIN driver, and receives the LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request; performs message conversion on the LIN diagnostic result to obtain a CAN diagnostic result, and transmits the CAN diagnostic result to the diagnostic instrument through the CAN driver, thereby saving the development cost of the LIN diagnostic host computer and realizing the CAN and LIN controller diagnostic functions through the CAN host computer.
[0058] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a CAN to LIN diagnostic device based on AUTOSAR, etc. The following takes the CAN to LIN diagnostic device based on AUTOSAR as an example to illustrate this embodiment and the following embodiments.
[0059] Based on this, the embodiment of the present application provides a CAN to LIN diagnostic method based on AUTOSAR, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the AUTOSAR-based CAN-to-LIN diagnostic method of the present application.
[0060] In this embodiment, the AUTOSAR-based CAN-to-LIN diagnostic method includes steps S10 to S40:
[0061] Step S10, after the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, it receives the CAN diagnostic message request transmitted through the CAN driver.
[0062] It should be noted that the diagnostic instrument and the gateway are connected through the OBD interface. The diagnostic instrument can send CAN diagnostic messages to the gateway through the OBD interface, and can also receive CAN diagnostic results transmitted from the gateway through the OBD interface.
[0063] In the specific implementation, refer to Figure 2 , Figure 2 It is a schematic diagram of network nodes. When performing diagnosis, first, the diagnostic instrument content can be connected to the gateway through the OBD interface, and the gateway and the LIN sensor use the LIN network segment for data transmission. Among them, the communication protocol between the diagnostic instrument and the gateway is the CAN protocol, and the data transmission between the gateway and the LIN sensor is the LIN protocol. Therefore, when performing diagnosis, when the diagnostic instrument initiates a diagnostic message request, it can transmit the diagnostic message request to the gateway, and the gateway can send the CAN diagnostic message request to the protocol data unit routing PDUR layer after the gateway receives the CAN diagnostic message request issued by the diagnostic instrument.
[0064] In a feasible implementation manner, after the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, the step of receiving the CAN diagnostic message request transmitted by the CAN driver includes:
[0065] When the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, it transmits the CAN diagnostic message request to the CAN transmission layer through the CAN interface layer;
[0066] Obtain a format check result of the CAN transport layer on the CAN diagnostic message request, and when the check result is qualified, receive the CAN diagnostic message request transmitted by the CAN transport layer.
[0067] In the specific implementation, refer to Figure 3 , Figure 3The data transmission flow diagram is shown in Figure 1. When the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, it can transmit the CAN diagnostic request message to the CAN transport layer (CAN TP) through the CAN interface layer (CANIF, CAN interface layer). The CANTP layer checks the diagnostic message format to determine whether it complies with the ISO14229 standard format. If it is wrong, it will be discarded and the error will be recorded. If it is qualified, it will be transmitted to the PDUR layer for processing and receive the CAN diagnostic message request transmitted through the CAN transport layer.
[0068] Step S20, performing message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request.
[0069] It should be noted that LIN message transmission is implemented through a scheduling table, and the scheduling table is switched through the interface provided by AUTOSAR's BswM. Two buffers are provided for CAN-LIN ID message conversion to temporarily store received and sent data. At the same time, a session state machine is designed for this pair of sessions, which is divided into two sub-state machines, Rx and Tx.
[0070] In a specific implementation, after the corresponding message is received at the CAN end, to complete a complete cycle of CAN-LIN diagnosis, the PDUR layer needs to be able to perform operations such as message unpacking, analysis, and packaging of the CAN diagnostic message request, software internal state machine switching, and sending verification. When performing message conversion, the frame processing function is determined according to the frame type obtained by the CAN transport layer performing frame judgment on the CAN diagnostic message request; the length and usage status of the receiving buffer are determined based on the frame processing function; when the length of the receiving buffer is greater than the frame length of the CAN diagnostic message request and the usage status of the receiving buffer is an idle state, the CAN diagnostic message request is stored in the receiving buffer, and the receiving buffer state is switched to an occupied state, and the session state of the receiving state machine is switched to a receiving state; the session state of the sending state machine corresponding to the receiving state machine and the cache state of the sending buffer corresponding to the receiving cache are determined; when the session state of the sending state machine corresponding to the receiving state machine is an idle state, and the cache state of the sending buffer corresponding to the receiving cache is an idle state, the CAN diagnostic request message is message converted to obtain a LIN diagnostic message request. Specifically, CANTP determines the diagnostic frame type and executes the corresponding frame processing function. PDUR is routed to the complex driver for processing, determines the length and usage status of the receive buffer, changes the Rx session receive state to RX_INPROGRESS, sets the receive buffer to occupied, unpacks the data for reassembly, determines whether the current Tx session send state is TX_IDLE and whether the send buffer is in an idle state, calls the corresponding basic software layer mode management module BswM interface to switch the scheduling table to the diagnostic request scheduling, and switches the Tx session state to the progress state TX_INPROGRESS, switches the Rx session state to the completion state RX_FINISHED, sends the buffer occupied, calls the LINTp_Transmit() function, sends successfully, switches the Tx session state to TX_IDLE, switches the Rx session state to RX_IDLE, releases the receive and send buffers, and completes the conversion of the CAN diagnostic message request to obtain the LIN diagnostic message request.
[0071] Step S30: transmitting the LIN diagnostic message request to a LIN driver, and receiving a LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request.
[0072] In a specific implementation, the LIN diagnostic message request is transmitted to the LIN transmission layer, and the LIN diagnostic message request is transmitted to the LIN driver layer through the LIN transmission layer, so that the LIN driver layer generates a LIN diagnostic result according to the LIN diagnostic message request; and the diagnostic result generated by the LIN driver layer according to the LIN diagnostic message request is received through the LIN transmission layer.
[0073] Step S40, converting the LIN diagnostic result into a message to obtain a CAN diagnostic result, and transmitting the CAN diagnostic result to the diagnostic instrument through a CAN driver.
[0074] It should be noted that LIN message transmission is implemented through a scheduling table, and the scheduling table is switched through the interface provided by AUTOSAR's BswM. Two buffers are provided for CAN-LIN ID message conversion to temporarily store received and sent data. At the same time, a session state machine is designed for this pair of sessions, which is divided into two sub-state machines, Rx and Tx.
[0075] In a specific implementation, after receiving the LIN diagnostic result, to complete a complete cycle of CAN-LIN diagnosis, it is also necessary to determine the frame type obtained by performing frame judgment on the LIN diagnostic result according to the basic software layer mode management module to determine the frame processing function; determine the length and usage status of the receiving buffer based on the frame processing function; when the length of the receiving buffer is greater than the frame length of the LIN diagnostic result and the usage status of the receiving buffer is an idle state, store the LIN diagnostic result in the receiving buffer, switch the receiving buffer state to an occupied state, and switch the session state of the receiving state machine to a receiving state; when the session state of the sending state machine corresponding to the receiving state machine is an idle state, and the cache state corresponding to the sending buffer corresponding to the receiving buffer is an idle state, perform message conversion on the LIN diagnostic result to obtain a CAN diagnostic result, and transmit the CAN diagnostic result to the diagnostic instrument through the CAN driver. Call the BswM interface to switch the scheduling table to the diagnostic slave node response scheduling, LINTP determines the diagnostic frame type and executes the corresponding frame processing function, PDUR is routed to the complex driver for processing, determines the receive buffer length and usage status, changes the Rx session receive status to RX_INPROGRESS, the receive buffer is occupied, unpacks the data and reassembles the packet, switches the Rx status to RX_FINISHED, and determines whether the Tx session send status is TX_IDLE and whether the send buffer is idle, calls the corresponding BswM interface to switch the scheduling table to the application message scheduling, switches the Tx session status to TX_INPROGRESS, the send buffer is occupied, calls CANIf_Transmit() to send the CAN message of the corresponding ID to the CAN, and after successful transmission, the Tx session status switches to TX_IDLE, the Rx session status switches to Rx_IDLE, and the receive and send buffers are released. Reference Figure 4 , Figure 4 It is a diagram of the session state machine. When the receiving state machine is in the idle state, it can receive data and update the state to the receiving state. After all the saves are completed, the receiving state machine can be updated to the completed state, and receive data extraction, input data pointer, data length, can copy data to the sending buffer and return the processing result. At this time, when the sending state machine is in the idle state, it can start to execute the sending task according to the transmission request, and update the state to the progress state, execute the sending state, input ID, send data, switch the LIN schedule table, return the schedule table switching result, and reset the state of the sending state machine.
[0076] Reference Figure 5 , Figure 5The following is a data transmission flow chart. When the diagnostic instrument sends a CAN diagnostic message request, the CAN driver receives the CAN diagnostic message request and forwards it to CANIF. After receiving the CAN diagnostic message request, CANIF can forward it to CANTP. After receiving the CAN diagnostic message request, CANTP classifies the frame type and transmits the result to PDU Routing. It also determines whether the receiving buffer is occupied. If it is occupied, it returns NOK. If it is not occupied, it further determines whether the buffer overflows. If it overflows, it returns NOK. Otherwise, it sets the receiving buffer to be occupied, updates the receiving state machine, copies data, updates the receiving state machine and the sending state machine, sets the sending buffer to be occupied, switches the LIN scheduling table, switches the diagnostic scheduling table, releases the buffer, resets the receiving and sending state machine to the initial state, and the LIN diagnostic scheduling sends the LIN diagnostic message. The LIN driver sends, and the LIN scheduling switches to the scheduling table.
[0077] This embodiment provides a CAN-to-LIN diagnostic method based on AUTOSAR. When the gateway receives a CAN diagnostic message request from a diagnostic instrument, it receives the CAN diagnostic message request transmitted by a CAN driver; performs message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request; transmits the LIN diagnostic message request to a LIN driver, and receives a LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request; performs message conversion on the LIN diagnostic result to obtain a CAN diagnostic result, and transmits the CAN diagnostic result to the diagnostic instrument through the CAN driver, thereby saving the development cost of a LIN diagnostic host computer and realizing the CAN and LIN controller diagnostic functions through a CAN host computer.
[0078] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the AUTOSAR-based CAN-to-LIN diagnostic method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0079] This application also provides a CAN to LIN diagnostic device based on AUTOSAR, please refer to Figure 6 , the AUTOSAR-based CAN-to-LIN diagnostic device comprises:
[0080] The message request module 10 receives the CAN diagnostic message request transmitted by the CAN driver after the gateway receives the CAN diagnostic message request sent by the diagnostic instrument;
[0081] The message conversion module 20 is used to convert the CAN diagnostic message request to obtain a LIN diagnostic message request;
[0082] The message transmission module 30 is used to transmit the LIN diagnostic message request to the LIN driver, and receive the LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request;
[0083] The result feedback module 40 is used to convert the LIN diagnostic result into a message to obtain a CAN diagnostic result, and transmit the CAN diagnostic result to the diagnostic instrument through a CAN driver.
[0084] In one embodiment, the message request module 10 is also used to transmit the CAN diagnostic message request to the CAN transport layer through the CAN interface layer after the gateway receives the CAN diagnostic message request issued by the diagnostic instrument; obtain the format check result of the CAN transport layer on the CAN diagnostic message request, and when the check result is qualified, receive the CAN diagnostic message request transmitted through the CAN transport layer.
[0085] In one embodiment, the message conversion module 20 is also used to store the CAN diagnostic message request in a receiving cache, and switch the receiving cache state to an occupied state, and switch the session state of the receiving state machine to a receiving state; determine the session state of the sending state machine corresponding to the receiving state machine and the cache state corresponding to the sending cache corresponding to the receiving cache; when the session state of the sending state machine corresponding to the receiving state machine is an idle state, and the cache state corresponding to the sending cache corresponding to the receiving cache is an idle state, perform message conversion on the CAN diagnostic request message to obtain a LIN diagnostic message request.
[0086] In one embodiment, the message conversion module 20 is also used to determine a frame processing function based on the frame type obtained by the CAN transport layer performing frame judgment on the CAN diagnostic message request; determine the length and usage status of the receiving buffer based on the frame processing function; when the length of the receiving buffer is greater than the frame length of the CAN diagnostic message request and the usage status of the receiving buffer is an idle state, store the CAN diagnostic message request in the receiving buffer, switch the receiving buffer state to an occupied state, and switch the session state of the receiving state machine to a receiving state.
[0087] In one embodiment, the message transmission module 30 is also used to transmit the LIN diagnostic message request to the LIN transmission layer, and transmit the LIN diagnostic message request to the LIN driver layer through the LIN transmission layer, so that the LIN driver layer generates a LIN diagnostic result according to the LIN diagnostic message request; and receive the diagnostic result generated by the LIN driver layer according to the LIN diagnostic message request through the LIN transmission layer.
[0088] In one embodiment, the result feedback module 40 is also used to store the LIN diagnostic result in a receiving cache, and switch the receiving cache state to an occupied state, and switch the session state of the receiving state machine to a receiving state; determine the session state of the sending state machine corresponding to the receiving state machine and the cache state corresponding to the sending cache corresponding to the receiving cache; when the session state of the sending state machine corresponding to the receiving state machine is an idle state, and the cache state corresponding to the sending cache corresponding to the receiving cache is an idle state, perform message conversion on the LIN diagnostic result to obtain a CAN diagnostic result, and transmit the CAN diagnostic result to the diagnostic instrument through a CAN driver.
[0089] In one embodiment, the result feedback module 40 is also used to determine a frame processing function according to the frame type obtained by performing frame judgment on the LIN diagnostic result by the basic software layer mode management module; determine the length and usage status of the receiving buffer based on the frame processing function; when the length of the receiving buffer is greater than the frame length of the LIN diagnostic result and the usage status of the receiving buffer is an idle state, store the LIN diagnostic result in the receiving buffer, switch the receiving buffer state to an occupied state, and switch the session state of the receiving state machine to a receiving state.
[0090] The AUTOSAR-based CAN-to-LIN diagnostic device provided by the present application adopts the AUTOSAR-based CAN-to-LIN diagnostic method in the above-mentioned embodiment, which can solve the technical problem that the current diagnostic instrument and the whole vehicle need to separately design software communication protocols and hardware wiring harnesses adapted to LIN diagnosis. Compared with the prior art, the beneficial effects of the AUTOSAR-based CAN-to-LIN diagnostic device provided by the present application are the same as the beneficial effects of the AUTOSAR-based CAN-to-LIN diagnostic method provided by the above-mentioned embodiment, and the other technical features of the AUTOSAR-based CAN-to-LIN diagnostic device are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.
[0091] The present application provides an AUTOSAR-based CAN-to-LIN diagnostic device, the AUTOSAR-based CAN-to-LIN diagnostic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the AUTOSAR-based CAN-to-LIN diagnostic method in the above-mentioned embodiment 1.
[0092] Reference below Figure 7, which shows a schematic diagram of the structure of an AUTOSAR-based CAN-to-LIN diagnostic device suitable for implementing the embodiment of the present application. The AUTOSAR-based CAN-to-LIN diagnostic device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The AUTOSAR-based CAN-to-LIN diagnostic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0093] like Figure 7 As shown, the AUTOSAR-based CAN to LIN diagnostic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the AUTOSAR-based CAN to LIN diagnostic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the AUTOSAR-based CAN-to-LIN diagnostic device to communicate wirelessly or wired with other devices to exchange data. Although the figure shows an AUTOSAR-based CAN-to-LIN diagnostic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0094] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0095] The AUTOSAR-based CAN-to-LIN diagnostic device provided by the present application adopts the AUTOSAR-based CAN-to-LIN diagnostic method in the above embodiment, which can solve the technical problem that the current diagnostic instrument and the whole vehicle need to separately design software communication protocols and hardware wiring harnesses adapted to LIN diagnosis. Compared with the prior art, the beneficial effects of the AUTOSAR-based CAN-to-LIN diagnostic device provided by the present application are the same as the beneficial effects of the AUTOSAR-based CAN-to-LIN diagnostic method provided by the above embodiment, and the other technical features of the AUTOSAR-based CAN-to-LIN diagnostic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0096] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0097] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0098] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the AUTOSAR-based CAN-to-LIN diagnostic method in the above-mentioned embodiment.
[0099] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0100] The computer-readable storage medium may be included in the AUTOSAR-based CAN-to-LIN diagnostic device; or may exist independently without being assembled into the AUTOSAR-based CAN-to-LIN diagnostic device.
[0101] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the AUTOSAR-based CAN-to-LIN diagnostic device, the AUTOSAR-based CAN-to-LIN diagnostic device:
[0102] When the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, it receives the CAN diagnostic message request transmitted by the CAN driver;
[0103] Performing message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request;
[0104] Transmitting the LIN diagnostic message request to a LIN driver, and receiving a LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request;
[0105] The LIN diagnostic result is converted into a message to obtain a CAN diagnostic result, and the CAN diagnostic result is transmitted to the diagnostic instrument through a CAN driver.
[0106] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0107] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0108] The modules involved in the embodiments of the present application may be implemented by software or hardware, wherein the name of the module does not limit the unit itself in some cases.
[0109] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned AUTOSAR-based CAN-to-LIN diagnostic method, and can solve the technical problem that the current diagnostic instrument and the whole vehicle need to be separately designed with software communication protocols and hardware wiring harnesses adapted for LIN diagnosis. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the AUTOSAR-based CAN-to-LIN diagnostic method provided by the above-mentioned embodiment, and will not be elaborated here.
[0110] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned AUTOSAR-based CAN-to-LIN diagnostic method when executed by a processor.
[0111] The computer program product provided by the present application can solve the technical problem that the current diagnostic instrument and the whole vehicle need to separately design software communication protocols and hardware wiring harnesses adapted to LIN diagnosis. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the AUTOSAR-based CAN to LIN diagnostic method provided in the above embodiment, which will not be elaborated here.
[0112] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A CAN to LIN diagnostic method based on AUTOSAR, characterized in that: The AUTOSAR-based CAN-to-LIN diagnostic method includes: When the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, it receives the CAN diagnostic message request transmitted by the CAN driver; Performing message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request; Transmitting the LIN diagnostic message request to a LIN driver, and receiving a LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request; The LIN diagnostic result is converted into a message to obtain a CAN diagnostic result, and the CAN diagnostic result is transmitted to the diagnostic instrument through a CAN driver.
2. The method according to claim 1, characterized in that When the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, the step of receiving the CAN diagnostic message request transmitted by the CAN driver includes: When the gateway receives the CAN diagnostic message request sent by the diagnostic instrument, it transmits the CAN diagnostic message request to the CAN transmission layer through the CAN interface layer; Obtain a format check result of the CAN transport layer on the CAN diagnostic message request, and when the check result is qualified, receive the CAN diagnostic message request transmitted through the CAN transport layer.
3. The method according to claim 1, characterized in that The step of performing message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request comprises: The CAN diagnostic message request is stored in a receiving buffer, and the receiving buffer state is switched to an occupied state, and the session state of the receiving state machine is switched to a receiving ongoing state; Determine a session state of a sending state machine corresponding to the receiving state machine and a cache state corresponding to a sending cache corresponding to the receiving cache; When the session state of the sending state machine corresponding to the receiving state machine is in an idle state, and the buffer state corresponding to the sending buffer corresponding to the receiving buffer is in an idle state, the CAN diagnostic request message is message converted to obtain a LIN diagnostic message request.
4. The method according to claim 3, characterized in that The steps of storing the CAN diagnostic message request in a receiving buffer, switching the receiving buffer state to an occupied state, and switching the session state of the receiving state machine to a receiving progress state include: Determine a frame processing function according to a frame type obtained by the CAN transport layer performing frame judgment on the CAN diagnostic message request; Determine the length and usage status of the receiving buffer based on the frame processing function; When the length of the receiving buffer is greater than the frame length of the CAN diagnostic message request and the usage status of the receiving buffer is an idle state, the CAN diagnostic message request is stored in the receiving buffer, and the receiving buffer state is switched to an occupied state, and the session state of the receiving state machine is switched to a receiving state.
5. The method according to claim 1, characterized in that The step of transmitting the LIN diagnostic message request to a LIN driver and receiving a LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request comprises: The LIN diagnostic message request is transmitted to the LIN transmission layer, and the LIN diagnostic message request is transmitted to the LIN driver layer through the LIN transmission layer, so that the LIN driver layer generates a LIN diagnostic result according to the LIN diagnostic message request; The diagnostic result generated by the LIN driver layer according to the LIN diagnostic message request is received through the LIN transport layer.
6. The method according to claim 1, characterized in that The step of converting the LIN diagnostic result into a message to obtain a CAN diagnostic result, and transmitting the CAN diagnostic result to the diagnostic instrument via a CAN driver comprises: The LIN diagnostic result is stored in a receiving buffer, and the receiving buffer state is switched to an occupied state, and the session state of the receiving state machine is switched to a receiving ongoing state; Determine a session state of a sending state machine corresponding to the receiving state machine and a cache state corresponding to a sending cache corresponding to the receiving cache; When the session state of the sending state machine corresponding to the receiving state machine is idle, and the cache state corresponding to the sending cache corresponding to the receiving cache is idle, the LIN diagnostic result is converted into a message to obtain a CAN diagnostic result, and the CAN diagnostic result is transmitted to the diagnostic instrument through a CAN driver.
7. The method according to claim 6, characterized in that The steps of storing the LIN diagnostic result in a receiving buffer, switching the receiving buffer state to an occupied state, and switching the session state of the receiving state machine to a receiving ongoing state include: Determine a frame processing function according to the frame type obtained by performing frame judgment on the LIN diagnostic result by the basic software layer mode management module; Determine the length and usage status of the receiving buffer based on the frame processing function; When the length of the receiving buffer is greater than the frame length of the LIN diagnostic result and the usage status of the receiving buffer is an idle state, the LIN diagnostic result is stored in the receiving buffer, and the receiving buffer state is switched to an occupied state, and the session state of the receiving state machine is switched to a receiving state.
8. A CAN to LIN diagnostic device based on AUTOSAR, characterized in that: The device comprises: A message request module, which receives the CAN diagnostic message request transmitted by the CAN driver after the gateway receives the CAN diagnostic message request sent by the diagnostic instrument; A message conversion module, used for performing message conversion on the CAN diagnostic message request to obtain a LIN diagnostic message request; A message transmission module, used for transmitting the LIN diagnostic message request to a LIN driver, and receiving a LIN diagnostic result fed back by the LIN driver according to the LIN diagnostic message request; The result feedback module is used to convert the LIN diagnostic result into a message to obtain a CAN diagnostic result, and transmit the CAN diagnostic result to the diagnostic instrument through a CAN driver.
9. A CAN to LIN diagnostic device based on AUTOSAR, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the AUTOSAR-based CAN-to-LIN diagnostic method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the AUTOSAR-based CAN-to-LIN diagnostic method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Vehicle-mounted diagnosis system
CN101799686A
Diagnosis method and system of vehicle LIN (local interconnect network)
CN104253727A
MOST-CAN gateway and diagnosis message routing method based on MOST-CAN gateway
CN106549844A
Service-oriented architecture service failure control method based on AUTOSAR
CN112685008A
Controller software architecture, controller software upgrading method, controller and device
CN115623871A