CN109525363A - Data transmission method and device - Google Patents

Data transmission method and device Download PDF

Info

Publication number
CN109525363A
CN109525363A CN201811150944.1A CN201811150944A CN109525363A CN 109525363 A CN109525363 A CN 109525363A CN 201811150944 A CN201811150944 A CN 201811150944A CN 109525363 A CN109525363 A CN 109525363A
Authority
CN
China
Prior art keywords
data
transmission
message
type
bit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201811150944.1A
Other languages
Chinese (zh)
Other versions
CN109525363B (en
Inventor
刘均
郝书芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN201811150944.1A priority Critical patent/CN109525363B/en
Publication of CN109525363A publication Critical patent/CN109525363A/en
Application granted granted Critical
Publication of CN109525363B publication Critical patent/CN109525363B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0009Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the channel coding
    • H04L1/001Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the channel coding applied to control information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0061Error detection codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0078Avoidance of errors by organising the transmitted data in a format specifically designed to deal with errors, e.g. location
    • H04L1/0083Formatting with frames or packets; Protocol or part of protocol for error control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L2001/0092Error control systems characterised by the topology of the transmission link
    • H04L2001/0094Bus
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)
  • Quality & Reliability (AREA)

Abstract

This application discloses a kind of data transmission method and devices, applied to controller, the controller is established with mobile unit, automobile bus communicate to connect respectively, and the transmission for controlling data between mobile unit and automobile bus, comprising: obtains communication data transmitted by sender;The structure of recipient's received data corresponding to the communication data according to transmission process carries out the encoding and decoding processing of the communication data;To recipient's transmission coding/decoding treated data.The transmission of the data between automobile bus and mobile unit can be realized without the modification additional to progress such as programs in mobile unit, substantially increase the efficiency that data are transmitted.

Description

