Method for writing vehicle controller by FBL (fiber Bragg Grating) based on UDS (UDS) diagnosis serviceTechnical Field
The invention belongs to the technical field of vehicle controller upgrading, and particularly relates to a technology of an FBL (fiber Bragg Grating) vehicle controller based on UDS (UDS) diagnosis service.
Background
When the UDS diagnostic service is used for performing fbl (flash bootloader) flash of the vehicle controller, the upper computer not only sends a diagnostic message of normal flash to the controller to be flushed by using a physical addressing mode, but also usually sends a diagnostic online message by using a functional addressing mode in a cycle less than 5s in the flash process so that other controllers not to be flushed maintain the states of forbidding communication and forbidding recording of DTC. For the controller to be brushed, the physical addressing message and the functional addressing message are received, the physical addressing message is an event message, and the functional addressing message is a periodic message. Due to different processing modes of the brushed controllers, the following problems may occur: firstly, the diagnostic online message reaches the controller to be refreshed before the refresh message, and the interval time between the diagnostic online message and the refresh message reaching the controller to be refreshed is very short, so that the controller to be refreshed can only process the diagnostic online message and does not process the refresh message; secondly, the flash message is a long frame and is being sent, and the diagnostic on-line message is also sent when the sending period is reached, so that the flash controller adulterates a frame of diagnostic on-line message in the middle of the received long frame flash message, thereby discarding the flash message.
Disclosure of Invention
The invention aims to provide a method for writing a vehicle controller by an FBL (fiber Bragg Grating) based on a UDS (UDS) diagnosis service, which solves the technical problems that: the FBL is interfered by the diagnostic online message in the process of flashing the vehicle controller, so that the flashing vehicle controller is out of order.
In order to solve the technical problems, the invention adopts the following technical scheme: a method for writing a vehicle controller by an FBL (fiber Bragg Grating) based on a UDS (UDS) diagnostic service comprises the steps of sending a writing message, wherein the step of sending the writing message comprises the following specific steps:
step A1, checking the forbidden identifier F2 of the flash message, judging whether the F2 is set, if not, setting the sending identifier F1 of the flash message;
step A2, sending the flash message;
and A3, after the brushing message is successfully sent, clearing the sending identification F1 of the brushing message.
Preferably, the first and second electrodes are formed of a metal,
in the step a1, if yes, that is, the F2 is set, the disable flag of the flush message needs to be rechecked, which is F2, wherein the F2 setting indicates that the diagnostic online message is being sent or the diagnostic online message has been sent but the flush message is in a delayed sending period.
Preferably, the first and second electrodes are formed of a metal,
the delay time of the flash message in the delay sending period is 20 ms.
The invention also provides a method for writing a vehicle controller by the FBL based on the UDS diagnostic service, which comprises the steps of sending a diagnostic online message, wherein the specific step of sending the diagnostic online message comprises the following steps:
step B1: if the diagnostic online message timer T1 is overtime, wherein the diagnostic online message is a timing cycle message, checking a sending identifier F1 of a flash message, judging whether the F1 is set, and if not, executing the step B2;
step B2: setting a forbidden identifier F2 of the flash message, and sending the diagnosis online message;
step B3: after the diagnosis online message is successfully generated, starting a delay sending timer T2 of the flash message;
step B4: and when the delayed sending timer T2 of the flash message is overtime, clearing the forbidden identification F2 of the flash message, and resetting the diagnostic online message timer T1.
Preferably, the first and second electrodes are formed of a metal,
in the step B1, if the F1 is set, the sending identifier F1 of the flush packet is rechecked, where the F1 is set to indicate that the flush packet is being sent.
Preferably, the first and second electrodes are formed of a metal,
in the step B1, the diagnostic online message timer T1 has a timing duration of 3 s.
Preferably, the first and second electrodes are formed of a metal,
in the step B3, the delay duration of the delay sending timer T2 of the flush message is 20 ms.
By adopting the technical scheme, the beneficial technical effects of the invention are as follows:
in the process of the flash controller, the flash messages are sent to the controller continuously in a long frame mode, and the diagnosis online messages are sent to the controller periodically in a frame mode, so that the flash controller has one frame of diagnosis online messages in the middle of the received long frame flash messages, the flash messages are discarded, meanwhile, the fact that the diagnosis online messages reach the flash controller before the flash messages at a certain moment is determined, the interval time is too short, and the flash controller can only process the diagnosis online messages and ignore the flash messages. In order to solve the problem that the diagnosis online message influences the controller to write in a flashing way, the invention adopts the following technical scheme: from the perspective of sending the flush message, checking a prohibition identifier F2 of the flush message, determining whether F2 is set, if F2 is set, that is, diagnosing that the online message is being sent or that the online message has been sent but the flush message is in a delayed sending period, wherein the delay time of the flush message in the delayed sending period is 20ms, the prohibition identifier F2 of the flush message needs to be rechecked, if F2 is not set, setting a sending identifier F1 of the flush message, sending the flush message, and clearing the sending identifier F1 of the flush message after the flush message is successfully sent. From the perspective of sending the diagnosis online message, after the diagnosis online message timer T1 times out, the sending identifier F1 of the flush message is checked, whether F1 is set is judged, if F1 is set, that is, it indicates that a flush message is being sent, the sending identifier F1 of the flush message is rechecked, if not, the forbidden identifier F2 of the flush message is set, the diagnosis online message is sent, after the diagnosis online message is successfully sent, the delayed sending timer T2 of the flush message is started, the delayed sending timer T2 of the flush message times out, the forbidden identifier F2 of the flush message is clear, and the diagnosis online message timer T1 is reset. The time for sending the flash message and the time for sending the diagnosis online message are staggered from the perspective of sending the flash message or the perspective of sending the diagnosis online message, namely, the flash message and the diagnosis online message are sequenced, so that the flash controller can be effectively prevented from being interfered by the diagnosis online message in the flash process, and the flash success rate of the vehicle controller is improved.
Drawings
FIG. 1 is a flow diagram of a flash message transmission;
FIG. 2 is a diagnostic online messaging flow diagram.
Detailed Description
The invention will be further explained with reference to the drawings.
For ease of understanding, some of the terms used in the present invention are explained as follows:
UDS: all are called as Unified diagnostic Services, which are mainly used in the automobile industry.
Functional addressing (term in background art): in the UDS diagnostic service, a client sends diagnostic requests of the same function to a plurality of servers.
Physical addressing (a term in the background art): in the UDS diagnosis service, one-to-one diagnosis is performed between a client and a server.
In the process of the flash controller, the flash messages are sent to the controller continuously in a long frame mode, the diagnosis online messages are sent to the controller periodically in a frame mode, the controller is caused to have one frame of diagnosis online messages in the middle of the received long frame flash messages, the flash messages are discarded, meanwhile, it is determined that at a certain moment, the diagnosis online messages reach the flash controller before the flash messages, and the interval time is too short, so that the flash controller can only process the diagnosis online messages and ignore the flash messages.
The present invention provides a method for FBL flash vehicle controller based on UDS diagnostic service to solve the above problems, which is generally described as follows, the diagnostic online messages are timed with a 3s cycle to leave enough time to handle the "collision" phenomenon (interference phenomenon) of the messages sent just at the same time as the diagnostic online messages. Entering a sending waiting state after the timing time of the diagnosis online message is reached; and circularly checking to see whether the flash message is being sent or not in the sending waiting state. If the flash message is not in sending, the diagnosis online message is sent out immediately; and if the flash message is in the sending process, the flash message still stays in a sending waiting state. After the online message is successfully transmitted, setting the delay identifier of the flash message, and simultaneously starting a delay transmission timer T2 of the flash message, wherein the delay time is 20 ms. And after the timer T2 is overtime, restarting the diagnosis online message timer T1.
Specifically, as shown in fig. 1, which is a flow chart of sending a flush message according to the present invention, the specific step of sending the flush message includes:
step A1, checking the forbidden identifier F2 of the flash message, judging whether F2 is set, if not, setting the sending identifier F1 of the flash message.
And step A2, sending a flash message.
And step A3, after the brushing message is successfully sent, clearing the sending identification F1 of the brushing message.
Optionally, in step a1, if yes, that is, if F2 is set, the disable flag of the flush message needs to be checked again, F2 is set, where F2 is set to indicate that the diagnostic online message is being sent or the diagnostic online message has been sent but the flush message is in the delayed sending period.
Optionally, the delay time of the flash message in the delayed sending period is 20 ms.
As shown in fig. 2, a diagnostic online message sending flowchart is shown, and the specific steps of sending the diagnostic online message include:
step B1: the diagnosis online message timer T1 is overtime, wherein the diagnosis online message is a timing cycle message, the sending identification of the flash message is checked, F1 is judged, whether F1 is set or not is judged, and if not, the step B2 is executed;
step B2: setting a forbidden identifier F2 of the flash message, and sending a diagnosis online message;
step B3: after the diagnosis online message is successfully generated, starting a delay sending timer T2 of the flash message;
step B4: the delayed sending timer T2 of the flash message is overtime, the forbidden identification F2 of the flash message is cleared, and the diagnosis online message timer T1 is reset.
Optionally, in step B1, if F1 is set, the sending identifier of the flush message is rechecked F1, where F1 is set to indicate that the flush message is being sent.
Optionally, in step B1, the diagnostic online message timer T1 has a timing duration of 3 s.
Optionally, in step B3, the delay duration of the delayed sending timer T2 of the flash message is 20 ms.
The invention has the advantages that: the time for sending the flash message and the time for sending the diagnosis online message are staggered from the perspective of sending the flash message or the perspective of sending the diagnosis online message, namely, the flash message and the diagnosis online message are sequenced, so that the flash controller can be effectively prevented from being interfered by the diagnosis online message in the flash process, and the flash success rate of the vehicle controller is improved.