First frame message sending method and device, vehicle, electronic equipment and storage medium

By receiving and judging the message before starting the operating system, it is ensured that the first frame message sent by the target node is a network management message, which solves the problem of the node mistakenly waking up the controller and achieves faster wake-up time and more accurate frame message sending.

CN120710818APending Publication Date: 2025-09-26BEIJING CO WHEELS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410330361.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-21
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In the prior art, when the first frame message sent by a node is an application message, a controller that does not support specific frame wake-up may be mistakenly awakened.

Method used

Before starting the operating system, determine that the controller LAN driver of the target node has been initialized and is in normal status, and start the message communication port to receive messages; after the operating system is started, wake up the target node based on the message communication port; determine whether the first frame message is a network management message. If not, stop sending and continue to determine the second frame message until the network management message is sent.

Benefits of technology

By receiving and judging the message before starting the operating system, it ensures that the first frame message sent by the target node is a network management message, avoiding false wake-up of the controller, saving wake-up time, and is applicable to active and passive wake-up scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120710818A_ABST
    Figure CN120710818A_ABST
Patent Text Reader

Abstract

The invention provides a first frame message sending method and device, a vehicle, electronic equipment and a storage medium, and relates to the technical field of vehicles, before an operating system is started, if it is determined that a controller local area network driver of a target node is initialized and the state of a controller local area network state machine is set to be a normal communication state, the first frame message is sent; if yes, a message communication port of the target node is started, and the message communication port is used for receiving a message; after the operating system is started, the target node is awakened based on the message received by the message communication port; after the target node is awakened, judging whether a first frame message to be sent by the target node is a first network management message or not; if it is determined that the first frame message is not the first network management message, stopping sending the first frame message, and continuing to judge whether a second frame message to be sent by the target node is the first network management message; and if it is determined that the second frame message is the first network management message, sending the second frame message to ensure that the first frame message sent by the target node is the network management message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of vehicle technology, and in particular to a method, device, vehicle, electronic device, and storage medium for sending a first-frame message. Background Art

[0002] The AUTomotive Open System Architecture (AutoSar) is currently the most widely used open automotive architecture, and the Controller Area Network (CAN) Network Management (CanNM) module is a key module in the AutoSar communication protocol stack. CanNM's network management messages participate in vehicle communication control and sleep and wake-up. When a node needs to wake up the target network, it calls the CanNM network request interface to send a network management message. However, when the node sends a network management message, if the first frame message sent by the node is an application message, a controller that does not support specific frame wake-up may be mistakenly awakened. Summary of the Invention

[0003] The present disclosure provides a method, device, vehicle, electronic device, and storage medium for sending a first-frame message. The main purpose is to solve the problem in the prior art that when the first frame message sent by a node is an application message, a controller that does not support specific frame wake-up may be mistakenly awakened.

[0004] According to a first aspect of the present disclosure, a method for sending a first frame message is provided, comprising:

[0005] Before starting the operating system, if it is determined that the controller area network driver of the target node has been initialized and the state of the controller area network state machine is set to a normal communication state, then starting a message communication port of the target node, the message communication port being used to receive messages;

[0006] After starting the operating system, waking up the target node based on the message received by the message communication port;

[0007] After the target node is awakened, determining whether a first frame message to be sent by the target node is a first network management message;

[0008] If it is determined that the first frame message is not the first network management message, stop sending the first frame message, and continue to determine whether the second frame message to be sent by the target node is the first network management message;

[0009] If it is determined that the second frame message is the first network management message, the second frame message is sent.

[0010] Optionally, after starting the message communication port of the target node, the method includes:

[0011] Based on each time the message communication port receives a frame of the message, determining whether the message is a second network management message;

[0012] In a case where it is determined that the message is the second network management message, a preset time period for passively waking up the target node is set.

[0013] Optionally, waking up the target node based on the message includes:

[0014] If the target node does not receive a message from the active wake-up source within the preset time period, passively waking up the target node based on the second network management message;

[0015] If the target node receives the message from the active wake-up source within the preset time period, the target node is actively woken up based on the message from the active wake-up source.

[0016] Optionally, after waking up the target node based on the message, the method includes:

[0017] If the target node is awakened outside the preset time period, the awakening is recorded as a cold power-on or an invalid awakening.