Data transmission method and device
Technical field
This application involves field of communication technology, in particular to a kind of data transmission method and device.
Background technique
Mobile unit in automobile, such as fuel control system, driving control system, fuel injection system etc. are working When the control of corresponding mobile unit is carried out according to transmitting message on automobile bus.Since mobile unit is handled during processing Data type be byte type data, and the message transmitted on automobile bus in addition to include mobile unit needed for valid data It outside, further include the message such as response message as defined in transport protocol and bus transfer domain, so mobile unit at work cannot Direct Recognition simultaneously handles the message on automobile bus.In the prior art, total in order to enable mobile unit to identify and handle automobile The message transmitted on line needs the communication protocol on the structure combination automobile bus according to mobile unit, on mobile unit Program modify, so that mobile unit be allow to identify and handle the message of corresponding communication protocol.And mobile unit due to The reasons such as optimization need to constantly update upgrading, in order to make mobile unit can handle message, need to the program in mobile unit Programming is re-started, so as to cause the detail programming for needing repeatedly to carry out mobile unit, on the one hand modifies mobile unit repeatedly In program lead to mobile unit reduced performance, on the other hand, be repeated mobile unit modification of program and debugging account for significantly The working time of mobile unit.
From the foregoing, it will be observed that realizing automobile bus how in the case where not carrying out additional modifications to mobile unit and vehicle-mounted setting There are also to be solved for the problem of data between standby are transmitted.
Summary of the invention
In order to solve the problems, such as present in the relevant technologies, this application provides a kind of data transmission method and devices.
The first aspect of the embodiment of the present application provides a kind of data transmission method, and the method is applied to controller, institute It states controller and establishes communication connection with mobile unit, automobile bus respectively, and for controlling between mobile unit and automobile bus The transmission of data, which comprises
Obtain communication data transmitted by sender;
The structure of recipient's received data corresponding to the communication data according to transmission process carries out the communication number According to encoding and decoding processing;
To recipient's transmission coding/decoding treated data.
With reference to first aspect, in the first possible realization, the communication data includes that the mobile unit is exported Byte type data, the byte type data that the communication data is exported by the mobile unit, the automobile bus received Data be specified protocol message, recipient's received data corresponding to the communication data according to transmission process Structure carries out the encoding and decoding processing of the communication data, comprising:
The decoding for carrying out the byte type data obtains the corresponding bit-type data of the byte type data;
The structure of automobile bus received packet according to transmission process generates the report comprising the bit-type data Text;
It is described to recipient's transmission coding/decoding treated data, comprising:
It include the message of the bit-type data to automobile bus transmission.
With reference to first aspect, described to include the bit-type to automobile bus transmission in second of possible realization Before the message of data, further includes:
Check code is generated according to the byte type data;
According to the structure of the message, the check code is added in the message.
With reference to first aspect, in the third possible realization, acquired communication data is stored in transmission data buffering In device, the structure of recipient's received data corresponding to the communication data according to transmission process carries out the communication Before data encoding and decoding processing, further includes:
According to the data length of the transmitted bit-type data of message described in each frame, extracted from the transmission data buffer Byte type data corresponding with the bit-type data of the data length.
With reference to first aspect, in the 4th kind of possible realization, the communication data includes that the automobile bus is exported Message, the structure of recipient's received data corresponding to the communication data according to transmission process carries out described logical The encoding and decoding of letter data are handled, comprising:
According to the structure of the message, the bit-type extracted in the message effectively transmits data;
Data are effectively transmitted to the bit-type be decoded processing and obtain the bit-type effectively transmit the corresponding byte of data Type transmits data;
It is described to recipient's transmission coding/decoding treated data, comprising:
The byte type obtained to processor transmission decoding transmits data.
With reference to first aspect, in the 5th kind of possible realization, the data of effectively transmitting to the bit-type are decoded Processing obtains the bit-type and effectively transmit before the corresponding byte type of data transmits data, further includes:
According to the structure of the message, the check code in the message is extracted;
The verification that the bit-type effectively transmits data is carried out according to the extracted check code;
If verifying the bit-type effectively transmits data transmission errors, the bit-type extracted in next frame message is effectively transmitted Data;It sends accurate if verifying the bit-type and effectively transmitting data, carries out effectively transmitting the bit-type data solving Code processing obtains the bit-type and effectively transmits the step of corresponding byte type of data transmits data.
With reference to first aspect, in the 6th kind of possible realization, the method also includes:
Condition monitoring is carried out to the transmission on the automobile bus;
If monitoring automobile bus is in transmission busy state, the speed that message is obtained from the automobile bus is adjusted Rate, or the rate to the automobile bus transmitting message.
The second aspect of the embodiment of the present application provides a kind of data transmission device, is applied to controller, the controller point It does not establish and communicates to connect with mobile unit, automobile bus, and the transmission for controlling data between mobile unit and automobile bus, Described device includes:
Module is obtained, for obtaining transmitted communication data;
Processing module, for the structure of recipient's received data corresponding to the communication data according to transmission process, Carry out the encoding and decoding processing of the communication data;
Transmission module, for recipient's transmission coding/decoding treated data.
In a kind of possible realization, communication data includes the byte type data that mobile unit is exported, automobile bus institute Received data are the message of specified protocol, and processing module includes:
Decoding unit obtains the corresponding bit-type data of byte type data for carrying out the decoding of byte type data.
Message generation unit, for the structure according to automobile bus received packet in transmission process, generating includes bit-type The message of data.
Transmission module, comprising:
Message transmissions unit, for including the message of bit-type data to automobile bus transmission.
In a kind of possible realization, data transmission device further include:
Check code generation unit, for generating check code according to byte type data.
Check code is added in message by check code adding unit for the structure according to message.
In a kind of possible realization, obtains communication data acquired in module and be stored in transmission data buffer, number According to transmitting device further include:
Extraction module is used for before processing module executes corresponding actions, according to the transmitted bit-type data of each frame message Data length, corresponding with the bit-type data of data length byte type data are extracted in data buffer from sending.
In a kind of possible realization, communication data includes the message that automobile bus is exported, and processing module includes:
Extraction unit, for the structure according to message, the bit-type extracted in message effectively transmits data.
Decoding unit effectively transmits data for paratype and is decoded processing obtaining bit-type effectively to transmit data corresponding Byte type transmits data.
Transmission module, comprising:
Byte type transmits data transmission unit, and the byte type for obtaining to processor transmission decoding transmits data.
In a kind of possible realization, data transmission device further include such as lower unit, it is corresponding for being executed in decoding unit Respective operations are executed before operation, in which:
Check code extraction unit extracts the check code in message for the structure according to message.
Verification unit, for carrying out the verification that bit-type effectively transmits data according to extracted check code.
First processing units are extracted next if effectively transmitting data transmission errors for verification unit verification bit-type Bit-type in frame message effectively transmits data;And
The second processing unit sends accurately if effectively transmitting data for verification unit verification bit-type, is aligned Type, which effectively transmits data and is decoded processing and obtains bit-type, effectively transmits data corresponding byte type transmission data.
In a kind of possible realization, data transmission device further include:
Monitoring module, for carrying out condition monitoring to the transmission on automobile bus.
Rate adjustment module is adjusted from automobile bus if being in transmission busy state for monitoring automobile bus Obtain the rate of message, or the rate to automobile bus transmitting message.
A kind of data transmission device, is applied to controller, and the controller is established with mobile unit, automobile bus logical respectively Letter connection, and the transmission for controlling data between mobile unit and automobile bus, described device include:
Processor;And
Memory is stored with computer-readable instruction on the memory, and the computer-readable instruction is by the processing As above described in any item data transmission methods are realized when device executes.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor As above described in any item data transmission methods are realized when row.
The technical solution that embodiments herein provides can include the following benefits:
It is by carrying out encoding and decoding processing to the communication data transmitted between mobile unit and automobile bus, i.e., automobile is total The message of line output is decoded as the accessible byte type transmission data of mobile unit, and the byte type data of mobile unit output are compiled Code is bit-type data, and generates the message required by meeting communication protocol on automobile bus according to bit-type data.To vehicle-mounted to set The standby byte type transmission data for decoding and obtaining that can directly receive are handled, and automobile bus can directly receive report generated Text does not need to carry out additional modification to mobile unit, realizes the data transmission between mobile unit and automobile bus, significantly Improve the efficiency of data transmission.
It should be understood that the above general description and the following detailed description are merely exemplary, this can not be limited Application.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows and meets implementation of the invention Example, and in specification together principle for explaining the present invention.
Fig. 1 is the schematic diagram of the implementation environment according to involved in the application;
Fig. 2 is a kind of block diagram of controller shown according to an exemplary embodiment;
Fig. 3 is a kind of flow chart of data transmission method shown according to an exemplary embodiment;
Fig. 4 is a kind of flow chart of the data transmission method shown according to another exemplary embodiment;
Fig. 5 be Fig. 4 corresponding embodiment step S250 before step flow chart;
Fig. 6 is a kind of flow chart of the data transmission method shown according to another exemplary embodiment;
Fig. 7 be Fig. 6 corresponding embodiment step S332 before step flow chart;
Fig. 8 is the flow chart of the data transmission method shown according to another exemplary embodiment;
Fig. 9 is the block diagram of data transmission device shown according to an exemplary embodiment;
Figure 10 is the bus message structural schematic diagram of J1850 agreement;
Figure 11 is the block diagram of the data transmission device shown according to another exemplary embodiment;
Figure 12 is the state switching figure of finite state machine shown according to an exemplary embodiment.
Specific embodiment
Here will the description is performed on the exemplary embodiment in detail, the example is illustrated in the accompanying drawings.Following description is related to When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment Described in embodiment do not represent all embodiments consistented with the present invention.On the contrary, they be only with it is such as appended The example of device and method being described in detail in claims, some aspects of the invention are consistent.
Fig. 1 is the schematic diagram of the implementation environment according to involved in the application.The application is suitable for car terminals, and the automobile is whole It include: sender 100, recipient 300 and the controller for carrying out control sender and receiving side data transmission control in end 200.Wherein in the technical solution of the application, for the difference of data transfer direction, sender to recipient is also corresponding adjusts. When transmitting communication data to automobile bus for mobile unit, then sender 100 is mobile unit, and recipient 300 is vapour Vehicle bus;When transmitting data to mobile unit for automobile bus, sender 100 is automobile bus, and recipient 300 is vehicle Carry equipment.For the data transmission between automobile bus and mobile unit, mobile unit can be one or more, herein not Specifically limited.
In a particular embodiment, sender and controller and controller are communicated with recipient by data-interface; In other embodiments, the communication that both sides can also be carried out by wireless communication module thereon, herein without specifically limiting.
Fig. 2 is a kind of block diagram of controller 200 shown according to an exemplary embodiment.Controller 200 can be used for Fig. 1 The Data Transmission Controlling between sender and recipient is carried out in implementation environment.Controller 200 can be independent chip or Single-chip microcontroller etc. has the electronic equipment of data-handling capacity.It should be noted that the controller 200, which is one, adapts to this hair Bright example must not believe that there is provided any restrictions to use scope of the invention.The controller 200 can not be construed to It needs to rely on or must have one or more component in illustrative controller 200 shown in Figure 2.
The hardware configuration of the controller 200 can generate biggish difference due to the difference of configuration or performance, such as Fig. 3 institute Show, controller 200 includes: power supply 210, interface 230, at least a memory 250 and at least processor (CPU, a Central Processing Units)270。
Wherein, power supply 210 is used to provide operating voltage for each hardware device on controller 200.
Interface 230 includes an at least wired or wireless network interface 231, at least a string and translation interface 233, at least one defeated Enter output interface 235 and at least USB interface 237 etc., be used for and external device communication, such as carries out data biography with processor It is defeated, carry out data transmission with automobile bus.
The carrier that memory 250 is stored as resource, can be read-only memory, random access memory, disk or CD Deng the resource stored thereon includes operating system 251, program 253 or data 255 etc., and storage mode can be of short duration deposit It stores up or permanently stores.Wherein, operating system 251 is used to managing and controlling each hardware device and the program on controller 200 253, to realize calculating and processing of the processor 270 to mass data 255, it can be Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, FreeRTOS etc..Program 253 is to be based on completing at least on operating system 251 The computer program of one particular job, may include an at least module (being not shown in Fig. 2), and each module can be distinguished It include the series of computation machine readable instruction to controller 200.Data 255 can be stored in the picture etc. in disk.
Processor 270 may include the processor of one or more or more, and be set as logical by bus and memory 250 Letter, for the mass data 255 in operation and processing memory 250.
As described in detail above, memory 250 will be read by processor 270 by being applicable in controller 200 of the invention The form of the series of computation machine readable instruction of middle storage completes data transmission method.
In addition, also can equally realize the present invention by hardware circuit or hardware circuit combination software instruction, therefore, realize The present invention is not limited to the combinations of any specific hardware circuit, software and the two.
Fig. 3 is a kind of flow chart of data transmission method shown according to an exemplary embodiment, is applied to controller, institute It states controller and establishes communication connection with mobile unit, automobile bus respectively, and for controlling between mobile unit and automobile bus The transmission of data.As shown in figure 3, the data transmission method, can be executed by the controller 200 in Fig. 1 implementation environment, be can wrap Include following steps:
Step S110 obtains communication data transmitted by sender.
Step S130, the structure of recipient's received data, is communicated according to corresponding to communication data in transmission process Data encoding and decoding processing.
Step S150, to recipient's transmission coding/decoding treated data.
It is cooperated in car terminals by subsystems and realizes the normal work of automobile, wherein subsystems are vapour Mobile unit in vehicle, mobile unit can be fuel control system, driving control system, fuel injection system, anti-lock system The subsystems such as dynamic system (ABS), antiskid control system (ASR), gas recirculation system, herein without specifically limiting.
For the difference of data transfer direction, sender corresponding to communication data and recipient be not also identical.In this Shen In technical solution please, the data carried out if it is mobile unit to automobile bus are transmitted, then corresponding, and mobile unit is communication The sender of data, automobile bus are the recipient of communication data;The data carried out if it is automobile bus to mobile unit pass Defeated, then corresponding, automobile bus is the sender of communication data, and mobile unit is the recipient of communication data.
For different recipients, recipient is limited to communication protocol or hardware condition, to the knot of received data Structure has corresponding require.Mobile unit received data or the data exported from mobile unit are byte type data, and Automobile bus received data or the data sent from automobile bus are the report for meeting communication protocol on automobile bus Text, such as the message of J1850 agreement.
Encoding and decoding processing is carried out by the communication data transmitted to sender and recipient, by what is transmitted from sender Communication data is converted into the data of the receivable data structure of recipient (as encoding and decoding processing) form, i.e., automobile bus is defeated Message out is decoded as the byte type transmission data that mobile unit can be handled directly, and the byte type data of mobile unit output are compiled Code is bit-type data, and generates the message required by meeting communication protocol on automobile bus according to bit-type data.To vehicle-mounted to set Standby can directly receive decodes obtained byte type transmission data and is handled, and automobile bus can directly receive generated Message does not need to carry out additional modification to mobile unit, realizes the data transmission between processor and automobile bus, significantly Improve the efficiency of data transmission.
It can receive the difference of the data structure of data for recipient, at the encoding and decoding that controller carries out communication data It manages also not identical.Below for recipient be mobile unit and recipient is the data transmission that automobile bus carries out the application respectively Method is discussed in detail.
One, communication data is transmitted from mobile unit to automobile bus:
In one exemplary embodiment, as shown in figure 4, communication data includes the byte type data that mobile unit is exported, Automobile bus received data is the message of specified protocol, then in step s 110, acquired communication data is to obtain The byte type data for taking mobile unit to be exported.
In the present embodiment, step S130 includes:
Step S231 carries out the decoding of byte type data, obtains the corresponding bit-type data of byte type data.
Step S232 generates the report comprising bit-type data according to the structure of automobile bus received packet in transmission process Text.
Different according to the communication protocol used in automobile bus, message structure is also different, and Figure 10 is shown to be assisted based on J1850 The structural schematic diagram of the message of view, in the schematic diagram, the data transmitted in message are located in data field, thus, it is decoding After obtaining bit-type data, bit-type data are added in the data field of message.Utilizing message by bit-type by automobile bus Data pass to after another party, and another party extracts the number in the data field of message according to the message structure of J1850 agreement defined According to.
In the present embodiment, step S150 includes: step S250, includes the message of bit-type data to automobile bus transmission.
In one exemplary embodiment, step S250 further comprises:
The message that opposite automobile bus is transmitted carries out transmitting, monitoring.
If monitoring message transmissions mistake, stop the transmission of the message, lays equal stress on and newly transmit the message.
The message that wherein message transmissions mistake can be a certain position in message, which is sent in mistake, such as Figure 10, to be normalized The information of response field sends mistake in position, frame, herein without specifically limiting.
In a particular embodiment, come in conjunction with the message tranmitting data register signal that protocol finite state machine and clock transmitter generate Carry out transmitting, monitoring.The message of protocol finite state machine corresponding position in messages is sent completely, the shape of protocol finite state machine State changes, so that the message that message tranmitting data register sends the message next bit in message is controlled, if protocol finite state The change of state corresponding to machine and message transmitted by message tranmitting data register is not corresponding, then is considered as the message transmissions mistake.For It detects message transmissions mistake, then stops the transmission of the message immediately, and restart to transmit the message.
Transmitting, monitoring is carried out by the transmission process to message, to ensure that the side for receiving message can accurately receive To message.
In one exemplary embodiment, as shown in figure 5, before step S250, further includes:
Step S241 generates check code according to byte type data.
Check code is added in message by step S242 according to the structure of message.
Check code is used to extract a side of bit-type data in message after extracting bit-type data, is judged according to check code Whether extracted bit-type data are consistent with the byte type data of transmission, are just carried out according to extracted bit-type data if be consistent It is further processed, to guarantee the accuracy and validity of data transmission.
In a particular embodiment, different according to the algorithm of check code, check code is also corresponding different, the wherein calculation of check code Method can be code distance, even-odd check, Hamming check, cyclic redundancy check etc., herein without specifically limiting.In J1850 agreement In by Cyclic Redundancy Algorithms cyclic redundancy check code (Cyclic Redundancy Check, CRC) is calculated for carrying out The verification of bit-type data.
Based on different communication protocol, the position of check code in messages is not also identical.J1850 agreement as shown in Figure 10 Message structure, check bit is located at the adjacent bit of data field, then the cyclic redundancy check of generation is added to corresponding position in message It sets.To also send the check code for being added to the message simultaneously while sending to automobile bus comprising bit-type data message.
In one exemplary embodiment, acquired communication data (the byte type data byte exported in mobile unit Type) it is stored in transmission data buffer, before executing step S231 and step S232, further includes:
According to the data length of the transmitted bit-type data of each frame message, from sending, extraction in data buffer is long with data The corresponding byte type data of the bit-type data of degree.
In automobile bus, message is sent by frame, and the data length for the bit-type data transmitted in each frame message is by reporting The data field of text determines.It is temporary by sending the acquired communication data, that is, byte type data of data buffer progress, thus, root According to the length of the transmitted bit-type data of each frame message, from the byte type number for sending extraction corresponding data length in data buffer According to.It is therefore not required to which mobile unit and controller carry out real-time information exchange, and disposably multibyte data can be put into It sends in data buffer, is unsatisfactory for one when sending data buffer sky or sending the byte type data in data buffer When the data length that frame message is sent, then to sending acquired byte type data are stored in data buffer.It reduces vehicle-mounted The time overhead and administrative burden of equipment, improve the data-handling efficiency of mobile unit.
Two, communication data is transmitted from automobile bus to mobile unit
In this process, the message that communication data is exported by automobile bus, i.e. sender are automobile bus, and recipient is Mobile unit, in the present embodiment, as shown in fig. 6, step S110 is step S310: obtaining the report that automobile bus is exported Text, Fig. 1 correspond to step S130 and include:
Step S331, according to the structure of message, the bit-type extracted in message effectively transmits data.
Bit-type effectively transmits the data in the data field that data are the message being mentioned above.
Step S332, paratype, which effectively transmits data and is decoded processing and obtains bit-type, effectively transmits the corresponding byte of data Type transmits data.
Correspondingly, the step S150 in Fig. 1 is step S350: the byte type transmission obtained to mobile unit transmission decoding Data.
In one exemplary embodiment, step S350 includes:
The byte type transmission data that decoding obtains are filtered.
And filtered byte type data are stored in and are received in data buffer.
The length that can receive data according to mobile unit is corresponding from reception data buffer to extract filtered corresponding number Mobile unit is transmitted to according to the byte type transmission data of length.
The length that the wherein length of the receivable data of mobile unit, i.e. mobile unit can receive data each time, wherein should Length is substantially limited to the arithmetic speed of mobile unit, and the external interface of mobile unit is limited to from physical hardware.It is logical It crosses setting and receives data buffer, without carrying out real-time information exchange between mobile unit and controller, reduce The time overhead and administrative burden of mobile unit.
In one exemplary embodiment, as shown in fig. 7, before step S332, further includes:
Step S321 extracts the check code in message according to the structure of message.
Position i.e. according to check code in messages, extracts check code from corresponding position.
In a particular embodiment, the clock signal generated by protocol finite state machine combination clock transmitter, according to suitable Sequence extracts the various information in message, wherein when carrying out the extraction of each information of message, when one of message information When after the completion of extraction, protocol finite state machine changes, and carries out phase in message according to the clock signal that clock generator generates The extraction of ortho position information, after information extraction completion, the state of protocol finite state machine changes again.Wherein mentioned Bit-type in the information taken such as message effectively transmits data, check code etc..
It ensure that the standard of various information in message by the clock signal that protocol finite state machine and clock generator generate It really extracts, improves the accuracy of information extraction.
Step S322 carries out the verification that bit-type effectively transmits data according to extracted check code.
The verification of bit-type valid data is wherein carried out by generating the corresponding algorithm of check code.Such as mentioned above pass through Cyclic redundancy check algorithm generates cyclic redundancy check code, then when verification, according to corresponding cyclic redundancy check algorithm Data are effectively transmitted in conjunction with extracted check code and bit-type carries out the verification that bit-type effectively transmits data.
If verification bit-type effectively transmits data transmission errors, S323 is thened follow the steps, extracts the position in next frame message Type effectively transmits data.
When the bit-type for obtaining in message for verification effectively transmits data transmission errors, then the bit-type is not transmitted effectively Data carry out further decoding process, but neglect the bit-type in the frame message and effectively transmit data, extract next frame report Bit-type in text effectively transmits data.
If verification bit-type is effectively transmitted data and sent accurately, S332 is thened follow the steps.
In one exemplary embodiment, as shown in fig. 7, to automobile bus send message or receive automobile bus it is defeated Before message out, further includes:
Step S010 carries out condition monitoring to the transmission on automobile bus.
Step S020, if monitoring automobile bus is in transmission busy state, adjustment obtains message from automobile bus Rate, or the rate to automobile bus transmitting message.
Wherein the transmission busy state in automobile bus can be determined by transmission channel idle in automobile bus, such as Quantity without free transfer channel or free transfer channel in automobile bus is less than setting value, then it is assumed that automobile bus, which is in, to be passed Defeated busy state.
Before to automobile bus transmission comprising the message of bit-type data, if it is numerous in transmitting to monitor automobile bus Busy condition, then reduce send message rate, such as delay message transmission or increase consecutive frame message send interval when Between.
For before obtaining message in automobile bus, busy state is transmitted if monitoring automobile bus and being in, plus The fast rate for obtaining message.
Data or acquisition/transmission message rate are sent by adjusting according to the transmission state of automobile bus, so as to Lead to message transmissions mistake etc. to avoid the crowded of message transmissions on automobile bus.
Following is the application Installation practice, can be used for executing the data transmission of the execution of the application above controller 200 Embodiment of the method.For undisclosed details in the application Installation practice, the application data transmission method embodiment is please referred to.
Now in conjunction with data transmission device and protocol finite machine as shown in figure 12 as shown in figure 11 state diagram to this Shen Data transmission method please is further described, which can be applied in controller 200, for execute with All or part of step in upper data transmission method.
In this embodiment, message transmissions are carried out according to J1850 agreement on automobile bus, wherein the message of J1850 agreement Structure is as shown in Figure 10:
Wherein, the message structure of J1850 agreement includes:
Bus free domain (Idle Bus), frame start domain (Start of Frame, SOF), data field (Data bytes, Wherein the data length of data field transmission is 8bits), detects byte field (also known as cyclic redundancy error detection byte field, CRC Error Detection Byte), end of data domain (End of Data), normalization position (Normalization Bit (10.4Kbps only), NB), response field (In-Frame Response) in frame, frame end domain (End of Frame, EOF), Frame period domain (Inter-Frame Separation, IFS), bus free domain (Idle Bus (occurs before SOF and after IFS))
As shown in figure 11, the structure packet of data interaction is carried out in the data transmission device with mobile unit and automobile bus It includes: including SPI interface, for being communicated with mobile unit.Transmitter, it is defeated according to mobile unit for being transmitted to automobile bus Byte type data out carry out the message that coded treatment obtains, and receiver is used to obtain the message of automobile bus output.Now distinguish Communication data and automobile bus is transmitted to automobile bus for mobile unit to carry out to the process of mobile unit transmission communication data The working principle of each section in data transmission device is discussed respectively.
Mobile unit transmits communication data to automobile bus:
The byte type data of mobile unit output enter transmission data buffer through the SPI interface of data transmission device, report Literary queue controller is controlled according to the data length of the transmitted bit-type data of each frame message sends the transmission of byte sequence generator The byte type data of corresponding data length, such as the data of 8bits, wherein 1byte=are transmitted in each frame mentioned above 8bits, then the byte type data that message queue controller control transmission byte sequence generator extracts 1 byte every time are transmitted to down One units/modules.Each extracted byte type generates cyclic redundancy check by CRC check (i.e. CRC<7:0>), and will be generated Cyclic redundancy check is placed in temporary receiver, is later transmitted cyclic redundancy check by protocol finite state machine and bit timing logic Into TX shift register.It is bit-type by each extracted byte type data encoding under the control of protocol finite state machine After data, it is placed in TX shift register.Finally, bit timing logic combine protocol finite state machine output signal and Clock transmitter tranmitting data register signal generated, control TX shift register include according to message structure shown in Fig. 10 generation The message of bit-type data and cyclic redundancy check, and pass through transmitter for message transmissions to automobile bus.In Figure 11, send<7:0> As from the byte type data for sending the 8bits that byte sequence generator exports, similarly receiving<7:0>is from RX shift register The byte type data of the 8bits of middle output.
TX shift register generate message and by transmitter message transmissions are total to automobile during, protocol finite State machine carries out condition monitoring for the transmission of each message in message, and carries out corresponding state for the transmission of each message Change.If Figure 12 shows, in this process, when starting transmitting message, protocol finite state machine becomes S1 state, thus according to hair When clock signal being sent to start to transmit bit-type data, protocol finite state machine becomes S2 state (sending data);The transmission of bit-type data After, and then cyclic redundancy check is transmitted, agreement limit state machine becomes S3 state at this time, transmits later according to message each in message Sequence, protocol finite state machine sequentially changes between the states such as S4, S5, S6.With the process for sending message to automobile bus Similar, when receiving the message that receiver is transmitted from automobile bus, during extracting each information in message, agreement has The state of limit state machine also carries out change mutually corresponding with message transmission process, hereafter repeats no more.
Further, before transmitting message generated to automobile bus, by bit timing logic on automobile bus Transmission state be monitored, if monitor automobile bus be in transmission busy state, pass through configuration register and clock The rate that transmitter adjustment message is transmitted to automobile bus.When obtaining the message that automobile bus is transmitted from automobile bus, Bit timing logic also has corresponding transmission state to monitor, and hereafter repeats no more.
During wherein automobile bus transmits communication data to mobile unit:
Receiver receive automobile bus output message after, bit timing logic combine protocol finite state machine and Clock signal caused by clock transmitter extracts each information in message, wherein extracted information includes in message Bit-type effectively transmits data and cyclic redundancy check.Later, under the control of protocol finite state machine, according to extracted bit-type Effectively transmission data and cyclic redundancy check verify whether the effective Insertion Loss data of the bit-type send mistake, if sent accurately, align Type effectively transmits data and is decoded, and obtains the bit-type and effectively transmits the corresponding byte type transmission data of data.And it will decode To byte type transmission data be placed in receiving filter, and by filtering setting register pair be located in receiving filter Byte type transmission data are filtered, and the byte type transmission data after filtering are placed on and are received in data buffer, thus The byte type received in data buffer is transmitted into data by the SPI interface of data transmission device and is transmitted to mobile unit progress Processing.
In one embodiment, which passes through on-site programmable gate array FPGA and hardware description language VHDL is realized, has the function of parallel processing, so as to guarantee that data transmission device is counted in automobile bus and mobile unit The encoding and decoding processing of high speed is carried out during according to transmission.It is communicated, and vehicle-mounted is set with mobile unit by SPI interface simultaneously The update of the standby hardware and software for needing to carry out mobile unit due to optimization and upgrading during use, and pass through mark The SPI interface of note is connect with mobile unit to be communicated, and the update of mobile unit does not interfere with transmission control unit Hardware and software, so that data transmission device is versatile.
Fig. 9 is a kind of block diagram of data transmission device shown according to an exemplary embodiment, which can To execute all or part of step in above data transmission method embodiment in the controller for implementation environment shown in Fig. 1 Suddenly.The device is used to be applied to controller, and the controller is established with mobile unit, automobile bus communicate to connect respectively, and uses The transmission of data between control mobile unit and automobile bus.In one embodiment, data transmission device is set with vehicle-mounted It is standby that communication connection, such as SPI interface are established by interface.As shown in figure 9, the device data transmission device includes but unlimited In: obtain module 110, processing module 130 and transmission module 150, in which:
Module 110 is obtained, mobile unit obtains transmitted communication data mobile unit.
Processing module 130, which is connected with module 110 is obtained, for according to corresponding to communication data in transmission process The structure of recipient's received data carries out communication data encoding and decoding processing.
Transmission module 150, the module are connected with processing module 130, for recipient's transmission coding/decoding treated number According to.
In one exemplary embodiment, communication data includes the byte type data that mobile unit is exported, automobile bus institute Received data are the message of specified protocol, and processing module 130 includes:
Decoding unit obtains the corresponding bit-type data of byte type data for carrying out the decoding of byte type data.
Message generation unit, for the structure according to automobile bus received packet in transmission process, generating includes bit-type The message of data.
Transmission module 150, comprising:
Message transmissions unit, for including the message of bit-type data to automobile bus transmission.
The function of modules and the realization process of effect are specifically detailed in Fig. 4 and above-mentioned transmission side data in above-mentioned apparatus The realization process of step is corresponded in method, details are not described herein.
In one exemplary embodiment, data transmission device further include:
Check code generation unit, for generating check code according to byte type data.
Check code is added in message by check code adding unit for the structure according to message.
In an exemplary implementation, obtains communication data acquired in module 110 and be stored in transmission data buffer, number According to transmitting device further include:
Extraction module is used for before processing module executes corresponding actions, according to the transmitted bit-type data of each frame message Data length, corresponding with the bit-type data of data length byte type data are extracted in data buffer from sending.
In one exemplary embodiment, communication data includes the message that automobile bus is exported, processing module 130, comprising:
Extraction unit, for the structure according to message, the bit-type extracted in message effectively transmits data.
Decoding unit effectively transmits data for paratype and is decoded processing obtaining bit-type effectively to transmit data corresponding Byte type transmits data.
Transmission module 150, comprising:
Byte type transmits data transmission unit, and the byte type for obtaining to mobile unit transmission decoding transmits data.
In one exemplary embodiment, data transmission device further include such as lower unit, it is corresponding for being executed in decoding unit Respective operations are executed before operation, in which:
Check code extraction unit extracts the check code in message for the structure according to message.
Verification unit, for carrying out the verification that bit-type effectively transmits data according to extracted check code.
First processing units are extracted next if effectively transmitting data transmission errors for verification unit verification bit-type Bit-type in frame message effectively transmits data;And
The second processing unit sends accurately if effectively transmitting data for verification unit verification bit-type, is aligned Type, which effectively transmits data and is decoded processing and obtains bit-type, effectively transmits data corresponding byte type transmission data.
In one exemplary embodiment, data transmission device further include:
Monitoring module, for carrying out condition monitoring to the transmission on automobile bus.
Rate adjustment module is adjusted from automobile bus if being in transmission busy state for monitoring automobile bus Obtain the rate of message, or the rate to automobile bus transmitting message.
Modules/unit function and the realization process of effect are specifically detailed in above-mentioned data transmission method in above-mentioned apparatus The realization process of middle corresponding step, details are not described herein.
It is appreciated that these modules can by hardware, software, or a combination of both realize.When realizing in hardware When, these modules may be embodied as one or more hardware modules, such as one or more specific integrated circuits.When with software side When formula is realized, these modules may be embodied as the one or more computer programs executed on the one or more processors, example The program being stored in as performed by the processor 270 of Fig. 2 in memory 253.
Optionally, the application also provides a kind of data transmission device, be applied to controller, the controller respectively with it is vehicle-mounted Equipment, automobile bus establish communication connection, and the transmission for controlling data between mobile unit and automobile bus, which passes Defeated device can be used in the controller 200 of implementation environment shown in Fig. 1, execute any institute in above data transmission method embodiment The all or part of step of the data transmission method shown.Device includes:
Processor;And
Memory is stored with computer-readable instruction on memory, realization when computer-readable instruction is executed by processor The method of any one of data transmission method implementation as above.
The processor of device in the embodiment executes the concrete mode of operation in the related data transmission method Detailed description is performed in embodiment, no detailed explanation will be given here.
In the exemplary embodiment, a kind of computer readable storage medium is additionally provided, computer program is stored thereon with, The method of any one of above data transmission method embodiment is realized when computer program is executed by processor.This is computer-readable Memory 250 of the storage medium for example including program, above procedure can be executed by the processor 270 of controller 200 on to complete State data transmission method.
It should be understood that the present invention is not limited to the precise structure already described above and shown in the accompanying drawings, and And various modifications and change can executed without departing from the scope.The scope of the present invention is limited only by the attached claims.

