CAN signal processing method, device, system, vehicle and storage medium
By introducing the interface between the LUA engine and the CAN signal read and write module, the MCU function logic is dynamically changed, which solves the problem of inefficient MCU upgrades and realizes efficient MCU upgrades.
Patent Information
- Application Number
- CN202210529752.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-16
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-05-16
AI Technical Summary
In the prior art, the logic function upgrade of automotive MCUs is inefficient, the upgrade is frequent and the procedures are complex, so it is impossible to upgrade efficiently.
By introducing the LUA engine to load the preset interface in the LUA script, the interface provided by the CAN signal read and write module is used to operate, and the functional logic of the MCU is dynamically changed.
Dynamic changes in MCU function logic are realized, upgrading efficiency is improved, and upgrading time and complexity is reduced.
Smart Images

Figure CN114815706B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of automotive technology, and in particular, to a CAN signal processing method, device, system, vehicle, and storage medium. Background Art
[0002] Currently, automobiles use the C language to implement the logic functions of microcontroller units (MCUs). Implementing the MCU's logic in C requires pre-programming and compiling the logic into the MCU. Upgrading the MCU's logic functions can only be done by flashing the program over the air (OTA) or other upgrade methods.
[0003] With the development of automotive technology, the frequency of MCU logic function upgrades is increasing, the upgrade time intervals are getting shorter, and the procedures for upgrading the MCU logic functions are becoming more and more complicated, resulting in low upgrade efficiency of current automotive MCUs. Summary of the Invention
[0004] The embodiments of the present application provide a CAN signal processing method, device, system, vehicle and storage medium to improve the above-mentioned problems.
[0005] In a first aspect, embodiments of the present application provide a method for processing CAN signals. The method comprises: loading a LUA script and a preset interface in the LUA script through a LUA engine, wherein the preset interface is provided by a CAN signal reading and writing module; calling the preset interface and performing a preset operation corresponding to the preset interface on the CAN signal.
[0006] In a second aspect, an embodiment of the present application provides a CAN signal processing device. The device includes a script loading module and an interface calling module. The script loading module is used to load a LUA script and a preset interface in the LUA script through the LUA engine, wherein the preset interface is provided by the CAN signal reading and writing module. The interface calling module is used to call the preset interface and perform a preset operation corresponding to the preset interface on the CAN signal.
[0007] In a third aspect, an embodiment of the present application provides a CAN signal processing system. The system includes a LUA engine, a CAN signal read / write module, and a script execution module. The LUA engine is used to load the LUA script and the preset interface in the LUA script. The CAN signal read / write module is used to provide the preset interface for the LUA script. The script execution module is used to call the preset interface and perform a preset operation corresponding to the preset interface on the CAN signal.
[0008] In a fourth aspect, an embodiment of the present application provides a vehicle. The vehicle includes a vehicle body and a microcontroller unit. The microcontroller unit includes a CAN signal processing system provided in an embodiment of the present application.
[0009] In a fifth aspect, embodiments of the present application provide a computer-readable storage medium having program code stored therein, wherein the program code is configured to, when called by a processor, cause the processor to execute the CAN signal processing method provided in embodiments of the present application.
[0010] The embodiments of the present application provide a CAN signal processing method, device, system, vehicle, and storage medium. By introducing a LUA engine to load a LUA script and a preset interface provided by a CAN signal read / write module in the LUA script, and by calling the preset interface to implement the corresponding preset operation, the operation of the MCU can be remotely and dynamically triggered to dynamically change the functional logic in the MCU. Compared to the current form of pre-writing and pre-burning the MCU functional logic and only being able to upgrade it by flashing the program, the CAN signal processing method provided by the embodiments of the present application can dynamically change the MCU functional logic, thereby effectively improving the upgrade efficiency of the MCU. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0012] Figure 1 Schematic diagram of an application scenario of the CAN signal processing method provided in an embodiment of the present application;
[0013] Figure 2 An exemplary embodiment of the present application provides Figure 1 A schematic diagram of the interaction between modules in the application scenario shown;
[0014] Figure 3 1 is a flow chart of a CAN signal processing method provided by an embodiment of the present application;
[0015] Figure 4 This is a schematic diagram of a LUA script in EMMC provided by an exemplary embodiment of the present application;
[0016] Figure 5 1 is a flow chart of a CAN signal processing method provided by another embodiment of the present application;
[0017] Figure 6 1 is a flow chart of a CAN signal processing method provided by another embodiment of the present application;
[0018] Figure 7 1 is a flow chart of a CAN signal processing method provided by an exemplary embodiment of the present application;
[0019] Figure 8 This is a structural block diagram of a CAN signal processing device provided in an embodiment of the present application;
[0020] Figure 9 This is a structural block diagram of a CAN signal processing system provided in an embodiment of the present application;
[0021] Figure 10 This is a structural block diagram of a vehicle provided in an embodiment of the present application;
[0022] Figure 11 This is a structural block diagram of the computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0024] See also Figure 1 , Figure 1 Schematic diagram of an application scenario of the CAN signal processing method provided in an embodiment of the present application. The data interaction system 10 includes an MCU 11, an embedded multimedia card (EMMC) 12, and an electronic control unit (ECU) 13. The MCU 11 can call and execute code in the EMMC 12. The MCU 11 can communicate with the ECU 13 to achieve data exchange. The MCU 11, EMMC 12, and ECU 13 are located in the same vehicle.
[0025] In some embodiments, EMMC12 includes a LUA script, which can use a preset interface in the CAN library in the CAN signal reading and writing module 113. Among them, the preset interface can be set according to actual business needs, and the embodiments of the present application are not specifically limited here. For example, the preset interface can be a CAN signal receiving interface and a CAN signal sending interface. EMMC12 can refer to one EMMC or include multiple EMMCs, and the embodiments of the present application are not specifically limited here.
[0026] In some embodiments, the ECU 13 can exchange data with the MCU via a CAN channel. Figure 1As shown, MCU11 is externally connected to two CAN channels, including four CAN nodes "CAN Node 1", "CAN Node 2", "CAN Node 3" and "CAN Node 4". Among them, CAN nodes "CAN Node 1" and "CAN Node 2" are CAN nodes on the channel for sending CAN signals, and CAN nodes "CAN Node 3" and "CAN Node 4" are CAN nodes on the channel for receiving CAN signals. The embodiment of the present application does not specifically limit the number of CAN channels. The ECU13 in the embodiment of the present application can refer to one ECU or include multiple ECUs, and the embodiment of the present application does not specifically limit this.
[0027] In some embodiments, the MCU 11 includes a script execution module 111 (e.g., Figure 1 ScriptM module 111 shown), LUA engine 112, controller area network (Controller Area Network, CAN) signal reading and writing module 113 (for example, Figure 1 LUA (logical unit application) is a lightweight and compact scripting language written in standard C language and open source.
[0028] The LUA engine 112 is a basic engine for dynamically loading software, which can provide a scripted basic interface. For example, the basic interface may include a CAN signal receiving interface and a CAN signal sending interface.
[0029] The CAN signal read / write module 113 stores a CAN signal read / write library (hereinafter referred to as the "CAN library"), providing a complete set of read / write interfaces and CAN signal mapping tables within the MCU 11. For example, the read / write interface may include a CAN signal receiving interface and a CAN signal transmitting interface. For example, the CAN signal mapping table may include the CAN signal transmitting mapping table shown in Table 1 and the CAN signal receiving mapping table shown in Table 2.
[0030] Table 1
[0031]
[0032] Table 2
[0033]
[0034] Table 1 is a table of mapping relationships for sending CAN signals, and Table 2 is a table of mapping relationships for receiving CAN signals. The LUA_Lib_CAN(ID) in both Tables 1 and 2 represents the identity document (ID) of the CAN signal pre-set in LUA_Lib_CAN (hereinafter referred to as "the identity document of the CAN signal" as the "preset ID"). The preset ID corresponds to the CAN signal and can be customized by the MCU developer. This embodiment of the present application does not impose any specific restrictions on this.
[0035] As an example, referring to Table 1 above, the preset ID "0" corresponds to the CAN signal "CAN1_Speed" of the CAN node "CAN Node 1"; the preset ID "1" corresponds to the CAN signal "CAN2_Time" of the CAN node "CAN Node 2".
[0036] As another example, referring to Table 2 above, the preset ID "0" corresponds to the CAN signal "CAN3_Doorlock" of the CAN node "CAN Node 3"; the preset ID "1" corresponds to the CAN signal "CAN_CtrlWindows" of the CAN node "CAN Node 4".
[0037] In some embodiments, MCU11 dynamically loads the LUA script in EMMC12 through the LUA engine 112 and the EMMC interface inside the MCU11. ECU11 executes the LUA script in EMMC12 loaded by the LUA engine 112 through the script execution module 111. When ECU11 calls the above-mentioned preset interface in the LUA script, the preset operation corresponding to the preset interface can be executed. As an example, the preset interface is a CAN signal receiving interface, and the preset operation is to receive a CAN signal. As another example, the preset interface is a CAN signal sending interface, and the preset operation is to send the preset information contained in the CAN signal sending interface to the CAN signal. The preset information can be customized by the developer, and the embodiments of the present application are not specifically limited here.
[0038] See also Figure 2 , an exemplary embodiment of the present application provides Figure 1 The CAN library in LUA_Lib_CAN113 needs to be registered through the interface of LUA engine 112. After registration, the CAN library can provide the above read and write interface for LUA script. As an example, the read and write interface can include Figure 2 CAN_Receive(Signal ID) and CAN_Send(Signal ID) shown.
[0039] In addition, the CAN library is based on the Automotive Open System Architecture (AUTOSAR) and can use the real-time environment (RTE) to abstract the underlying CAN signals from the COM (Communication) module in AUTOSAR. This allows LUA scripts to call the above preset interfaces and send and receive CAN signals according to the above CAN signal mapping table.
[0040] The MCU11 in the data interaction system 10 provided in the embodiment of the present application loads the LUA script in the external EMMC12 through the LUA engine 112, and provides a preset interface and CAN signal mapping relationship for the LUA script through the CAN library to perform preset operations, thereby dynamically changing the logical function of the MCU11, which can alleviate the pressure of the COM module in the prior art. Because the local interconnect network (LIN) / CAN / Ethernet (ETH) and other network communications are currently used between vehicle ECUs, based on AUTOSAR, all interactive signals are processed by the COM module in AUTOSAR, thereby improving data processing efficiency. In addition, by providing a preset interface and CAN signal mapping relationship for the LUA script through the CAN library, it is convenient for users to secondary develop the logical function of the MCU11.
[0041] See also Figure 3 , Figure 3 This is a flow chart of a CAN signal processing method provided by an embodiment of the present application. The CAN signal processing method can be applied to Figure 1 The MCU11 shown below will be mentioned Figure 10 The MCU620 shown below will be mentioned Figure 8 The CAN signal processing device 400 shown in the figure and the CAN signal processing device 400 mentioned below Figure 9 The CAN signal processing system 500 shown in FIG. 4 may include the following steps S110 to S120 .
[0042] Step S110: Loading the LUA script and the preset interface in the LUA script through the LUA engine, wherein the preset interface is provided by the CAN signal reading and writing module.
[0043] As mentioned above, the preset interface can be set according to actual business needs. For example, the preset interface can be a CAN signal acquisition interface and a CAN signal receiving interface. The preset interface carries a preset identifier, which uniquely corresponds to the CAN signal and is used to identify the CAN signal. The preset identifier can be customized by the MCU developer and is not specifically limited in this embodiment of the present application. A preset interface carries only one preset identifier. As an example, please refer to Table 1, the preset interface can be the preset ID "0".
[0044] The CAN signal read / write module (LUA_Lib_CAN) stores multiple sets of mapping relationships between preset identifiers and CAN signals. The mapping relationships between preset identifiers and CAN signals can be customized by the MCU developer and can be stored by establishing a CAN signal mapping relationship table. This embodiment of the present application does not impose any specific restrictions on this.
[0045] As an example, please refer to Table 1. In the CAN signal sending mapping relationship table, the preset identifier is the preset ID "0", which corresponds to the CAN signal "CAN1_Speed" of the CAN node "CAN node 1"; the preset identifier is the preset ID "1", which corresponds to the CAN signal "CAN2_Time" of the CAN node "CAN node 2".
[0046] As another example, please refer to Table 2. In the CAN signal reception mapping relationship table, the preset identifier is the preset ID "0", which corresponds to the CAN signal "CAN3_Doorlock" of the CAN node "CAN node 3"; the preset identifier is the preset ID "1", which corresponds to the CAN signal "CAN_CtrlWindows" of the CAN node "CAN node 4".
[0047] As mentioned above, the CAN signal reading and writing module is based on AUTOSAR and uses RTE to send and receive CAN signals through the COM module.
[0048] As mentioned above, the LUA script is stored in the EMMC. EMMC includes multiple LUA scripts, each of which can be customized by the developer. The interface used by the LUA script can also be customized by the developer based on the interface in the CAN library. This embodiment of the application does not impose any specific restrictions here. As an example, please refer to Figure 4 , Figure 4 This is a schematic diagram of a LUA script in EMMC provided by an exemplary embodiment of the present application, such as Figure 4As shown, the LUA scripts in EMMC include "LUAScript0", "LUAScript1", and "LUAScript2", among which "LUAScript0", "LUAScript1", and "LUAScript2" can respectively implement different logical functions.
[0049] In some embodiments, when the program is running, the script execution module in the MCU (e.g., ScriptM module) can dynamically open and run the LUA script in the external EMMC through the LUA engine. Specifically, the LUA engine can load the LUA script in the EMMC and the preset interface in the LUA script through the EMMC interface inside the MCU.
[0050] As an implementation method, the LUA engine may load all interfaces in the LUA script simultaneously when loading the LUA script.
[0051] As another implementation, the LUA engine can first load the LUA script, and then when a certain interface is needed during the execution of the LUA script, the interface in the LUA script is loaded. For example, the LUA script includes interface A, interface B, and interface C. When interface A is needed when running the LUA script, interface A is loaded, and interface B and interface C are not loaded. By loading an interface only when it is needed, the computing power of the MCU can be saved.
[0052] Step S120: calling a preset interface and performing a preset operation corresponding to the preset interface on the CAN signal.
[0053] As previously mentioned, the preset operation corresponding to the preset interface can be customized by the MCU developer and is not specifically limited in this embodiment of the present application. For example, if the preset interface is a CAN signal receiving interface, the preset operation is to receive a CAN signal. For another example, if the preset interface is a CAN signal transmitting interface, the preset operation is to transmit the preset information contained in the CAN signal transmitting interface to the CAN signal. This preset information can be customized by the developer and is not specifically limited in this embodiment of the present application.
[0054] In some implementations, the script execution module in the MCU can implement a preset operation corresponding to the preset interface by calling a preset interface. Specifically, the script execution module can identify the CAN signal based on the preset identifier in the preset interface and the mapping relationship between the preset identifier and the CAN signal, obtain the target CAN signal, and perform the preset operation on the target CAN signal.
[0055] The CAN signal processing method provided in the embodiment of the present application introduces a LUA engine to load the LUA script and the preset interface provided by the CAN signal read / write module in the LUA script, and implements the corresponding preset operation by calling the preset interface, thereby remotely and dynamically triggering the operation of the MCU to dynamically change the functional logic in the MCU. Compared with the current form of pre-writing and pre-burning the MCU functional logic and only being able to upgrade it by flashing the program, the CAN signal processing method provided in the embodiment of the present application can dynamically change the MCU functional logic, thereby effectively improving the upgrade efficiency of the MCU.
[0056] See also Figure 5 , Figure 5 This is a flow chart of a CAN signal processing method provided by another embodiment of the present application. Figure 1 The MCU11 shown below will be mentioned Figure 10 The MCU620 shown below will be mentioned Figure 8 The CAN signal processing device 400 shown in the figure and the CAN signal processing device 400 mentioned below Figure 9 The CAN signal processing system 500 shown in FIG. 4 may include the following steps S210 to S220 .
[0057] Step S110, through the LUA engine, load the LUA script and the signal sending interface in the LUA script, wherein the signal sending interface includes a first preset identifier and a target value, the signal sending interface is provided by a CAN signal read and write module, and the CAN signal read and write module includes a mapping relationship between the first preset identifier and the CAN signal.
[0058] The signal transmission interface carries a first preset identifier, which uniquely corresponds to the CAN signal and is used to identify the CAN signal. The first preset identifier can be customized by the MCU developer and is not specifically limited in this embodiment of the present application. A signal transmission interface only carries one first preset identifier. As an example, the signal transmission interface is "LIB_CAN_Send(0, 1)", where "0" is the first preset identifier and "1" is the target value.
[0059] The CAN signal reading and writing module (LUA_Lib_CAN) stores multiple sets of mapping relationships between first preset identifiers and CAN signals. The mapping relationships between first preset identifiers and CAN signals can be customized by the MCU developer and can be stored by establishing a CAN signal transmission mapping relationship table. This embodiment of the present application does not impose any specific limitations on this.
[0060] As an example, please refer to Table 1 above. In the CAN signal sending mapping relationship table, the first preset identifier is the preset ID "0", which corresponds to the CAN signal "CAN1_Speed" of the CAN node "CAN node 1"; the first preset identifier is the preset ID "1", which corresponds to the CAN signal "CAN2_Time" of the CAN node "CAN node 2".
[0061] For the part of step S210 that is not described in detail, please refer to the above step S110, and the embodiment of the present application does not make any specific limitation here.
[0062] Step S220 , calling the signal sending interface, and using the target value as the value of the CAN signal according to the mapping relationship between the first preset identifier and the CAN signal.
[0063] In some embodiments, the CAN signal can be identified through the first preset identifier in the signal sending interface according to the mapping relationship between the first preset identifier and the CAN signal, and the target CAN signal can be obtained. The target value is used as the value of the CAN signal, so that other ECUs can perform corresponding operations according to the reassigned CAN signal.
[0064] As an example, the signal sending interface is "LIB_CAN_Send(0, 1)", please refer to Table 1 above, the first preset identifier is "0", and according to the mapping relationship between the first preset identifier and the CAN signal, the CAN signal "CAN1_Speed" can be identified, and then the value of the CAN signal "CAN1_Speed" is set to the target value "1", so that other ECUs can perform corresponding operations according to the reassigned CAN signal.
[0065] The CAN signal processing method provided in the embodiment of the present application introduces a LUA engine to load the LUA script and the signal sending interface provided by the CAN signal reading and writing module in the LUA script, and assigns a value to the CAN signal by calling the signal sending interface, so that other ECUs can perform corresponding operations according to the re-assigned CAN signal, thereby dynamically changing the value of the CAN signal.
[0066] See also Figure 6 , Figure 6 This is a flow chart of a CAN signal processing method provided by another embodiment of the present application. The CAN signal processing method can be applied to Figure 1 The MCU11 shown below will be mentioned Figure 10 The MCU620 shown below will be mentioned Figure 8 The CAN signal processing device 400 shown in the figure and the CAN signal processing device 400 mentioned below Figure 9The CAN signal processing system 500 shown in FIG. 4 may include the following steps S310 to S320 .
[0067] Step S310, through the LUA engine, the LUA script and the signal receiving interface in the LUA script are loaded, wherein the signal receiving interface includes a second preset identifier, the signal receiving interface is provided by a CAN signal read and write module, and the CAN signal read and write module includes a mapping relationship between the second preset identifier and the CAN signal.
[0068] The signal receiving interface carries a second preset identifier, which uniquely corresponds to the CAN signal and is used to identify the CAN signal. The second preset identifier can be customized by the MCU developer and is not specifically limited in this embodiment of the present application. A signal receiving interface only carries one second preset identifier. As an example, the signal receiving interface is LIB_CAN_Receive(1), where "1" is the second preset identifier.
[0069] The CAN signal reading and writing module (LUA_Lib_CAN) stores multiple sets of mapping relationships between second preset identifiers and CAN signals. The mapping relationships between second preset identifiers and CAN signals can be customized by the MCU developer and can be stored by establishing a CAN signal receiving mapping relationship table. This embodiment of the present application does not impose any specific limitations on this.
[0070] As an example, please refer to Table 2 above. In the CAN signal reception mapping relationship table, the second preset identifier is the preset ID "0", which corresponds to the CAN signal "CAN3_Doorlock" of the CAN node "CAN node 3"; the second preset identifier is the preset ID "1", which corresponds to the CAN signal "CAN_CtrlWindows" of the CAN node "CAN node 4".
[0071] For the part of step S310 that is not described in detail, please refer to the above step S110, and the embodiment of the present application does not make any specific limitation here.
[0072] Step S320: calling a signal receiving interface to obtain a CAN signal corresponding to the second preset identifier according to a mapping relationship between the second preset identifier and the CAN signal.
[0073] In some embodiments, the CAN signal can be identified through the second preset identifier in the signal receiving interface according to the mapping relationship between the second preset identifier and the CAN signal, and the target CAN signal can be obtained so that the MCU can subsequently perform corresponding operations based on the target CAN signal.
[0074] As an example, the signal receiving interface is "LIB_CAN_Receive(1)", please refer to Table 2 above, the second preset identifier is "0", and according to the mapping relationship between the second preset identifier and the CAN signal, the CAN signal "CAN3_Doorlock" can be identified, and the CAN signal "CAN3_Doorlock" can be obtained, so that the MCU can subsequently perform corresponding operations according to the target CAN signal "CAN3_Doorlock".
[0075] The CAN signal processing method provided in the embodiment of the present application introduces a LUA engine to load the LUA script and the signal receiving interface provided by the CAN signal reading and writing module in the LUA script, and obtains the CAN signal by calling the signal receiving interface so that the MCU can subsequently perform corresponding operations according to the target CAN signal.
[0076] See also Figure 7 , Figure 7 This is a flow chart of a CAN signal processing method provided by an exemplary embodiment of the present application. The CAN signal processing method can be applied to Figure 1 The MCU11 shown below will be mentioned Figure 10 The MCU620 shown below will be mentioned Figure 8 The CAN signal processing device 400 shown in the figure and the CAN signal processing device 400 mentioned below Figure 9 The CAN signal processing system 500 shown in FIG. 5 takes the LUA script in the EMMC as “LUAScript0” as an example, and the CAN signal processing method may include the following steps 1 to 8.
[0077] Step 1: The script execution module (ScriptM module) runs the script, opens the LUA script "LUAScript0" through the LUA engine, and references the CAN library in LUA_lib_CAN.
[0078] Step 2: Load the CAN library through the LUA engine and run the LUA script "LUAScript0".
[0079] Among them, executing steps 1 and 2 can load the CAN library.
[0080] Step 3: When the LUA script "LUAScript0" needs to assign a value to a CAN signal, the LUA engine loads the signal sending interface "LIB_CAN_Send(Signal ID, Value)", where "Signal ID" is the first preset identifier and "Value" is the target value.
[0081] Step 4: The LUA engine sends the first preset identifier and the target value to the CAN library in LUA_lib_CAN through the interface "CAN_Send(Signal ID, Value)", and assigns a value to the CAN signal corresponding to the first preset identifier.
[0082] Step 5: LUA_lib_CAN sends the assigned CAN signal to the COM module through RTE so that other ECUs can perform corresponding operations based on the assigned CAN signal.
[0083] Among them, by executing steps 1 to 4, a value can be assigned to the CAN signal corresponding to the first preset identifier, so that the ECU can perform corresponding operations according to the CAN signal after the assignment.
[0084] Step 6: When the LUA script "LUAScript0" needs to use a certain CAN signal, the LUA engine loads the signal receiving interface "LIB_CAN_Receive (Signal ID)", where "Signal ID" is a second preset identifier.
[0085] Step 7: The LUA engine sends the second preset identifier to the CAN library in LUA_lib_CAN through the interface "CAN_Receive (Signal ID)".
[0086] Step eight, LUA_lib_CAN obtains the CAN signal corresponding to the second preset identifier from the COM module through RTE, and feeds the CAN signal corresponding to the second preset identifier back to the MCU through the LUA engine.
[0087] Among them, by executing steps 1 and 2, and steps 6 to 8, a CAN signal corresponding to the second preset identifier can be obtained, so that the MCU can subsequently perform corresponding operations according to the obtained CAN signal.
[0088] It should be noted that steps 3 to 5 and steps 6 to 8 can be executed in the same embodiment, or can be executed in different embodiments respectively, and the embodiments of the present application are not specifically limited here. As an implementation method, the MCU can execute the above steps 1 to 5. As another implementation method, the MCU can execute the above steps 1 and 2, and steps 6 to 8. As yet another implementation method, the MCU can execute the above steps 1 to 8, wherein the execution order of executing steps 3 to 5 and executing steps 6 to 8 is not fixed, and can be adjusted according to actual needs. For example, steps 3 to 5 can be executed first, and then steps 6 to 8 can be executed, or steps 6 to 8 can be executed first, and then steps 3 to 5 can be executed. The embodiments of the present application are not specifically limited here.
[0089] For the parts of steps 1 to 8 not described in detail, please refer to the aforementioned method embodiment, and the present application embodiment does not make specific limitations here.
[0090] The CAN signal processing method provided in the embodiment of the present application introduces a LUA engine to load the LUA script and the preset interface provided by the CAN signal read / write module in the LUA script, and implements the corresponding preset operation by calling the preset interface, thereby remotely and dynamically triggering the operation of the MCU to dynamically change the functional logic in the MCU. Compared with the current form of pre-writing and pre-burning the MCU functional logic and only being able to upgrade it by flashing the program, the CAN signal processing method provided in the embodiment of the present application can dynamically change the MCU functional logic, thereby effectively improving the upgrade efficiency of the MCU.
[0091] See also Figure 8 , Figure 8 This is a block diagram of the structure of the CAN signal processing device provided in the embodiment of the present application. The CAN signal processing device 400 can be applied to Figure 1 The MCU11 shown and the following Figure 10 The MCU 620 shown. The CAN signal processing device 400 includes a script loading module 410 and an interface calling module 420. The script loading module 410 is used to load the LUA script and the preset interface in the LUA script through the LUA engine. The preset interface is provided by the CAN signal reading and writing module. The CAN signal reading and writing module is based on the automotive open system architecture and uses a real-time environment to transmit and receive CAN signals through the communication module. The interface calling module 420 is used to call the preset interface and perform a preset operation corresponding to the preset interface on the CAN signal.
[0092] In some embodiments, the preset interface includes a signal transmission interface, the signal transmission interface includes a first preset identifier and a target value, and the CAN signal reading and writing module includes a mapping relationship between the first preset identifier and the CAN signal. The interface calling module 420 includes a first interface calling submodule. The first interface calling submodule is configured to call the signal transmission interface based on the mapping relationship between the first preset identifier and the CAN signal, and use the target value as the value of the CAN signal.
[0093] In some embodiments, the preset interface further includes a signal receiving interface, the signal receiving interface includes a second preset identifier, and the CAN signal reading and writing module includes a mapping relationship between the second preset identifier and the CAN signal. The interface calling module 420 further includes a second interface calling submodule. The second interface calling submodule is configured to call the signal receiving interface and, based on the mapping relationship between the second preset identifier and the CAN signal, obtain the CAN signal corresponding to the second preset identifier.
[0094] See also Figure 9 , Figure 9 This is a block diagram of the CAN signal processing system provided by the embodiment of the present application. The CAN signal processing system 500 can be applied to Figure 1 The MCU11 shown and the following Figure 10 The MCU 620 shown. The CAN signal processing system 500 includes a LUA engine 510, a CAN signal read / write module 520, and a script execution module 530. The LUA engine 510 is used to load the LUA script and the preset interface in the LUA script. The CAN signal read / write module 520 is used to provide the preset interface for the LUA script. The script execution module 530 is used to call the preset interface and perform the preset operation corresponding to the preset interface on the CAN signal.
[0095] It should be noted that the LUA engine 510 is the same as the above-mentioned LUA engine 112 , the CAN signal reading and writing module 520 is the same as the above-mentioned CAN signal reading and writing module 113 , and the script execution module 530 is the same as the above-mentioned script execution module 111 .
[0096] In some embodiments, the preset interface includes a signal sending interface, the signal sending interface includes a first preset identifier and a target value, the CAN signal reading and writing module includes a mapping relationship between the first preset identifier and the CAN signal, and the preset operation corresponding to the preset interface includes: according to the mapping relationship between the first preset identifier and the CAN signal, using the target value as the value of the CAN signal.
[0097] In some embodiments, the preset interface also includes a signal receiving interface, the signal receiving interface includes a second preset identifier, the CAN signal reading and writing module includes a mapping relationship between the second preset identifier and the CAN signal, and the preset operation corresponding to the preset interface also includes: obtaining the CAN signal corresponding to the second preset identifier according to the mapping relationship between the second preset identifier and the CAN signal.
[0098] Those skilled in the art will clearly understand that the CAN signal processing device 400 and the CAN signal processing system 500 provided in the embodiments of the present application can both implement the CAN signal processing method provided in the embodiments of the present application. The specific working processes of the above modules can refer to the corresponding processes of the CAN signal processing method in the embodiments of the present application, and will not be repeated here.
[0099] In the embodiments provided in the present application, the coupling, direct coupling or communication connection between the modules shown or discussed may be indirect coupling or communication coupling through some interfaces, devices or modules, and may be electrical, mechanical or other forms, and the embodiments of the present application do not limit this.
[0100] In addition, the functional modules in the embodiments of the present application may be integrated into a single processing module, each module may exist physically separately, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or software functional modules, and the embodiments of the present application do not limit this.
[0101] See also Figure 10 , Figure 10 The vehicle 600 includes a vehicle body 610 and an MCU 620. The MCU 620 may include the above Figure 8 The CAN signal processing system 500 shown and / or the above Figure 7 The CAN signal processing device 400 shown in FIG. It should be noted that the MCU 620 is the same as the above-mentioned MCU 11. The vehicle 600 can be a gasoline vehicle or an electric vehicle, wherein the electric vehicle can be a pure electric vehicle, a hybrid vehicle, or a fuel cell vehicle, etc., and the embodiment of the present application does not make any specific restrictions here.
[0102] In some embodiments, the MCU 620 may include a memory 621, a processor 622, and one or more application programs. The one or more application programs may be stored in the memory 621 and configured to, when called by the one or more processors 622, cause the one or more processors 622 to execute the CAN signal processing method provided in the embodiments of the present application.
[0103] The processor 622 may include one or more processing cores. The processor 622 utilizes various interfaces and lines to connect various parts of the entire MCU 620, and is used to run or execute instructions, programs, code sets, or instruction sets stored in the memory 621, as well as call and execute data stored in the memory 621, perform various functions of the MCU 620, and process data. Optionally, the processor 622 may be implemented in the form of at least one hardware selected from the group consisting of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA).
[0104] The memory 621 may include a random access memory (RAM) or a read-only memory (ROM). The memory 621 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 621 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the above-mentioned various method embodiments, and the like. The data storage area may store data created by the MCU 620 during use, and the like.
[0105] See also Figure 11 , Figure 11 The computer-readable storage medium 700 stores a program code 710, which is configured to, when called by a processor, cause the processor to execute the CAN signal processing method provided in the embodiment of the present application.
[0106] Computer readable storage medium 700 can be an electronic memory such as flash memory, electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), hard disk or ROM. Alternatively, computer readable storage medium 700 includes non-transitory computer-readable storage medium (Non-TCRSM). Computer readable storage medium 700 has storage space for program code 710 that performs any method step in the above method. These program codes 710 can be read from one or more computer program products or written into one or more computer program products. Program code 710 can be compressed in an appropriate form.
[0107] In summary, the embodiments of the present application provide a CAN signal processing method, device, system, vehicle, and storage medium. By introducing a LUA engine to load a LUA script and a preset interface provided by a CAN signal read / write module in the LUA script, and by calling the preset interface to implement the corresponding preset operation, the operation of the MCU can be remotely and dynamically triggered to dynamically change the functional logic in the MCU. Compared to the current form of pre-writing and pre-burning the MCU functional logic and only being able to upgrade it by flashing the program, the CAN signal processing method provided by the embodiments of the present application can dynamically change the MCU functional logic, thereby effectively improving the upgrade efficiency of the MCU.
[0108] Finally, it should be noted that the above embodiments are intended only to illustrate the technical solutions of this application and are not intended to limit them. Although this application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they may modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein with equivalents; and such modifications or replacements do not deviate from the spirit and scope of the technical solutions of the various embodiments of this application.
Claims
1. A CAN signal processing method, characterized in that: include: Loading the LUA script and the preset interface in the LUA script through the LUA engine, wherein the preset interface is provided by the CAN signal read and write module; Calling the preset interface and performing a preset operation corresponding to the preset interface on the CAN signal; The calling of the preset interface and performing a preset operation corresponding to the preset interface on the CAN signal includes: According to the preset identifier in the preset interface and the mapping relationship between the preset identifier and the CAN signal, the target CAN signal corresponding to the preset identifier in the preset interface is identified from the mapping relationship, and a preset operation is performed on the target CAN signal, wherein, if the preset interface includes a CAN signal receiving interface, the preset operation includes receiving the CAN signal.
2. The method according to claim 1, characterized in that The preset interface includes a signal sending interface, the signal sending interface includes a first preset identifier and a target value, the CAN signal reading and writing module includes a mapping relationship between the first preset identifier and the CAN signal, and calling the preset interface and performing a preset operation corresponding to the preset interface on the CAN signal includes: The signal sending interface is called, and according to the mapping relationship between the first preset identifier and the CAN signal, the target value is used as the value of the CAN signal.
3. The method according to claim 1 or 2, characterized in that The preset interface further includes a signal receiving interface, the signal receiving interface includes a second preset identifier, the CAN signal reading and writing module includes a mapping relationship between the second preset identifier and the CAN signal, and calling the preset interface to perform a preset operation corresponding to the preset interface on the CAN signal includes: The signal receiving interface is called to obtain the CAN signal corresponding to the second preset identifier according to the mapping relationship between the second preset identifier and the CAN signal.
4. The method according to claim 1, wherein The CAN signal reading and writing module is based on the automotive open system architecture and utilizes a real-time environment to send and receive the CAN signal through a communication module.
5. A CAN signal processing device, characterized in that: include: A script loading module, configured to load the LUA script and the preset interface in the LUA script through the LUA engine, wherein the preset interface is provided by the CAN signal reading and writing module; An interface calling module, configured to call the preset interface and perform a preset operation corresponding to the preset interface on the CAN signal; The interface calling module is also used to identify the target CAN signal corresponding to the preset identifier in the preset interface from the mapping relationship between the preset identifier and the CAN signal, and perform a preset operation on the target CAN signal, wherein if the preset interface includes a CAN signal receiving interface, the preset operation includes receiving the CAN signal.
6. A CAN signal processing system, characterized in that: include: The LUA engine is used to load the LUA script and the preset interface in the LUA script; A CAN signal reading and writing module, used to provide the preset interface for the LUA script; A script execution module, configured to call the preset interface and perform a preset operation corresponding to the preset interface on the CAN signal; The script execution module is also used to identify the target CAN signal corresponding to the preset identifier in the preset interface from the mapping relationship between the preset identifier and the CAN signal, and perform a preset operation on the target CAN signal, wherein if the preset interface includes a CAN signal receiving interface, the preset operation includes receiving the CAN signal.
7. The system according to claim 6, characterized in that The preset interface includes a signal sending interface, the signal sending interface includes a first preset identifier and a target value, the CAN signal reading and writing module includes a mapping relationship between the first preset identifier and the CAN signal, and the preset operation corresponding to the preset interface includes: According to the mapping relationship between the first preset identifier and the CAN signal, the target value is used as the value of the CAN signal.
8. The system according to claim 6 or 7, characterized in that The preset interface further includes a signal receiving interface, the signal receiving interface includes a second preset identifier, the CAN signal reading and writing module includes a mapping relationship between the second preset identifier and the CAN signal, and the preset operation corresponding to the preset interface further includes: According to the mapping relationship between the second preset identifier and the CAN signal, the CAN signal corresponding to the second preset identifier is acquired.
9. A vehicle, characterized in that: include: body of the vehicle; A micro control unit, comprising the CAN signal processing system according to any one of claims 6 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program code, and when the program code is configured to be called by a processor, the processor executes the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Electric vehicle controller CAN interface HIL automatic test method
CN114460925A