[0018] Optionally, before determining that the controller area network driver of the target node has been initialized and the state of the controller area network state machine is set to a normal communication state, the method includes:

[0019] Initializing the controller area network driver based on each target initialization function in the communication protocol stack; and

[0020] A main function of the controller area network state machine is called, and the state of the controller area network state machine is set to a normal communication state based on the main function.

[0021] Optionally, after sending the second frame message, the method includes:

[0022] Start the protocol data unit group of the application message;

[0023] The application message is sent based on the protocol data unit group.

[0024] According to a second aspect of the present disclosure, a device for sending a first frame message is provided, including:

[0025] a first starting unit, configured to start a message communication port of the target node before starting the operating system, when it is determined that the controller area network driver of the target node has been initialized and the state of the controller area network state machine is set to a normal communication state, wherein the message communication port is used to receive messages;

[0026] a wake-up unit, configured to wake up the target node based on the message received by the message communication port after starting the operating system;

[0027] A first judging unit is configured to judge, after the target node is awakened, whether a first frame message to be sent by the target node is a first network management message;

[0028] a stopping unit, configured to, when determining that the first frame message is not the first network management message, stop sending the first frame message, and continue to determine whether a second frame message to be sent by the target node is the first network management message;

[0029] The first sending unit is configured to send the second frame message when it is determined that the second frame message is the first network management message.

[0030] Optionally, the device includes:

[0031] A second judging unit is configured to judge whether the message is a second network management message when each frame of the message is received by the message communication port;

[0032] The setting unit is configured to set a preset time period for passively waking up the target node when it is determined that the message is the second network management message.

[0033] Optionally, the awakening unit includes:

[0034] A first awakening module, configured to passively awaken the target node based on the second network management message when the target node does not receive a message from the active awakening source within the preset time period;

[0035] The second awakening module is configured to actively awaken the target node based on the message from the active awakening source when the target node receives the message from the active awakening source within the preset time period.

[0036] Optionally, the device further includes:

[0037] The recording unit is configured to record, when the target node is awakened outside the preset time period, the awakening as a cold power-on or an invalid awakening.

[0038] Optionally, the device includes:

[0039] an initialization unit, configured to initialize the controller area network driver based on each target initialization function in the communication protocol stack; and

[0040] A calling unit is configured to call a main function of the controller area network state machine, and set the state of the controller area network state machine to a normal communication state based on the main function.

[0041] Optionally, the device includes:

[0042] A second starting unit, configured to start a protocol data unit group of an application message;

[0043] The second sending unit is configured to send the application message based on the protocol data unit group.

[0044] According to a third aspect of the present disclosure, a vehicle is provided, comprising the device for sending a first frame message according to the second aspect.

[0045] According to a fourth aspect of the present disclosure, there is provided an electronic device, including:

[0046] at least one processor; and

[0047] a memory communicatively connected to the at least one processor; wherein,

[0048] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.

[0049] According to a fifth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.

[0050] According to a sixth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described in the first aspect above.

[0051] The present disclosure provides a method, device, vehicle, electronic device and storage medium for sending a first frame message. Before starting the operating system, if it is determined that the controller local area network driver of the target node has been initialized and the state of the controller local area network state machine is set to the normal communication state, the message communication port of the target node is started, and the message communication port is used to receive messages; after starting the operating system, the target node is woken up based on the message received by the message communication port; after the target node is woken up, it is determined whether the first frame message to be sent by the target node is the first network management message; if it is determined that the first frame message is not the first network management message, the sending of the first frame message is stopped, and it is continued to be determined whether the second frame message to be sent by the target node is the first network management message; if it is determined that the second frame message is the first network management message, the second frame message is sent. Compared with the related art, by starting the message communication port of the target node to receive messages before starting the operating system, and waking up the target node based on the message after starting the operating system, the time for waking up the target node is saved. After waking up the target node, when the target node is about to send the first frame message, it is determined whether the first frame message is the first network management message. If the first frame message is not the first network management message, the first frame message is stopped, and it is continued to be determined whether the second frame message to be sent is the first network management message. If it is determined that the second frame message is the first network management message, the second frame message is sent. The above-mentioned mechanism is used to ensure that after the target node is awakened, the first frame message it sends is a network management message, thereby solving the problem in the prior art that when the first frame message sent by the node is an application message, the controller that does not support specific frame wake-up will be mistakenly awakened.