Claims (10)

1. a kind of data transmission method, which is characterized in that the method is applied to controller, and the controller is set with vehicle-mounted respectively Standby, automobile bus establishes communication connection, and the transmission for controlling data between mobile unit and automobile bus, the method packet It includes:
Obtain communication data transmitted by sender;
The structure of recipient's received data corresponding to the communication data according to transmission process, carries out the communication data Encoding and decoding processing;
To recipient's transmission coding/decoding treated data.
2. the method according to claim 1, wherein the communication data includes that the mobile unit is exported Byte type data, the structure of recipient's received data corresponding to the communication data according to transmission process carry out institute State the encoding and decoding processing of communication data, comprising:
The decoding for carrying out the byte type data obtains the corresponding bit-type data of the byte type data;
The structure of automobile bus received packet according to transmission process generates the message comprising the bit-type data;
It is described to recipient's transmission coding/decoding treated data, comprising:
It include the message of the bit-type data to automobile bus transmission.
3. according to the method described in claim 2, it is characterized in that, described include the bit-type number to automobile bus transmission According to the message before, further includes:
Check code is generated according to the byte type data;
According to the structure of the message, the check code is added in the message.
4. according to the method described in claim 2, it is characterized in that, acquired communication data is stored in transmission data buffer In, the structure of recipient's received data corresponding to the communication data according to transmission process carries out the communication number Before being handled according to encoding and decoding, further includes:
According to the data length of the transmitted bit-type data of message described in each frame, extraction and institute from the transmission data buffer State the corresponding byte type data of bit-type data of data length.
5. the method according to claim 1, wherein the communication data includes that the automobile bus is exported Message, the structure of recipient's received data corresponding to the communication data according to transmission process, carries out the communication The encoding and decoding of data are handled, comprising:
According to the structure of the message, the bit-type extracted in the message effectively transmits data;
Data are effectively transmitted to the bit-type be decoded processing obtain the bit-type and effectively transmit the corresponding byte type of data passing Transmission of data;
It is described to recipient's transmission coding/decoding treated data, comprising:
The byte type obtained to processor transmission decoding transmits data.
6. according to the method described in claim 5, it is characterized in that, the data of effectively transmitting to the bit-type are decoded place Reason obtains the bit-type and effectively transmit before the corresponding byte type of data transmits data, further includes:
According to the structure of the message, the check code in the message is extracted;
The verification that the bit-type effectively transmits data is carried out according to the extracted check code;
If verifying the bit-type effectively transmits data transmission errors, the bit-type extracted in next frame message effectively transmits number According to;It sends accurate if verifying the bit-type and effectively transmitting data, carries out effectively transmitting the bit-type data being decoded Processing obtains the bit-type and effectively transmits the step of corresponding byte type of data transmits data.
7. the method according to claim 1, wherein the method also includes:
Condition monitoring is carried out to the transmission on the automobile bus;
If monitoring automobile bus is in transmission busy state, the rate that message is obtained from the automobile bus is adjusted, or To the rate of the automobile bus transmitting message.
8. a kind of data transmission device, which is characterized in that described device is applied to controller, and the controller is set with vehicle-mounted respectively Standby, automobile bus establishes communication connection, and the transmission for controlling data between the mobile unit and automobile bus, the dress It sets and includes:
Module is obtained, for obtaining transmitted communication data;
Processing module is carried out for the structure of recipient's received data corresponding to the communication data according to transmission process The communication data encoding and decoding processing;
Transmission module, for recipient's transmission coding/decoding treated data.
9. a kind of data transmission device, which is characterized in that described device is applied to controller, and the controller is set with vehicle-mounted respectively Standby, automobile bus establishes communication connection, and the transmission for controlling data between mobile unit and automobile bus, described device packet It includes:
Processor;And
Memory is stored with computer-readable instruction on the memory, and the computer-readable instruction is held by the processor The method as described in any one of claims 1 to 7 is realized when row.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The method as described in any one of claims 1 to 7 is realized when being executed by processor.
CN201811150944.1A 2018-09-29 2018-09-29 Data transmission method and device Active CN109525363B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811150944.1A CN109525363B (en) 2018-09-29 2018-09-29 Data transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811150944.1A CN109525363B (en) 2018-09-29 2018-09-29 Data transmission method and device

