Method for FBL (flash memory controller) to write vehicle controller based on UDS (Universal diagnostic System) diagnostic serviceTechnical Field
The invention belongs to the technical field of vehicle controller upgrading, and particularly relates to a FBL (FBL flash memory) vehicle controller technology based on UDS (Universal diagnosis service).
Background
When the FBL (flash bootloader) flushing of the vehicle controller is performed by using the UDS diagnostic service, the upper computer generally needs to send a diagnostic online message in a period of less than 5s by using a function addressing mode in the flushing process in addition to sending a diagnostic message for normal flushing to the flushed controller, so that other non-flushed controllers maintain the forbidden communication and forbidden recording DTC states. For the brushed controller, both physical addressing messages and functional addressing messages are received, wherein the physical addressing messages are event messages, and the functional addressing messages are periodic messages. Because of the different ways of processing by the brush controller, the following problems may occur: firstly, the diagnosis online message reaches a brushed controller before the brushing message, and the interval time between the diagnosis online message and the brushing message reaching the brushed controller is very short, so that the brushed controller can only process the diagnosis online message and not process the brushing message; secondly, the message is a long frame and in the process of sending, the diagnosis online message is also sent because of reaching the sending period, so that the brushed controller is doped with a frame of diagnosis online message in the middle of the received long frame message, thereby discarding the message.
Disclosure of Invention
The invention aims to provide a method for brushing a vehicle controller by an FBL based on a UDS diagnosis service, which solves the technical problems: the FBL is disturbed by the diagnosis online message in the process of writing the vehicle controller, so that the vehicle controller is failed to be written.
In order to solve the technical problems, the invention adopts the following technical scheme: a method for FBL to flush a vehicle controller based on UDS diagnostic services, the method comprising the steps of transmitting a flush message, the specific message comprising:
a1, checking a forbidden mark F2 of the refreshing message, judging whether the F2 is set, if not, setting a sending mark F1 of the refreshing message;
step A2, the brushing message is sent;
and step A3, after the brushing message is successfully sent, clearing a sending identifier F1 of the brushing message.
Preferably, the method comprises the steps of,
in the step A1, if yes, that is, the F2 is set, the forbidden transmission flag F2 of the brushing message needs to be checked again, where the F2 set indicates that the diagnostic online message is being sent or that the diagnostic online message is sent but the brushing message is in a delayed sending period.
Preferably, the method comprises the steps of,
the delay time of the brushing message in the delay sending period is 20ms.
The invention also provides a method for brushing the vehicle controller by the FBL based on the UDS diagnosis service, which comprises the following specific steps of sending the diagnosis online message:
step B1: b2, judging whether the F1 is set or not, if not, executing the step T1, wherein the diagnosis online message timer T1 is overtime, the diagnosis online message is a timing period message, checking the transmission mark F1 of the brushing message;
step B2: setting a forbidden mark F2 of the brushing message and sending the diagnosis online message;
step B3: after the online diagnosis message is successfully generated, starting a delay transmission timer T2 of the brushing message;
step B4: and when the delay sending timer T2 of the refreshing message is overtime, the forbidden sending mark F2 of the refreshing message is cleared, and the diagnosis online message timer T1 is reset.
Preferably, the method comprises the steps of,
in the step B1, if the F1 is set, the sending identifier F1 of the refresh message is checked again, where the F1 is set to indicate that the refresh message is being sent.
Preferably, the method comprises the steps of,
in the step B1, the timing duration of the diagnostic online report Wen Dingshi T1 is 3s.
Preferably, the method comprises the steps of,
in the step B3, the delay duration of the delay transmission timer T2 of the refresh packet is 20ms.
By adopting the technical scheme, the invention has the following beneficial technical effects:
in the process of the controller to be refreshed, the refresh message is sent to the controller in a long frame form continuously, and the diagnosis online message is sent to the controller in a frame form periodically, so that the refreshed controller has a diagnosis online message of one frame in the middle of the received long frame refresh message, thereby discarding the refresh message, meanwhile, the fact that the diagnosis online message reaches the refreshed controller before the refresh message at a certain moment is guaranteed, and the interval time is too short, so that the refreshed controller can only process the diagnosis online message and ignore the refresh message. In order to solve the problem that the diagnosis on-line message affects the controller to write, the invention adopts the following technical scheme: from the perspective of sending the refreshing message, checking a forbidden transmission mark F2 of the refreshing message, judging whether F2 is set, if F2 is set, diagnosing that the online message is being sent or diagnosing that the online message is sent but the refreshing message is in a delay sending period, wherein the delay time of the refreshing message in the delay sending period is 20ms, rechecking the forbidden transmission mark F2 of the refreshing message, if F2 is not set, setting a sending mark F1 of the refreshing message, sending the refreshing message, and clearing the sending mark F1 of the refreshing message after the refreshing message is successfully sent. From the perspective of sending the diagnosis online message, after the diagnosis online message Wen Dingshi device T1 overtakes, checking the sending identifier F1 of the refreshing message, judging whether F1 is set, if F1 is set, namely that the refreshing message is being sent, rechecking the sending identifier F1 of the refreshing message, if not, setting the forbidden sending identifier F2 of the refreshing message, sending the diagnosis online message, starting a delay sending timer T2 of the refreshing message after the diagnosis online message is successfully sent, and starting the delay sending timer T2 of the refreshing message to overtime, so as to clearly forbidden sending identifier F2 of the refreshing message, and resetting the diagnosis online message Wen Dingshi device T1. The time for sending the brushing message and the time for sending the diagnosis on-line message are staggered, namely in sequence, from the perspective of sending the brushing message or from the perspective of sending the diagnosis on-line message, so that the brushed controller can be effectively ensured to avoid being interfered by the diagnosis on-line message in the brushing process, and the brushing success rate of the vehicle controller is improved.
Drawings
FIG. 1 is a flow chart of a message transmission for flushing;
fig. 2 is a flow chart of diagnostic online messaging.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
For ease of understanding, some of the terms used in the present invention are explained as follows:
UDS: all Unified Siagnostic Services, unified diagnostic service, is commonly used in the automotive industry.
Functional addressing (term in the background): in the UDS diagnostic service, a client issues diagnostic requests of the same function to a plurality of servers.
Physical addressing (term in the background): in the UDS diagnosis service, one-to-one diagnosis is performed between a client and a server.
In the process of the controller to be refreshed, the refresh message is sent to the controller in a long frame form without interruption, and the diagnosis online message is sent to the controller in a frame form periodically, so that the controller has one frame of diagnosis online message in the middle of the received long frame refresh message, thereby discarding the refresh message, meanwhile, the condition that the diagnosis online message reaches the refreshed controller before the refresh message at a certain moment is guaranteed, and the interval time is too short, so that the refreshed controller can only process the diagnosis online message and ignore the refresh message.
The present invention provides a method for FBL to flush a vehicle controller based on UDS diagnostic services, which solves the above-mentioned problems, and generally as described below, the method is such that the diagnostic online message is timed at 3s cycles to allow enough time to handle the message "collision" phenomenon (interference phenomenon) in which the flush message is sent exactly simultaneously with the diagnostic online message. After the timing time of the on-line message is up, entering a sending waiting state; in the send wait state, a loop check is made to see if a flush message is being sent. If the brushing message is not in transmission, diagnosing the online message to be sent immediately; if the refresh message is in the process of sending, the message still stays in a waiting state for sending. After the on-line message is successfully sent, the delay mark of the brushing message is set, and meanwhile, a delay sending timer T2 of the brushing message is started, wherein the delay time is 20ms. After the timer T2 expires, the diagnostic on-line report Wen Dingshi timer T1 is restarted.
Specifically, as shown in fig. 1, in order to provide a flow chart for sending a refresh message according to the present invention, the specific steps for sending the refresh message include:
and A1, checking a forbidden mark F2 of the refreshing message, judging whether F2 is set, if not, setting a sending mark F1 of the refreshing message.
And step A2, sending a refreshing message.
And step A3, after the message is successfully sent, the sending identification F1 of the message is cleared.
Optionally, in step A1, if yes, that is, F2 is set, the forbidden flag F2 of the refresh message needs to be checked again, where the F2 set indicates that the online message is being sent or that the online message is already sent but the refresh message is in a delayed sending period.
Optionally, the delay time of the refresh message in the delay transmission period is 20ms.
As shown in fig. 2, for a diagnostic online message transmission flowchart, the specific steps for transmitting a diagnostic online message include:
step B1: b2, judging whether F1 is set or not, if not, executing the step T1, wherein the diagnosis online message timer T1 is overtime, and the diagnosis online message is a timing period message, checking the transmission mark F1 of the brushing message;
step B2: setting a forbidden transmission mark F2 of the brushing message, and transmitting a diagnosis online message;
step B3: after the online message is successfully diagnosed, starting a delay sending timer T2 for the message to be written;
step B4: the delayed transmission timer T2 of the refresh message is timed out, the forbidden transmission flag F2 of the refresh message is cleared, and the diagnostic online message Wen Dingshi device T1 is reset.
Optionally, in step B1, if F1 is set, the transmission flag F1 of the brushed message is checked again, where F1 is set to indicate that the brushed message is being transmitted.
Optionally, in step B1, the timing duration of the diagnostic online message timer T1 is 3s.
Optionally, in step B3, the delay duration of the delayed transmission timer T2 of the refresh packet is 20ms.
The invention has the advantages that: the time for sending the brushing message and the time for sending the diagnosis on-line message are staggered, namely in sequence, from the perspective of sending the brushing message or from the perspective of sending the diagnosis on-line message, so that the brushed controller can be effectively ensured to avoid being interfered by the diagnosis on-line message in the brushing process, and the brushing success rate of the vehicle controller is improved.