[0052] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.

[0054] Figure 1 A flowchart of a method for sending a first frame message provided by an embodiment of the present disclosure;

[0055] Figure 2 A flowchart of another method for sending a first frame message provided by an embodiment of the present disclosure;

[0056] Figure 3 A schematic diagram of a framework of a system for sending a first frame message provided in an embodiment of the present disclosure;

[0057] Figure 4 A schematic structural diagram of a device for sending a first frame message provided in an embodiment of the present disclosure;

[0058] Figure 5 A schematic structural diagram of another device for sending a first frame message provided by an embodiment of the present disclosure;

[0059] Figure 6 A schematic block diagram of an exemplary electronic device 300 provided in accordance with an embodiment of the present disclosure. DETAILED DESCRIPTION

[0060] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0061] The following describes the method, device, vehicle, electronic device, and storage medium for sending a first frame message according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0062] Figure 1 A flowchart of a method for sending a first frame message provided in an embodiment of the present disclosure.

[0063] like Figure 1 As shown, the method comprises the following steps:

[0064] Step 101, before starting the operating system, if it is determined that the controller area network driver of the target node has been initialized and the state of the controller area network state machine is set to a normal communication state, then starting the message communication port of the target node, the message communication port being used to receive messages;

[0065] In order to facilitate understanding of the process described in step 101, it is necessary to understand that in the standard AutoSar project, the StartOS function is called through the Electronic Control Unit Manager (EcuM), and then the internal components of the OS are initialized based on the StartOS function, the self-starting tasks, alarms or scheduling tables are activated, and finally the operating system timer is started, and the first task scheduling is triggered, thereby realizing the startup of the operating system. The aforementioned calling of the StartOS function and other processes are all steps performed before the operating system is started. In short, after the operating system is started refers to the time range after the operating system is started after a series of initializations are performed based on the StartOS function, and before the operating system is started refers to a time range that does not intersect with the aforementioned time range.

[0066] As a refinement of the above-mentioned step 101, before starting the operating system, if it is determined that the controller area network driver of the target node has been initialized and the state of the controller area network state machine (Controller Area Network State Manager, CanSM) is in a normal communication state, then the message communication port of the target node is started, wherein the target node includes but is not limited to a microcontroller unit (Microcontroller Unit, MCU) or an electronic control unit (Electronic Control Unit, ECU), and the controller area network driver refers to the Can driver in AutoSar.

[0067] In some embodiments, in addition to receiving message data, the message communication port is also used to send message data.

[0068] Step 102: After starting the operating system, waking up the target node based on the message received by the message communication port;

[0069] As a refinement of the above step 102, after the operating system is started, the target node is woken up based on the message received by the message communication port, and the message communication port of the target node is opened before the operating system is started to receive the message in advance, and the target node is woken up directly based on the message after the operating system is started, thereby shortening the time it takes for the target node to be woken up.

[0070] Step 103: After the target node is awakened, determine whether the first frame message to be sent by the target node is a first network management message;

[0071] As a refinement of the above step 103, in order to facilitate understanding of the above process, this embodiment provides an exemplary explanation, for example: when there is a wake-up source, the vehicle computer may need to wake up multiple nodes to execute events in response to the wake-up source, and the awakening of the multiple nodes can be implemented by, but not limited to, the following methods, for example: after waking up a node, the awakened node wakes up other nodes that have not yet been awakened, that is, the awakened node sends a network management message again to wake up other nodes that have not been awakened. Therefore, after the target node is awakened, in order to enable the target node to wake up other nodes accurately, it is necessary to solve the problem of directly sending application messages after the target node is awakened. In order to ensure that the first frame message sent by the target node after being awakened is a network management message, this embodiment determines whether the first frame message to be sent by the target node is the first network management message.

[0072] Step 104: If it is determined that the first frame message is not the first network management message, stop sending the first frame message and continue to determine whether the second frame message to be sent by the target node is the first network management message;

[0073] As a refinement of the above-mentioned step 104, when it is determined that the first frame message is not the first network management message, the sending of the first frame message is stopped, thereby ensuring that the target node does not send a message by mistake, and by continuing to judge whether the second frame message to be sent is the second network management message, it is determined whether the network management message exists in the subsequent frame messages, that is, through the round-robin judgment of step 104, the existence of the first network management message is finally determined.