Publications (2)

Publication Number Publication Date
CN109525363A true CN109525363A (en) 2019-03-26
CN109525363B CN109525363B (en) 2021-07-06

Family

ID=65771631

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811150944.1A Active CN109525363B (en) 2018-09-29 2018-09-29 Data transmission method and device

Country Status (1)

Country Link
CN (1) CN109525363B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1848790A (en) * 2005-04-14 2006-10-18 上海德科电子仪表有限公司 Vehicle instruments internal data transmitting method based on CAN technology
US20080082544A1 (en) * 2006-09-29 2008-04-03 Dunstan Robert A Method and system to validate a write for a device on a serial bus
CN101895549A (en) * 2010-07-21 2010-11-24 中国北车股份有限公司大连电力牵引研发中心 Conversion gateway and conversion method of vehicle communication network data
CN102955474A (en) * 2011-08-26 2013-03-06 中国航空工业集团公司第六三一研究所 Measurement control method and system of automobile ECU (electronic control unit)
CN104460429A (en) * 2014-11-04 2015-03-25 盛瑞传动股份有限公司 CAN signal analyzing method and device
CN104579885A (en) * 2015-02-05 2015-04-29 青岛四方车辆研究所有限公司 Protocol converter and conversion method of CPCI bus and ISA bus
CN104834276A (en) * 2014-12-19 2015-08-12 北汽福田汽车股份有限公司 Automobile CAN bus network, slave node thereof, and automobile
CN105446910A (en) * 2015-11-24 2016-03-30 东软集团股份有限公司 Data transmission methods and apparatus

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1848790A (en) * 2005-04-14 2006-10-18 上海德科电子仪表有限公司 Vehicle instruments internal data transmitting method based on CAN technology
US20080082544A1 (en) * 2006-09-29 2008-04-03 Dunstan Robert A Method and system to validate a write for a device on a serial bus
CN101895549A (en) * 2010-07-21 2010-11-24 中国北车股份有限公司大连电力牵引研发中心 Conversion gateway and conversion method of vehicle communication network data
CN102955474A (en) * 2011-08-26 2013-03-06 中国航空工业集团公司第六三一研究所 Measurement control method and system of automobile ECU (electronic control unit)
CN104460429A (en) * 2014-11-04 2015-03-25 盛瑞传动股份有限公司 CAN signal analyzing method and device
CN104834276A (en) * 2014-12-19 2015-08-12 北汽福田汽车股份有限公司 Automobile CAN bus network, slave node thereof, and automobile
CN104579885A (en) * 2015-02-05 2015-04-29 青岛四方车辆研究所有限公司 Protocol converter and conversion method of CPCI bus and ISA bus
CN105446910A (en) * 2015-11-24 2016-03-30 东软集团股份有限公司 Data transmission methods and apparatus

