Summary of the invention
The invention provides 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:
LIN bus transceiver, for according to the order of central controller, the data in the LIN bus receiving being sent data to central controller by LIN bus isolation circuit, or receive the data of central controller and data are sent in LIN bus by LIN bus isolation circuit according to the order of central controller;
FlexRay bus transceiver, for according to the order of central controller, the data in the FlexRay bus receiving being sent to central controller by FlexRay bus isolation circuit, or receive the data of central controller and data are sent in FlexRay bus by FlexRay bus isolation circuit according to the order of central controller;
LIN bus isolation circuit, for the electrical isolation of LIN bus isolation circuit two lateral circuits, sends to LIN bus transceiver by the data of central controller, and the data that receive LIN bus transceiver are to central controller;
FlexRay bus isolation circuit, for the electrical isolation of FlexRay bus isolation circuit two lateral circuits, sends to FlexRay bus transceiver by the data of central controller, and the data that receive FlexRay bus transceiver are to central controller;
Central controller, for receiving the instruction of host computer and generating protocol mapping table according to instruction, read the data in FlexRay bus or LIN bus and data are stored in data storage, according to protocol mapping table, the data in data storage are carried out to agreement mapping, and the data after agreement mapping are sent in LIN bus or FlexRay bus;
Data storage, the data that transmit for storing central controller.
Preferably, described data storage is divided into two memory modules according to physical address, comprising:
LIN bus data module, the data of obtaining from LIN bus for storing central controller;
FlexRay bus data module, the data of obtaining from FlexRay bus for storing central controller.
Preferably, described device also comprises:
RS232 interface circuit, for communicating with host computer;
Preferably, described device also comprises:
Power circuit, has 3 road power supply outputs of mutual isolation, and being respectively used to provides supply power voltage for central controller, LIN bus transceiver and FlexRay bus transceiver.
Preferably, described protocol mapping table, comprising:
Mapping table from LIN bus to FlexRay bus, the content of wherein preserving is for to shine upon the corresponding FlexRay of this packet bus cycles time slot according to receiving the id information comprising in packet in LIN bus;
Mapping table from FlexRay bus to LIN bus, the content of wherein preserving is for to shine upon the id information of the corresponding LIN bus of this packet according to receiving packet in FlexRay bus with corresponding transmission time slot, described id information is used for finding this Packet Generation to the destination node in LIN bus and the physical significance of data content representative.
The present invention also provides the method for converting protocol of FlexRay bus and LIN bus, comprising:
Central processing unit receives the instruction of host computer by RS232 interface circuit, and generates the protocol mapping table between FlexRay bus and LIN bus according to described instruction;
Central controller reads the data in LIN bus by LIN bus transceiver and LIN bus isolation circuit, or reads the data in FlexRay bus by FlexRay bus transceiver and FlexRay bus isolation circuit;
Central controller stores the described data that read in data storage into according to protocol mapping table;
Central controller carries out agreement mapping according to protocol mapping table to the data in data storage;
Central controller sends to the data after agreement mapping in FlexRay bus by FlexRay bus isolation circuit and FlexRay bus transceiver, or central controller sends to the data after agreement mapping in LIN bus by LIN bus isolation circuit and LIN bus transceiver.
Preferably, described central controller stores the described data that read in data storage into according to protocol mapping table, comprising:
Central controller, according to protocol mapping table, stores the data in the LIN bus reading by LIN bus transceiver and LIN bus isolation circuit into the LIN bus data module of data storage;
Central controller, according to protocol mapping table, stores the data in the FlexRay bus reading by FlexRay bus transceiver and FlexRay bus isolation circuit into the FlexRay bus data module of data storage.
Preferably, described central controller carries out the agreement mapping from LIN bus to FlexRay bus according to protocol mapping table to the data in data storage, comprising:
Central controller stores the data based protocol mapping table in the LIN bus receiving into the corresponding address of LIN bus data module in data storage;
Central controller is searched the FlexRay bus cycles time slot corresponding to data of the different memory addresss of the LIN bus data module in data storage according to protocol mapping table;
A time slot before time slot corresponding to different memory addresss arrives reads the data in this address, and packs the data to the data format of FlexRay bus;
When arriving, time slot corresponding to different memory addresss send in FlexRay bus by FlexRay bus isolation circuit and FlexRay bus transceiver.
Preferably, described central controller carries out the agreement mapping from FlexRay bus to LIN bus according to protocol mapping table to the data in data storage, comprising:
The transmission time slot of data based its correspondence in the FlexRay bus receiving is stored into the corresponding address of FlexRay bus data module in data storage;
Central controller is searched physical significance and the destination node number of the corresponding LIN bus data of data of the different memory addresss of the FlexRay bus data module in data storage according to protocol mapping table;
When LIN bus is idle, sequentially read the data of different memory addresss and pack the data to the data format of LIN bus, then by LIN bus isolation circuit and LIN bus transceiver, send in LIN bus.
Compared with prior art, the present invention includes following advantage:
The invention provides protocol conversion apparatus and the method for FlexRay bus and LIN bus, by the protocol mapping table of central controller inside, data to FlexRay bus and LIN bus are shone upon, can realize communicating by letter between FlexRay bus and LIN bus, FlexRay bus has the features 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 network interconnection and the protocol conversion of conventional bus LIN bus on vehicle-mounted bus FlexRay bus of future generation and current car; device has adopted electrical isolation measure to strengthen antijamming capability, can under extreme case, to circuit, protect.
Secondly, FlexRay bus is follow-on automobile-used network standard, in increasing vehicle, can use FlexRay bus, also just need to complete and communicate by letter with LIN bus, and therefore, the present invention is very practical.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
FlexRay is a kind of Novel Communication standard, aim at car Intranet and design, employing is based on time driving mechanism, adopt the working method based on time slot, each time slot timed sending data and reception data in the bus cycles, there is the features such as high bandwidth, fault freedom be good, aspect real-time, reliability and flexibility, there is certain advantage.The FlexRay communication system of promoting in the world, become the standard agreement of senior power assembly, chassis, line control system, FlexRay agreement has obtained the support of industry Ge great automobile production producer and automotive semiconductor company at present, becomes the automobile-used network standard of the generally acknowledged next generation.
In In-vehicle networking of future generation, can substitute CAN bus by FlexRay bus, and low-cost network scheme still adopts LIN bus to realize, both are present in vehicle bus simultaneously, a lot of occasions need to communicate to realize the transmission of data, the invention provides protocol conversion apparatus and the method for FlexRay bus and LIN bus, can realize the communication between FlexRay bus and LIN bus, lower mask body is introduced.
With reference to Fig. 1, provided the protocol conversion apparatus structure chart of FlexRay bus and LIN bus described in the embodiment of the present invention;
With reference to Fig. 2, provided the protocol conversion apparatus connection diagram of FlexRay bus and LIN bus described in the embodiment of the present invention.
LIN bus transceiver 11, for according to the order of central controller, the data in the LIN bus receiving being sent to central controller 15 by LIN bus isolation circuit 13, or receive the data of central controller 15 and these data are sent in LIN bus by LIN bus isolation circuit 13 according to the order of central controller;
LIN bus transceiver 11 one end are connected with LIN bus, and the other end is connected with LIN bus isolation circuit 13, and the transceiver 11 of LIN bus can adopt chip TJA1020.
LIN bus isolation circuit 13, for the electrical isolation of LIN bus isolation circuit two lateral circuits, sends to LIN bus transceiver 11 by the data of central controller 15, and the data that receive LIN bus transceiver are to central controller 15;
LIN bus isolation circuit 13 one end are connected with LIN bus transceiver 11, and the other end is connected with central controller 15.Electrical isolation for LIN bus isolation circuit two lateral circuits, sends to LIN bus transceiver 11 by 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 between central controller 15 and LIN bus transceiver 11, have 2 LIN bus isolation circuits 13, described LIN bus isolation circuit 13 comprises: LIN bus transmitted signal buffer circuit (LIN-TXD) and LIN bus receive signal isolation circuit (LIN-RXD), and the electric signal of isolating is respectively: LIN bus transmitted signal LIN-TXD and LIN bus receive signal LIN-RXD.
FlexRay bus transceiver 12, for according to the order of central controller, the data in the FlexRay bus receiving being sent to central controller 15 by FlexRay bus isolation circuit 14, or receive the data of central controller 15 and these data are sent in FlexRay bus by FlexRay bus isolation circuit 14 according to the order of central controller;
In the present embodiment, because FlexRay bus is divided into FlexRayA bus and FlexRayB bus, therefore there are two FlexRay bus transceivers 12, one end is connected with FlexRay bus, the other end is connected with FlexRay bus isolation circuit 14, and the transceiver 12 of FlexRay bus can adopt chip TJA1080.
Described FlexRay bus isolation circuit 14 has six, comprising:
FlexRay bus enable signal buffer circuit (FlexRay-EN), FlexRay bus transmitted signal buffer circuit (FlexRay-TXD), FlexRay bus sends enable signal buffer circuit (FlexRay-TXEN), FlexRay bus receives signal isolation circuit (FlexRay-RXD), FlexRay bus spare input signal buffer circuit (FlexRay-STBN) and FlexRay bus receive enable signal buffer circuit (FlexRay-RXEN), the electric signal of isolating is respectively: FlexRay bus enable signal FlexRay-EN, FlexRay bus transmitted signal FlexRay-TXD, FlexRay bus sends enable signal FlexRay-TXEN, FlexRay bus receives signal FlexRay-RXD, FlexRay bus spare input signal FlexRay-STBN and FlexRay bus receive enable signal FlexRay-RXEN.
FlexRay bus isolation circuit 14, for the electrical isolation of FlexRay bus isolation circuit two lateral circuits, sends to FlexRay bus transceiver 12 by the data of central controller 15, and the data that receive FlexRay bus transceiver 12 are to central controller 15;
FlexRay bus isolation circuit 14 one end are connected with FlexRay bus transceiver 12, and the other end is connected with central controller 15.Electrical isolation for FlexRay bus isolation circuit two lateral circuits, sends to FlexRay bus transceiver 12 by 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 between central controller 15 and each FlexRay bus transceiver 12, have 6 FlexRay bus isolation circuits 14, be respectively FlexRay-EN, FlexRay-TXD, FlexRay-TXEN, FlexRay-RXD, FlexRay-STBN and FlexRay-RXEN.
Central controller 15, for receiving the instruction of host computer and generating protocol mapping table according to instruction, read in FlexRay bus or LIN bus data and data are stored in data storage 16, according to protocol mapping table, the data in data storage 16 are carried out to agreement mapping, and the data after agreement mapping are sent in LIN bus or FlexRay bus;
In the present embodiment, central controller 15 can adopt single-chip microcomputer MC9S12XF512, central controller 15 receives after the instruction of host computer, according to instruction, generate protocol mapping table, data are stored in data storage 16, then according to protocol mapping table, the data in data storage 16 are carried out to agreement mapping, and the data after agreement mapping are sent in LIN bus or FlexRay bus.
Further, described protocol mapping table, comprising:
Mapping table from LIN bus to FlexRay bus, the content of wherein preserving is for to shine upon the corresponding FlexRay of this packet bus cycles time slot according to receiving the id information comprising in packet in LIN bus;
Mapping table from FlexRay bus to LIN bus, the content of wherein preserving is for to shine upon the id information of the corresponding LIN bus of this packet according to receiving packet in FlexRay bus with corresponding transmission time slot, described id information is used for finding this Packet Generation to the destination node in LIN bus and the physical significance of data content representative.
Data storage 16, the data that transmit for storing central controller 15.
Data storage 16 can adopt volatibility SDRAM, and 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, the data of obtaining from LIN bus for storing central controller 15;
Data in the LIN bus that central controller 15 reads by LIN bus transceiver 11 and LIN bus isolation circuit 13 store LIN bus data module 161 into.
FlexRay bus data module 162, the data of obtaining from FlexRay bus for storing central controller 15.
Data in the FlexRay bus that central controller 16 reads by FlexRay bus transceiver 12 and FlexRay bus isolation circuit 14 store FlexRay bus data module 162 into.
Further, the system described in the embodiment of the present invention also comprises:
RS232 interface circuit, for communicating with host computer;
Central controller 15 receives the instruction of host computer by RS232 interface, and sets and divide protocol mapping table according to instruction.
Power circuit 17, has 3 road power supply outputs of mutual isolation, and being respectively used to provides supply power voltage for central controller 15, LIN bus transceiver 11 and FlexRay bus transceiver 12.
In the present embodiment, power circuit 17 input voltages can be 12V, and the 5V that output voltage can be isolated mutually for 3 tunnels, is respectively central controller 15, FlexRay bus transceiver 12 and LIN bus transceiver 11 supply power voltage is provided.
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, adopt the mode of time slot to carry out reception and the transmission of data, each data all sends or receives in pre-designed appointment time slot; LIN bus one side adopts Event triggered mode to transmit and receive data, and, when having data to send, transmission data is put in bus, when having data to reach, receives data.
Due to LIN bus and FlexRay bus both sides receive different with the mechanism that sends data, so in central controller 15 indoor designs protocol mapping table, the corresponding data of two kinds of buses is carried out to agreement mapping.
In sum, the invention provides the protocol conversion apparatus of FlexRay bus and LIN bus, by the protocol mapping table of central controller inside, data to FlexRay bus and LIN bus are shone upon, can realize communicating by letter between FlexRay bus and LIN 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 network interconnection and the protocol conversion of conventional bus LIN bus on vehicle-mounted bus FlexRay bus of future generation and current car; device has adopted electrical isolation measure to strengthen antijamming capability, can under extreme case, to circuit, protect.
Secondly, FlexRay bus is follow-on automobile-used network standard, in increasing vehicle, can use FlexRay bus, also just need to complete and communicate by letter with LIN bus, and therefore, the present invention is very practical.
With reference to Fig. 3, provided the application example figure of the protocol conversion apparatus of FlexRay bus and LIN bus described in the embodiment of the present invention.
FlexRay bus is divided into 64 time slots altogether, has taken 28 time slots wherein in the armamentarium connecting, and the data that remaining 36 time slots can be used for distributing in LIN bus send in FlexRay bus after protocol conversion.
Two-way FlexRay bus adopts the mode of redundancy, be that the equipment that connects of two-way is all identical, the equipment that wherein FlexRay bus connects can comprise instrument control unit, entire car controller, brake monitor, steering controller etc., and the equipment that LIN bus connects can comprise door control unit, car light control unit, chair control unit, conditioning control unit etc.By designed protocol conversion apparatus, realize communication.
For example, in FlexRay bus, in steering controller, need to send to the car light control unit in LIN bus to turning to some relevant data, described data are sent in FlexRay bus at the 20th time slot of FlexRay bus cycles by steering controller, central controller receives this data when described the 20th time slot, and be stored in FlexRay bus on the assigned address of FlexRay bus data module in the corresponding data storage of time slot 20;
When there is the free time in LIN bus one end, 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 FlexRay bus data module in data storage, also find in FlexRay bus the assigned address of FlexRay bus data module in the corresponding data storage of time slot 20, read these data and be packaged as and take the LIN data packet format that car light control unit is destination node and send in LIN bus;
By said process, just completed the transmission from FlexRay bus to LIN bus data.
And for example, in LIN bus, in door control unit, some data relevant to closing of the door state need to send to the instrument control unit in FlexRay bus, central controller receives after these data by LIN bus, according to protocol mapping table, searching destination address is instrument control unit, and find the 31st time slot of data corresponding the be assigned as FlexRay bus cycles relevant to closing of the door state, by this deposit data to FlexRay bus on the assigned address of LIN bus data module in the corresponding data storage of time slot 31;
When in FlexRay bus, the 30th time slot arrives, central controller read with FlexRay bus on the data of the assigned address of LIN bus data module in the corresponding data storage of time slot 31, and be packaged as FlexRay data packet format, when in FlexRay bus, the 31st time slot arrives by this Packet Generation on FlexRay bus;
By said process, just completed the transmission from LIN bus to FlexRay bus data.
In sum, the invention provides the protocol conversion apparatus of FlexRay bus and LIN bus, FlexRay bus connects separately different equipment in vehicle from LIN bus, by the protocol mapping table of central controller inside, data to FlexRay bus and LIN bus are shone upon, can realize communicating by letter between FlexRay bus and LIN bus, make to 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 network interconnection and the protocol conversion of conventional bus LIN bus on vehicle-mounted bus FlexRay bus of future generation and current car; device has adopted electrical isolation measure to strengthen antijamming capability, can under extreme case, to circuit, protect.
Secondly, FlexRay bus is follow-on automobile-used network standard, in increasing vehicle, can use FlexRay bus, also just need to complete and communicate by letter with LIN bus, 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 FlexRay bus and LIN bus described in the embodiment of the present invention.
Step 11, central controller receives the instruction of host computer by RS232 interface, and generates the protocol mapping table between FlexRay bus and LIN bus according to described instruction;
Step 12,, central controller reads the data in LIN bus by LIN bus transceiver and LIN bus isolation circuit, or reads the data in FlexRay bus by FlexRay bus transceiver and FlexRay bus isolation circuit;
Step 13, central controller stores the described data that read in data storage into according to protocol mapping table;
If read the data in LIN bus, enter step 131; If read the data FlexRay bus, enter step 132.
Step 131, central controller, according to protocol mapping table, stores the data in the LIN bus reading by LIN bus transceiver and LIN bus isolation circuit into the LIN bus data module of data storage;
Step 132, central controller, according to protocol mapping table, stores the data in the FlexRay bus reading by FlexRay bus transceiver and FlexRay bus isolation circuit into the FlexRay bus data module of data storage.
Step 14, central controller carries out agreement mapping according to protocol mapping table to the data in data storage;
If the mapping of the agreement from LIN bus to FlexRay bus, enters step 141, if the mapping of the agreement from FlexRay bus to LIN bus enters step 142.
Step 141, the agreement mapping from LIN bus to FlexRay bus;
Step 142, the agreement mapping from FlexRay bus to LIN bus.
Step 15, central controller sends to the data after agreement mapping in FlexRay bus by FlexRay bus isolation circuit and FlexRay bus transceiver, or central controller sends to the data after agreement mapping in LIN bus by LIN bus isolation circuit and LIN bus transceiver.
Further, described central controller can carry out the agreement mapping from LIN bus to FlexRay bus according to protocol mapping table to the data in data storage, and step 141 Further Division is step as shown in Figure 5.
With reference to Fig. 5, the agreement mapping flow chart of the method for converting protocol that has provided FlexRay bus and LIN bus described in the embodiment of the present invention from LIN bus to FlexRay bus.
Step 21, central controller stores the data based protocol mapping table in the LIN bus receiving into the corresponding address of LIN bus data module in data storage;
Step 22, central controller is searched the FlexRay bus cycles time slot corresponding to data of the different memory addresss of the LIN bus data module in data storage according to protocol mapping table;
Step 23, a time slot before time slot corresponding to different memory addresss arrives reads the data in this address, and packs the data to the data format of FlexRay bus;
Step 24 sends in FlexRay bus by FlexRay bus isolation circuit and FlexRay bus transceiver when time slot corresponding to different memory addresss arrives.
Further, described central controller can carry out the agreement mapping from FlexRay bus to LIN bus according to protocol mapping table to the data in data storage, and step 142 can Further Division be step as shown in Figure 6.
With reference to Fig. 6, the agreement mapping flow chart of the method for converting protocol that has provided FlexRay bus and LIN bus described in the embodiment of the present invention from FlexRay bus to LIN bus.
Step 31, stores the transmission time slot of data based its correspondence in the FlexRay bus receiving into the corresponding address of FlexRay bus data module in data storage;
Step 32, central controller is searched physical significance and the destination node number of the corresponding LIN bus data of data of the different memory addresss of the FlexRay bus data module in data storage according to protocol mapping table;
Step 33 sequentially reads the data of different memory addresss and packs the data to the data format of LIN bus when LIN bus is idle, then by LIN bus isolation circuit and LIN bus transceiver, sends in LIN bus.
For embodiment of the method, because it is substantially similar to device embodiment, so description is fairly simple, relevant part is 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 each embodiment stresses is the difference with other embodiment, between each embodiment identical similar part mutually referring to.
Protocol conversion apparatus to FlexRay bus provided by the present invention and LIN bus above, be described in detail, applied specific case herein principle of the present invention and execution mode are set forth, the explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof; , for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention meanwhile.