[0074] Step 105: If it is determined that the second frame message is the first network management message, the second frame message is sent.

[0075] As a refinement of the above-mentioned step 105, when it is determined that the second frame message is the first network management message, the second frame message is sent to the other nodes. Combined with the detailed description of step 104, it can be seen that after undergoing the round-robin judgment of step 104, it is finally determined that the message frame number corresponding to the first network management message is not necessarily the second frame. This embodiment determines the first network management message through round-robin judgment, thereby ensuring that the first frame message sent by the target node must be a network management message, thereby solving the problem that when the first frame message sent by the node is an application message, the controller that does not support specific frame wake-up will be mistakenly awakened.

[0076] The method for sending the first frame message provided by the present invention is as follows: before starting the operating system, if it is determined that the controller LAN driver of the target node has been initialized and the state of the controller LAN state machine is set to the normal communication state, then the message communication port of the target node is started, and the message communication port is used to receive messages; after starting the operating system, the target node is woken up based on the message received by the message communication port; after the target node is woken up, it is judged whether the first frame message to be sent by the target node is the first network management message; if it is determined that the first frame message is not the first network management message, the sending of the first frame message is stopped, and it is continued to be judged whether the second frame message to be sent by the target node is the first network management message; if it is determined that the second frame message is the first network management message, the second frame message is sent. Compared to related technologies, this method enables the target node's message communication port to receive messages before starting the operating system, and then wakes up the target node based on the message after starting the operating system, thus saving time in waking up the target node. After waking up the target node, when the target node is about to send a first message frame, it determines whether the first message frame is a first network management message. If the first message frame is not the first network management message, it stops sending the first message frame and continues to determine whether the second message frame to be sent is the first network management message. If the second message frame is determined to be the first network management message, it sends the second message frame. This mechanism ensures that the first message frame sent by the target node after waking up is a network management message, thereby resolving the existing problem that when the first message frame sent by the node is an application message, a controller that does not support specific frame wakeup may be mistakenly awakened.

[0077] As a refinement of the embodiment of the present disclosure, after starting the message communication port of the target node, the method can also adopt but is not limited to the following implementation methods, for example: based on each frame of the message received by the message communication port, it is determined whether the message is a second network management message; when it is determined that the message is the second network management message, a preset time period for passively waking up the target node is set.

[0078] To facilitate understanding of the above process, this embodiment provides an exemplary explanation. For example, in a CAN-driven receive interrupt, the received message's CanId is detected to determine whether it is a second network management message between 0x400 and 0x4FF. This means that the callback function returns whether the CanId of the message received on the message communication port is between 0x400 and 0x4FF. If it is, the message is determined to be a second network management message. After detecting the second network management message, the NM_Recv_Timer is set to 5 seconds, and after 5 seconds, the NM_Recv_Timer is decremented to 0. The NM_Recv_Timer is a timer for receiving CAN network management messages and is also used to passively wake up the network in the absence of an active wake-up source. The 5 seconds specified as the preset time period is merely an example, and this embodiment does not limit the preset time period.

[0079] As a refinement of the above embodiment, when waking up the target node based on the message in step 102, the following implementation method can also be adopted but not limited to, for example: if the target node does not receive the message from the active wake-up source within the preset time period, the target node is passively awakened based on the second network management message; if the target node receives the message from the active wake-up source within the preset time period, the target node is actively awakened based on the message from the active wake-up source.

[0080] As a refinement of the above steps, the method of distinguishing the active wake-up and the passive wake-up includes: distinguishing based on the format of the message for waking up the target node, the second network management message corresponds to the message format for passively waking up the target node, and the message of the active wake-up source corresponds to the message format for actively waking up the target node. The active wake-up source includes but is not limited to the node that is awakened by the k15 power-on, that is, hard-wired awakening, and the nodes awakened by the network management message can be classified as passive wake-up sources.

[0081] In some embodiments, when waking up the target node, the following implementation methods may also be used, but are not limited to, for example: in the InitTask stage after StartOS, identify the wake-up source and request the network, and if there is an active wake-up source, request ComM_RequestComMode to be COMM_FULL_COMMUNICATION. In the absence of an active wake-up source, if NM_Recv_Timer is greater than 0, call ComM_EcuM_WakeUpIndication for a passive wake-up request. Among them, StartOS refers to starting the operating system, InitTask refers to the initialization task, ComM_RequestComMode is a function used to request a specific communication mode, COMM_FULL_COMMUNICATION is a communication mode, and ComM_EcuM_WakeUpIndication is a function used to indicate a wake-up event in the EcuM module.

[0082] As a refinement of the above embodiment, when executing step 102 to wake up the target node based on the message, the following implementation method can also be adopted but not limited to, for example: if the target node is awakened outside the preset time period, the awakening is recorded as a cold power-on or invalid awakening.

[0083] As a refinement of the above embodiment, that is, when the target node is awakened after the NM_Recv_Timer is 0, the awakening event is recorded as cold power-on or invalid awakening.

[0084] In some embodiments, a log record is generated by recording the wake-up event as a cold power-on or an invalid wake-up. Furthermore, the generated log record can be used for fault diagnosis and system stability analysis, etc. It should be understood that the above description of the role of log records is only exemplary and does not constitute a limitation of the present disclosure.

[0085] As a refinement of the above embodiment, before determining that the controller area network driver of the target node has been initialized and the state of the controller area network state machine is set to a normal communication state, the method can also adopt but is not limited to the following implementation methods, for example: initializing the controller area network driver based on each target initialization function in the communication protocol stack; and calling the main function of the controller area network state machine, and setting the state of the controller area network state machine to a normal communication state based on the main function.

[0086] In order to facilitate understanding of the above solution, this embodiment provides an exemplary explanation. For example, before StartOS, the target initialization functions of the Can driver and the related communication protocol stack are called, and after the Can driver is initialized based on each target initialization function, the CanSM_MainFunction is called in a loop until the CanSM state is CANSM_BSM_S_NOCOM. This is to reduce the time that the CanSM stays in the CANSM_BSM_S_NOT_INITIALIZED state and the CANSM_BSM_S_PRE_NOCOM state, so that the network can reach the CANSM_BSM_S_FULLCOM state as soon as possible when requested. In the CANSM_BSM_S_FULLCOM state, the target node can perform full communication. CanSM_MainFunction is the main function, and the CanSM_MainFunction is used to switch the state of the CanSM. CANSM_BSM_S_NOCOM, CANSM_BSM_S_NOT_INITIALIZED, and CANSM_BSM_S_FULLCOM are all states corresponding to the CanSM.

[0087] In some embodiments, after the CanSM state reaches CANSM_BSM_S_NOCOM, CanIf_SetControllerMode is called to enable the Controller to receive the second network management message in advance. That is, before the CanSM state is set to CANSM_BSM_S_FULLCOM, the Controller is enabled after the CanSM state reaches CANSM_BSM_S_NOCOM to receive the second network management message as soon as possible, thereby shortening the time to wake up the target node. CanIf_SetControllerMode is used to set the controller mode, and the Controller is the controller.

[0088] As a refinement of the above embodiment, after sending the second frame message, the method may adopt but is not limited to the following implementation manner, for example: starting a protocol data unit group of an application message; and sending the application message based on the protocol data unit group.

[0089] To facilitate understanding of the above scheme, this embodiment provides an exemplary explanation. For example, when the CanNM state is Prepare Bus Sleep Mode or Bus Sleep Mode, NM_Tx_Confirm_Flag is set to 0. After determining that the target node sends the first frame network management message, NM_Tx_Confirm_Flag is set to 1 in CanNm_TxConfirmation. Only when NM_Tx_Confirm_Flag is 1, the PduGroup of the application message is allowed to be opened, and the application message is sent based on the opening of the PduGroup of the application message. Prepare Bus Sleep Mode and Bus Sleep Mode are different states corresponding to the CanNM. CanNm_TxConfirmation is a callback function used to return the value of NM_Tx_Confirm_Flag. When it is determined that the callback function return value is 1, the PduGroup of the application message is opened. The NM_Tx_Confirm_Flag flag is used to identify whether the first frame network management message is sent successfully. If it is sent successfully, the flag is 1. In this embodiment, setting NM_Tx_Confirm_Flag to 1 is only an example. The NM_Tx_Confirm_Flag can be set to any value and is not limited in this embodiment. The PduGroup is the protocol data unit group.