Also Published As

Publication number Publication date
CN109525363B (en) 2021-07-06

Similar Documents

Publication Publication Date Title
CN102780705B (en) Ethernet-(controller area network) CAN protocol converter
CN109347598A (en) Check code processing method, electronic equipment and storage connect medium
CN103716137A (en) Method and system for identifying reasons of ZigBee sensor network packet loss
CN106162528B (en) LoRa signal and Bluetooth signal conversion module, conversion method and sender unit
CN102651229B (en) Semiconductor device and data processing method
CN103684678A (en) Baud rate adaptive method for UART, device and UART
CN105187227A (en) Device utilizing RMAP protocol to realize plug-and-play function of CAN bus equipment
CN107592250B (en) Multi-rate self-adaptive test equipment based on aviation FC bus
WO2011137640A1 (en) File transmission method, file transmission apparatus and file reception apparatus
CN109688555B (en) Real-time signal data acquisition and communication system and method
CN109495215A (en) A kind of communication means of half-duplex bus, system and device and readable storage medium storing program for executing
CN109286471B (en) CRC (Cyclic redundancy check) method and device for SRIO (serial peripheral input/output) controller
Dong et al. Exploiting error estimating codes for packet length adaptation in low-power wireless networks
US20210014006A1 (en) System and method for implementing a hybrid automatic repeat request process
CN112803950A (en) Data compression method, device and equipment and computer storage medium
CN109525363A (en) Data transmission method and device
CN108072779A (en) A kind of digital oscilloscope CAN bus baud rate automatic identifying method
US11095474B2 (en) Packet data protocol
CN112118083A (en) Single-wire half-duplex communication method, communication device and equipment
CN107911288B (en) Train communication network card and train control management system
Goel et al. UVM based controller area network verification IP (VIP)
CN111901126B (en) Method for avoiding time consumption of decryption and signature verification module based on V2X protocol stack network layer
CN107046541B (en) Wireless transceiving encryption communication method and device thereof
KR20130133007A (en) Method and device for adjusting line sequences in ethernet transmission
Biswal et al. IoT‐Based Response Time Analysis of Messages for Smart Autonomous Collision Avoidance System Using Controller Area Network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant