Summary of the invention
The present invention provides the protocol conversion apparatus and the method for FlexRay bus and LIN bus, to solve the limitation problem of CAN bus.
For addressing the above problem, the invention discloses the protocol conversion apparatus of FlexRay bus and LIN bus, comprising:
The LIN bus transceiver; Be used for the data on the LIN bus that receives being sent data to central controller through the LIN bus isolation circuit, or send on the LIN bus through the data of LIN bus isolation circuit reception central controller and with data according to the order of central controller according to the order of central controller;
The FlexRay bus transceiver; Be used for the data on the FlexRay bus that receives being sent to central controller through the FlexRay bus isolation circuit, or send on the FlexRay bus through the data of FlexRay bus isolation circuit reception central controller and with data according to the order of central controller according to the order of central controller;
The LIN bus isolation circuit is used for the electrical isolation of LIN bus isolation circuit two lateral circuits, and the data of central controller are sent to the LIN bus transceiver, and the data that receive the LIN bus transceiver are to central controller;
The FlexRay bus isolation circuit is used for the electrical isolation of FlexRay bus isolation circuit two lateral circuits, and the data of central controller are sent to the FlexRay bus transceiver, and the data that receive the FlexRay bus transceiver are to central controller;
Central controller; Be used to receive the instruction of host computer and generate protocol mapping table according to instruction; Read on FlexRay bus or the LIN bus data and with storage in data storage; According to protocol mapping table the data in the data memory are carried out the agreement mapping, and the data after the agreement mapping are sent on LIN bus or the FlexRay bus;
Data storage is used to store the data that central controller transmits.
Preferably, said data storage is divided into two memory modules according to physical address, comprising:
LIN bus data module is used to store the data that central controller obtains from the LIN bus;
FlexRay bus data module is used to store the data that central controller obtains from the FlexRay bus.
Preferably, described device also comprises:
The RS232 interface circuit is used for communicating with host computer;
Preferably, described device also comprises:
Power circuit has 3 road power supplys output of mutual isolation, is respectively applied for to central controller, LIN bus transceiver and FlexRay bus transceiver supply power voltage is provided.
Preferably, described protocol mapping table comprises:
Mapping table from the LIN bus to the FlexRay bus, the content of wherein preserving is for shining upon the pairing FlexRay of this packet bus cycles time slot according to the id information that receives in the packet on the LIN bus to be comprised;
Mapping table from the FlexRay bus to the LIN bus; The content of wherein preserving is for to shine upon the id information of the pairing LIN bus of this packet according to receiving packet on the FlexRay bus with the transmission time slot of correspondence, and said id information is used to find this packet to send to destination node and the physical significance of data content representative on the LIN bus.
The present invention also provides the method for converting protocol of FlexRay bus and LIN bus, comprising:
Central processing unit passes through the instruction that the RS232 interface circuit receives host computer, and generates the protocol mapping table between FlexRay bus and the LIN bus according to said instruction;
Central controller reads the data on the LIN bus through LIN bus transceiver and LIN bus isolation circuit, or reads the data on the FlexRay bus through FlexRay bus transceiver and FlexRay bus isolation circuit;
Central controller according to protocol mapping table with the said storage that reads in data storage;
Central controller carries out the agreement mapping according to protocol mapping table to the data in the data memory;
Central controller sends to the data after the agreement mapping on the FlexRay bus through FlexRay bus isolation circuit and FlexRay bus transceiver, or the data of central controller after agreement is shone upon send on the LIN bus through LIN bus isolation circuit and LIN bus transceiver.
Preferably, said central controller according to protocol mapping table with the said storage that reads in data storage, comprising:
Central controller is according to protocol mapping table, and the storage on the LIN bus that will read through LIN bus transceiver and LIN bus isolation circuit is to the LIN bus data module of data storage;
Central controller is according to protocol mapping table, and the storage on the FlexRay bus that will read through FlexRay bus transceiver and FlexRay bus isolation circuit is to the FlexRay bus data module of data storage.
Preferably, said central controller carries out the agreement mapping from the LIN bus to the FlexRay bus according to protocol mapping table to the data in the data memory, comprising:
Central controller stores the data based protocol mapping table on the LIN bus that receives into the corresponding address of LIN bus data module in the data storage;
Central controller is searched the corresponding FlexRay bus cycles time slot of data of the different memory addresss of the LIN bus data module in the data storage according to protocol mapping table;
A time slot before the corresponding time slot of different memory addresss arrives reads the data in this address, and packs the data to the data format of FlexRay bus;
, the corresponding time slot of different memory addresss sends on the FlexRay bus when arriving through FlexRay bus isolation circuit and FlexRay bus transceiver.
Preferably, said central controller carries out the agreement mapping from the FlexRay bus to the LIN bus according to protocol mapping table to the data in the data memory, comprising:
Data based its corresponding transmission time slot on the FlexRay bus that receives is stored into the corresponding address of FlexRay bus data module in the data storage;
Central controller is searched physical significance and the destination node number of the pairing LIN bus data of data of the different memory addresss of the FlexRay bus data module in the data storage according to protocol mapping table;
When the LIN bus is idle, read the data of different memory addresss in proper order and pack the data to the data format of LIN bus, send on the LIN bus through LIN bus isolation circuit and LIN bus transceiver then.
Compared with prior art, the present invention includes following advantage:
The present invention provides the protocol conversion apparatus and the method for FlexRay bus and LIN bus; Through the inner protocol mapping table of central controller; Data to FlexRay bus and LIN bus are shone upon, and can realize communicating by letter between FlexRay bus and the LIN bus, and the FlexRay bus has characteristics such as high fault tolerance, high real-time and high bandwidth; Avoided the limitation of CAN bus, be adapted at adopting in the vehicle of FlexRay bus and use.Protocol conversion apparatus provided by the invention can be used as gateway; Realize the network interconnection and the protocol conversion of bus LIN bus commonly used on vehicle-mounted bus FlexRay bus of future generation and the present car; Device has adopted the electrical isolation measure to strengthen antijamming capability, can under extreme case, protect circuit.
Secondly, the FlexRay bus is follow-on automobile-used network standard, can use the FlexRay bus in the increasing vehicle, also just need accomplish with the LIN bus and communicate by letter, and therefore, the present invention is very practical.
Embodiment
For make above-mentioned purpose of the present invention, feature and advantage can be more obviously understandable, below in conjunction with accompanying drawing and embodiment the present invention done further detailed explanation.
FlexRay is a kind of novel communication standard; Aim at the car Intranet and design; Employing is promptly adopted the working method based on time slot based on the time driving mechanism, in each time slot timed sending data and the reception data of bus cycles; Have characteristics such as high bandwidth, fault freedom be good, have certain advantage aspect real-time, reliability and the flexibility.The FlexRay communication system of promoting in the world; Become the standard agreement of senior power assembly, chassis, line control system; The FlexRay agreement has obtained the support of each big automobile production producer of industry and automotive semiconductor company at present, becomes generally acknowledged of future generation automobile-used network standard.
In In-vehicle networking of future generation, can use the FlexRay bus to substitute the CAN bus; And low-cost network plan still adopts the LIN bus to realize; Both are present in the vehicle bus simultaneously, and a lot of occasions need communicate the transmission that realizes data, the invention provides the protocol conversion apparatus and the method for FlexRay bus and LIN bus; Can realize the communication between FlexRay bus and the LIN bus, following mask body is introduced.
With reference to Fig. 1, provided the protocol conversion apparatus structure chart of said FlexRay bus of the embodiment of the invention and LIN bus;
With reference to Fig. 2, provided the said FlexRay bus of the embodiment of the invention and be connected sketch map with the protocol conversion apparatus of LIN bus.
LIN bus transceiver 11; Be used for the data on the LIN bus that receives being sent to central controller 15 through LIN bus isolation circuit 13, or also these data sent on the LIN bus through the data that LIN bus isolation circuit 13 receives central controller 15 according to the order of central controller according to the order of central controller;
LIN bus transceiver 11 1 ends link to each other with the LIN bus, and the other end links to each other with LIN bus isolation circuit 13, and the transceiver 11 of LIN bus can adopt chip TJA1020.
LIN bus isolation circuit 13 is used for the electrical isolation of LIN bus isolation circuit two lateral circuits, and the data of central controller 15 are sent to LIN bus transceiver 11, and the data that receive the LIN bus transceiver are to central controller 15;
LIN bus isolation circuit 13 1 ends link to each other with LIN bus transceiver 11, and the other end links to each other with central controller 15.The electrical isolation that is used for LIN bus isolation circuit two lateral circuits sends to LIN bus transceiver 11 with the data of central controller 15, and the data that receive LIN bus transceiver 11 are to central controller 15.
The chip of LIN bus isolation circuit 13 can adopt 6N137; Wherein have 2 LIN bus isolation circuits 13 between central controller 15 and the LIN bus transceiver 11; Described LIN bus isolation circuit 13 comprises: the LIN bus is sent signal isolation circuit (LIN-TXD) and LIN bus interface collection of letters buffer circuit (LIN-RXD), and the electric signal of being isolated is respectively: the LIN bus is sent signal LIN-TXD and LIN bus interface collection of letters LIN-RXD.
FlexRay bus transceiver 12; Be used for the data on the FlexRay bus that receives being sent to central controller 15 through FlexRay bus isolation circuit 14, or also these data sent on the FlexRay bus through the data that FlexRay bus isolation circuit 14 receives central controller 15 according to the order of central controller according to the order of central controller;
In the present embodiment; Because the FlexRay bus is divided into FlexRayA bus and FlexRayB bus; Therefore two FlexRay bus transceivers 12 are arranged; One end links to each other with the FlexRay bus, and the other end links to each other with FlexRay bus isolation circuit 14, and the transceiver 12 of FlexRay bus can adopt chip TJA1080.
Said FlexRay bus isolation circuit 14 has six, comprising:
FlexRay bus enable signal buffer circuit (FlexRay-EN), FlexRay bus are sent signal isolation circuit (FlexRay-TXD), the FlexRay bus is sent enable signal buffer circuit (FlexRay-TXEN), FlexRay bus interface collection of letters buffer circuit (FlexRay-RXD), FlexRay bus spare input signal buffer circuit (FlexRay-STBN) and FlexRay bus and received enable signal buffer circuit (FlexRay-RXEN), and the electric signal of being isolated is respectively: FlexRay bus enable signal FlexRay-EN, FlexRay bus are sent signal FlexRay-TXD, the FlexRay bus is sent enable signal FlexRay-TXEN, FlexRay bus interface collection of letters FlexRay-RXD, FlexRay bus spare input signal FlexRay-STBN and FlexRay bus and received enable signal FlexRay-RXEN.
FlexRay bus isolation circuit 14 is used for the electrical isolation of FlexRay bus isolation circuit two lateral circuits, and the data of central controller 15 are sent to FlexRay bus transceiver 12, and the data that receive FlexRay bus transceiver 12 are to central controller 15;
FlexRay bus isolation circuit 14 1 ends link to each other with FlexRay bus transceiver 12, and the other end links to each other with central controller 15.The electrical isolation that is used for FlexRay bus isolation circuit two lateral circuits sends to FlexRay bus transceiver 12 with the data of central controller 15, and the data that receive FlexRay bus transceiver 12 are to central controller 15.
The chip of FlexRay bus isolation circuit 14 can adopt 6N137; Wherein have 6 FlexRay bus isolation circuits 14 between central controller 15 and each the FlexRay bus transceiver 12, be respectively FlexRay-EN, FlexRay-TXD, FlexRay-TXEN, FlexRay-RXD, FlexRay-STBN and FlexRay-RXEN.
Central controller 15; Be used to receive the instruction of host computer and generate protocol mapping table according to instruction; Read on FlexRay bus or the LIN bus data and with storage in data storage 16; According to protocol mapping table the data in the data memory 16 are carried out the agreement mapping, and the data after the agreement mapping are sent on LIN bus or the FlexRay bus;
In the present embodiment; Central controller 15 can adopt single-chip microcomputer MC9S12XF512; After central controller 15 receives the instruction of host computers, generate protocol mapping table according to instruction, with storage in data storage 16; According to protocol mapping table the data in the data memory 16 are carried out the agreement mapping then, and the data after the agreement mapping are sent on LIN bus or the FlexRay bus.
Further, described protocol mapping table comprises:
Mapping table from the LIN bus to the FlexRay bus, the content of wherein preserving is for shining upon the pairing FlexRay of this packet bus cycles time slot according to the id information that receives in the packet on the LIN bus to be comprised;
Mapping table from the FlexRay bus to the LIN bus; The content of wherein preserving is for to shine upon the id information of the pairing LIN bus of this packet according to receiving packet on the FlexRay bus with the transmission time slot of correspondence, and said id information is used to find this packet to send to destination node and the physical significance of data content representative on the LIN bus.
Data storage 16 is used to store the data that central controller 15 transmits.
Data storage 16 can adopt volatibility SDRAM, and the chip model is HY57V56162OB, and capacity is 32M*16bit.
Further, described data storage 16 is divided into two memory modules according to physical address, comprising:
LIN bus data module 161 is used to store the data that central controller 15 obtains from the LIN bus;
Storage on the LIN bus that central controller 15 reads through LIN bus transceiver 11 and LIN bus isolation circuit 13 is to LIN bus data module 161.
FlexRay bus data module 162 is used to store the data that central controller 15 obtains from the FlexRay bus.
Storage on the FlexRay bus that central controller 16 reads through FlexRay bus transceiver 12 and FlexRay bus isolation circuit 14 is to FlexRay bus data module 162.
Further, the described system of the embodiment of the invention also comprises:
The RS232 interface circuit is used for communicating with host computer;
Central controller 15 passes through the instruction that the RS232 interface receives host computer, and sets and divide protocol mapping table according to instruction.
Power circuit 17 has 3 road power supplys output of mutual isolation, is respectively applied for to central controller 15, LIN bus transceiver 11 and FlexRay bus transceiver 12 supply power voltage is provided.
In the present embodiment, power circuit 17 input voltages can be 12V, and output voltage can be respectively central controller 15, FlexRay bus transceiver 12 and LIN bus transceiver 11 supply power voltage is provided for 3 tunnel 5V that isolate each other.
The LIN bus adopts master-slave mode work; Protocol conversion apparatus is as the main equipment of LIN bus; FlexRay bus one side adopts time triggering mode to transmit and receive data; Promptly adopt the mode of time slot to carry out the reception and the transmission of data, each data all sends or receives in pre-designed appointment time slot; LIN bus one side adopts the Event triggered mode to transmit and receive data, and promptly when data need be sent, will send data and be put on the bus, when data reach, then receives data.
Because LIN bus and FlexRay bus both sides receive and send the machine-processed different of data, thus in central controller 15 indoor designs protocol mapping table, the corresponding data of two kinds of buses is carried out agreement shines upon.
In sum; The invention provides the protocol conversion apparatus of FlexRay bus and LIN bus; Through the inner protocol mapping table of central controller; Data to FlexRay bus and LIN bus are shone upon, and can realize communicating by letter between FlexRay bus and the LIN bus, are adapted at adopting in the vehicle of FlexRay bus using.Protocol conversion apparatus provided by the invention can be used as gateway; Realize the network interconnection and the protocol conversion of bus LIN bus commonly used on vehicle-mounted bus FlexRay bus of future generation and the present car; Device has adopted the electrical isolation measure to strengthen antijamming capability, can under extreme case, protect circuit.
Secondly, the FlexRay bus is follow-on automobile-used network standard, can use the FlexRay bus in the increasing vehicle, also just need accomplish with the LIN bus and communicate by letter, and therefore, the present invention is very practical.
With reference to Fig. 3, provided the application example figure of the protocol conversion apparatus of said FlexRay bus of the embodiment of the invention and LIN bus.
The FlexRay bus is divided into 64 time slots altogether, has taken 28 time slots wherein in the armamentarium that is connected, and remaining 36 time slots can be used for distributing to data on the LIN bus through sending to after the protocol conversion on the FlexRay bus.
Two-way FlexRay bus adopts redundant mode; Be that the equipment that connects of two-way is all identical; The equipment that wherein the FlexRay bus connected can comprise instrument control unit, entire car controller, brake monitor, steering controller etc., and the equipment that the LIN bus connected can comprise door control unit, car light control unit, seat control unit, conditioning control unit etc.The protocol conversion apparatus that passes through to be designed is realized communication.
For example; Turn in the FlexRay bus in the controller and need send to the car light control unit in the LIN bus with turning to some relevant data; Said data are sent on the FlexRay bus at the 20th time slot of FlexRay bus cycles by steering controller; Central controller receives this data when said the 20th time slot, and with its be stored in the FlexRay bus on the assigned address of FlexRay bus data module in the time slot 20 pairing data storages;
When LIN bus one brings out existing when idle; It is car light control unit that central controller is searched destination address according to protocol mapping table; And find and turn to relevant data to be sent corresponding address in the FlexRay bus data module in data storage; Also promptly find on the FlexRay bus assigned address of FlexRay bus data module in the time slot 20 pairing data storages, reading these data and being packaged as with the car light control unit is that the LIN data packet format of destination node sends on the LIN bus;
Through said process, just accomplished transmission from the FlexRay bus to the LIN bus data.
And for example; In the LIN bus in the door control unit some data relevant with the closing of the door state need send to the instrument control unit in the FlexRay bus; After central controller is received these data through the LIN bus interface; Searching destination address according to protocol mapping table is the instrument control unit; And find the 31st time slot of data corresponding the be assigned as FlexRay bus cycles relevant with the closing of the door state, with this deposit data to the FlexRay bus on the assigned address of LIN bus data module in the time slot 31 pairing data storages;
When the 30th time slot on the FlexRay bus arrives; Central controller read with the FlexRay bus on the data of the assigned address of LIN bus data module in the time slot 31 pairing data storages; And be packaged as the FlexRay data packet format, when the 31st time slot on the FlexRay bus arrives, this packet is sent on the FlexRay bus;
Through said process, just accomplished transmission from the LIN bus to the FlexRay bus data.
In sum; The invention provides the protocol conversion apparatus of FlexRay bus and LIN bus, the FlexRay bus connects different equipment separately with the LIN bus in vehicle, through the inner protocol mapping table of central controller; Data to FlexRay bus and LIN bus are shone upon; Can realize communicating by letter between FlexRay bus and the LIN bus, make and realize communication between each equipment, be adapted at adopting in the vehicle of FlexRay bus and use.Protocol conversion apparatus provided by the invention can be used as gateway; Realize the network interconnection and the protocol conversion of bus LIN bus commonly used on vehicle-mounted bus FlexRay bus of future generation and the present car; Device has adopted the electrical isolation measure to strengthen antijamming capability, can under extreme case, protect circuit.
Secondly, the FlexRay bus is follow-on automobile-used network standard, can use the FlexRay bus in the increasing vehicle, also just need accomplish with the LIN bus and communicate by letter, and therefore, the present invention is very practical.
Based on foregoing, the present invention also provides the embodiment of method.
With reference to Fig. 4, provided the method for converting protocol flow chart of said FlexRay bus of the embodiment of the invention and LIN bus.
Step 11, central controller passes through the instruction that the RS232 interface receives host computer, and generates the protocol mapping table between FlexRay bus and the LIN bus according to said instruction;
Step 12,, central controller reads the data on the LIN bus through LIN bus transceiver and LIN bus isolation circuit, or reads the data on the FlexRay bus through FlexRay bus transceiver and FlexRay bus isolation circuit;
Step 13, central controller according to protocol mapping table with the said storage that reads in data storage;
If read the data on the LIN bus, then get into step 131; If read the data on the FlexRay bus, then get into step 132.
Step 131, central controller be according to protocol mapping table, and the storage on the LIN bus that will read through LIN bus transceiver and LIN bus isolation circuit is to the LIN bus data module of data storage;
Step 132, central controller be according to protocol mapping table, and the storage on the FlexRay bus that will read through FlexRay bus transceiver and FlexRay bus isolation circuit is to the FlexRay bus data module of data storage.
Step 14, central controller carries out the agreement mapping according to protocol mapping table to the data in the data memory;
If the mapping of the agreement from the LIN bus to the FlexRay bus then gets into step 141, if the mapping of the agreement from the FlexRay bus to the LIN bus then gets into step 142.
Step 141, the agreement mapping from the LIN bus to the FlexRay bus;
Step 142, the agreement mapping from the FlexRay bus to the LIN bus.
Step 15; Central controller sends to the data after the agreement mapping on the FlexRay bus through FlexRay bus isolation circuit and FlexRay bus transceiver, or the data of central controller after agreement is shone upon send on the LIN bus through LIN bus isolation circuit and LIN bus transceiver.
Further, said central controller can carry out the agreement mapping from the LIN bus to the FlexRay bus according to protocol mapping table to the data in the data memory, and then step 141 further is divided into step as shown in Figure 5.
With reference to Fig. 5, provided the agreement mapping flow chart of method for converting protocol from the LIN bus to the FlexRay bus of said FlexRay bus of the embodiment of the invention and LIN bus.
Step 21, central controller store the data based protocol mapping table on the LIN bus that receives into the corresponding address of LIN bus data module in the data storage;
Step 22, central controller are searched the corresponding FlexRay bus cycles time slot of data of the different memory addresss of the LIN bus data module in the data storage according to protocol mapping table;
Step 23, a time slot before the corresponding time slot of different memory addresss arrives reads the data in this address, and packs the data to the data format of FlexRay bus;
Step 24 sends on the FlexRay bus through FlexRay bus isolation circuit and FlexRay bus transceiver when the corresponding time slot of different memory addresss arrives.
Further, said central controller can carry out the agreement mapping from the FlexRay bus to the LIN bus according to protocol mapping table to the data in the data memory, and then step 142 can further be divided into step as shown in Figure 6.
With reference to Fig. 6, provided the agreement mapping flow chart of method for converting protocol from the FlexRay bus to the LIN bus of said FlexRay bus of the embodiment of the invention and LIN bus.
Step 31 stores data based its corresponding transmission time slot on the FlexRay bus that receives into the corresponding address of FlexRay bus data module in the data storage;
Step 32, central controller are searched physical significance and the destination node number of the pairing LIN bus data of data of the different memory addresss of the FlexRay bus data module in the data storage according to protocol mapping table;
Step 33 reads the data of different memory addresss in proper order and packs the data to the data format of LIN bus when the LIN bus is idle, send on the LIN bus through LIN bus isolation circuit and LIN bus transceiver then.
For method embodiment, because it is similar basically with device embodiment, so description is fairly simple, relevant part gets final product referring to the part explanation of device embodiment.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed all is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.
More than to the protocol conversion apparatus of FlexRay bus provided by the present invention and LIN bus; Carried out detailed introduction; Used concrete example among this paper principle of the present invention and execution mode are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that on embodiment and range of application, all can change, in sum, this description should not be construed as limitation of the present invention.