[0090] In order to facilitate understanding of any of the solutions involved in the above embodiments, Figure 2 A flow chart of another method for sending a first frame message provided by an embodiment of the present disclosure is shown as follows: Figure 2As shown, after receiving the wakeup source, the Trcv_Init, Can_Init, CanIf_Init, CanSM_Init, and ComM_Init functions are called to initialize the Can driver in advance. CanSM_MainFunction is then called in a loop until the CanSM state equals CANSM_BSM_S_NOCOM. CanIf_SetControllerMode is then called to set the Controller state to CANIF_CS_STARTED. This enables the Can to receive interrupts after StartOS. Trcv_Init, Can_Init, CanIf_Init, CanSM_Init, and ComM_Init are the initialization functions for each target, and CANIF_CS_STARTED indicates that the Controller is in the startup state. During the InitTask phase, it is determined whether there is an active wakeup source. If so, ComM_RequestComMode is called to request that the ComM state be COMM_FULL_COMMUNICATION. If no active wakeup source exists, the system checks whether NM_Recv_Timer is greater than 0. If so, it calls ComM_EcuM_WakeUpIndication to request a passive wakeup. During the PeriodTask phase, the system checks whether NM_Tx_Confirm_Flag is 1. If so, it opens the PduGroup for the application message. The PeriodTask phase is a periodic task phase, and the NM message is the first network management message.

[0091] Combining the above solutions, Figure 3 A schematic diagram of a framework of a system for sending a first frame message provided in an embodiment of the present disclosure, wherein the method for sending a first frame message can be applied to this system, such as Figure 3 As shown in the figure, this system includes a CAN driver pre-enablement module, a network request module, and a communication control module. The CAN driver pre-enablement module is used to pre-initialize the CAN communication protocol stack and enable CAN communication, so that CAN interrupts can be enabled after StartOS. The network request module is used to determine the wakeup source during the InitTask phase and determine whether the wakeup is active or passive. The communication control module is used to enable the PduGroup for application messages after the NM_Tx_Confirm_Flag is set to 1.

[0092] In summary, this embodiment can achieve the following effects:

[0093] 1. By starting the message communication port of the target node to receive messages before starting the operating system, and waking up the target node based on the message after starting the operating system, the time for waking up the target node is saved. After waking up the target node, when the target node is about to send a first frame message, it is determined whether the first frame message is a first network management message. If the first frame message is not the first network management message, the first frame message is stopped, and it is continued to be determined whether the second frame message to be sent is the first network management message. If it is determined that the second frame message is the first network management message, the second frame message is sent. The above mechanism is used to ensure that after the target node is awakened, the first diagnosis message it sends is a network management message, thereby solving the problem in the prior art that when the first frame message sent by the node is an application message, the controller that does not support specific frame wake-up will be mistakenly awakened.

[0094] 2. By calling CanSM_MainFunction in advance, the 10ms / 5ms cycle scheduling after StartOS is avoided, saving an estimated 40ms / 20ms. During passive wakeup, the Controller is turned on in advance, and network management messages are identified in the Can receive interrupt and NM_Recv_Timer is set. Compared with the method of identifying network management messages through the CanSM WUVALIDATION state, this method saves 50ms and reduces the risk of missing network management messages. Only when NM_Tx_Confirm_Flag is 1 is the PduGroup for application messages allowed to be opened, ensuring that the first frame message is a network management message. Compared with using the AutoSar CanIf PN function, this method does not use CanIf to forcibly filter network management messages, thus ensuring the cycle of application message sending.

[0095] 3. This disclosure can significantly improve the time it takes to send the first frame message and ensure that the first frame is a network management message. This method is applicable to controllers that support and do not support specific frame wake-up, and is applicable to both active and passive wake-up scenarios.

[0096] 4. The present disclosure is concise and feasible, does not change the existing architecture of AutoSar, significantly optimizes the first-frame message time, ensures that the first-frame message is a network management message and does not affect the periodic sending order of the application message cycle.

[0097] Corresponding to the above-mentioned method for sending a first-frame message, the present invention further provides a device for sending a first-frame message. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment and will not be repeated in the present invention.

[0098] Figure 4A schematic diagram of a structure of a device for sending a first frame message provided by an embodiment of the present disclosure, such as Figure 4 Shown, including:

[0099] A first starting unit 21 is configured to start a message communication port of the target node before starting the operating system, when it is determined that the controller area network driver of the target node has been initialized and the state of the controller area network state machine is set to a normal communication state, wherein the message communication port is used to receive messages;

[0100] A wake-up unit 22 is configured to wake up the target node based on the message received by the message communication port after starting the operating system;

[0101] A first judging unit 23 is configured to judge, after the target node is awakened, whether a first frame message to be sent by the target node is a first network management message;

[0102] a stopping unit 24 configured to, when determining that the first frame message is not the first network management message, stop sending the first frame message and continue to determine whether a second frame message to be sent by the target node is the first network management message;

[0103] The first sending unit 25 is configured to send the second frame message when it is determined that the second frame message is the first network management message.

[0104] The device for sending the first frame message provided by the present invention, before starting the operating system, if it is determined that the controller LAN driver of the target node has been initialized and the state of the controller LAN state machine is set to the normal communication state, then the message communication port of the target node is started, and the message communication port is used to receive messages; after starting the operating system, the target node is woken up based on the message received by the message communication port; after the target node is woken up, it is judged whether the first frame message to be sent by the target node is the first network management message; if it is determined that the first frame message is not the first network management message, the sending of the first frame message is stopped, and it is continued to be judged whether the second frame message to be sent by the target node is the first network management message; if it is determined that the second frame message is the first network management message, the second frame message is sent. Compared with the related art, by starting the message communication port of the target node to receive messages before starting the operating system, and waking up the target node based on the message after starting the operating system, the time for waking up the target node is saved. After waking up the target node, when the target node is about to send the first frame message, it is determined whether the first frame message is the first network management message. If the first frame message is not the first network management message, the first frame message is stopped, and it is continued to be determined whether the second frame message to be sent is the first network management message. If it is determined that the second frame message is the first network management message, the second frame message is sent. The above-mentioned mechanism is used to ensure that after the target node is awakened, the first frame message it sends is a network management message, thereby solving the problem in the prior art that when the first frame message sent by the node is an application message, the controller that does not support specific frame wake-up will be mistakenly awakened. Figure 5 A schematic diagram of a structure of a device for sending a first frame message provided by an embodiment of the present disclosure, such as Figure 5 As shown, the device includes:

[0105] A second judgment unit 26 is configured to judge whether the message is a second network management message when each frame of the message is received by the message communication port;

[0106] The setting unit 27 is configured to set a preset time period for passively waking up the target node when it is determined that the message is the second network management message.

[0107] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 5 As shown, the awakening unit 22 includes:

[0108] A first awakening module 221 is configured to passively awaken the target node based on the second network management message when the target node does not receive a message from the active awakening source within the preset time period;

[0109] The second awakening module 222 is configured to actively awaken the target node based on the message from the active awakening source when the target node receives the message from the active awakening source within the preset time period.

[0110] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 5 As shown, the device also includes:

[0111] The recording unit 28 is configured to record, when the target node is awakened outside the preset time period, this awakening as a cold power-on or an invalid awakening.

[0112] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 5 As shown, the device includes:

[0113] an initialization unit 29, configured to initialize the controller area network driver based on each target initialization function in the communication protocol stack; and

[0114] The calling unit 210 is configured to call a main function of the CAN state machine and set the state of the CAN state machine to a normal communication state based on the main function.

[0115] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 5 As shown, the device includes:

[0116] A second starting unit 211, configured to start a protocol data unit group of an application message;

[0117] The second sending unit 212 is configured to send the application message based on the protocol data unit group.

[0118] It should be noted that the above explanation of the method embodiment is also applicable to the device of the embodiment of the present disclosure, and the principles are the same, which is no longer limited in the embodiment of the present disclosure.

[0119] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0120] Figure 6A schematic block diagram of an example electronic device 300 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0121] like Figure 6 As shown, the device 300 includes a computing unit 301, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 302 or a computer program loaded from a storage unit 308 into a RAM (Random Access Memory) 303. Various programs and data required for the operation of the device 300 can also be stored in the RAM 303. The computing unit 301, ROM 302, and RAM 303 are connected to each other via a bus 304. An I / O (Input / Output) interface 305 is also connected to the bus 304.

[0122] Various components in device 300 are connected to I / O interface 305, including: an input unit 306, such as a keyboard, mouse, etc.; an output unit 307, such as various types of displays, speakers, etc.; a storage unit 308, such as a magnetic disk, optical disk, etc.; and a communication unit 309, such as a network card, modem, wireless communication transceiver, etc. The communication unit 309 allows device 300 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0123] The computing unit 301 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), various specialized AI (Artificial Intelligence) computing chips, various computing units that run machine learning model algorithms, a DSP (Digital Signal Processor), and any suitable processor, controller, microcontroller, etc. The computing unit 301 performs the various methods and processes described above, such as the method for sending the first frame message. For example, in some embodiments, the method for sending the first frame message can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 308. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 300 via the ROM 302 and / or the communication unit 309. When the computer program is loaded into the RAM 303 and executed by the computing unit 301, one or more steps of the method described above can be performed. Alternatively, in other embodiments, the computing unit 301 may be configured to execute the aforementioned method for sending the first frame message in any other appropriate manner (for example, by means of firmware).

[0124] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System on Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0125] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0126] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0127] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0128] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.

[0129] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact via a communication network. This client-server relationship is established by computer programs running on the respective computers, establishing a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host, a host product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosts and VPS services ("Virtual Private Servers" or simply "VPS"). The server may also be a server in a distributed system or a server integrated with blockchain.

[0130] It's important to note that artificial intelligence (AI) is the study of how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). This encompasses both hardware and software technologies. AI hardware technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily encompass computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graphs.

[0131] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not limited herein.

[0132] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. A method for sending a first frame message, characterized in that: include: Before starting the operating system, if it is determined that the controller area network driver of the target node has been initialized and the state of the controller area network state machine is set to a normal communication state, then starting a message communication port of the target node, the message communication port being used to receive messages; After starting the operating system, waking up the target node based on the message received by the message communication port; After the target node is awakened, determining whether a first frame message to be sent by the target node is a first network management message; If it is determined that the first frame message is not the first network management message, stop sending the first frame message, and continue to determine whether the second frame message to be sent by the target node is the first network management message; If it is determined that the second frame message is the first network management message, the second frame message is sent.

2. The method according to claim 1, characterized in that After starting the message communication port of the target node, the method includes: Based on each time the message communication port receives a frame of the message, determining whether the message is a second network management message; In a case where it is determined that the message is the second network management message, a preset time period for passively waking up the target node is set.

3. The method according to claim 2, characterized in that Waking up the target node based on the message includes: If the target node does not receive a message from the active wake-up source within the preset time period, passively waking up the target node based on the second network management message; If the target node receives the message from the active wake-up source within the preset time period, the target node is actively woken up based on the message from the active wake-up source.

4. The method according to claim 2, characterized in that After waking up the target node based on the message, the method includes: If the target node is awakened outside the preset time period, the awakening is recorded as a cold power-on or an invalid awakening.

5. The method according to claim 1, wherein Before determining that the controller area network driver of the target node has been initialized and the state of the controller area network state machine is set to a normal communication state, the method includes: Initializing the controller area network driver based on each target initialization function in the communication protocol stack; and A main function of the controller area network state machine is called, and the state of the controller area network state machine is set to a normal communication state based on the main function.

6. The method according to claim 1, wherein After sending the second frame message, the method includes: Start the protocol data unit group of the application message; The application message is sent based on the protocol data unit group.

7. A device for sending a first frame message, characterized in that: include: a first starting unit, configured to start a message communication port of the target node before starting the operating system, when it is determined that the controller area network driver of the target node has been initialized and the state of the controller area network state machine is set to a normal communication state, wherein the message communication port is used to receive messages; a wake-up unit, configured to wake up the target node based on the message received by the message communication port after starting the operating system; A first judging unit is configured to judge, after the target node is awakened, whether a first frame message to be sent by the target node is a first network management message; a stopping unit, configured to, when determining that the first frame message is not the first network management message, stop sending the first frame message, and continue to determine whether a second frame message to be sent by the target node is the first network management message; The first sending unit is configured to send the second frame message when it is determined that the second frame message is the first network management message.

8. A vehicle, characterized in that: Includes the device for sending the first frame message as described in claim 7.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.

11. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 6.