Summary of the invention
The invention provides a kind of I2C bus circuit, implementation method and electronic equipment to solve the problem of the conflict of online burning mode data and debugging upgrading inconvenience.
For achieving the above object, technical solution of the present invention is achieved in that
According to an aspect of the present invention, provide a kind of I2C bus circuit, this I2C bus circuit comprises: as the first main frame of main equipment and the second main frame and as from one of equipment from machine;
First main frame and the second main frame and are equipped with I2C bus first interface I2C1 from machine, and the I2C1 of the first main frame, the I2C1 of the second main frame are connected between the I2C1 of machine with one;
First main frame and the second main frame are also respectively equipped with I2C bus second interface I2C2, and the I2C2 of the first main frame is connected with between the I2C2 of the second main frame;
First main frame through the I2C2 of the first main frame to the I2C2 sending controling instruction of the second main frame, to realize the first main frame and the second main frame time-sharing multiplex one I2C1 from machine.
Alternatively, I2C bus circuit also comprises the 3rd main frame;
3rd main frame is provided with I2C bus first interface I2C1, and the I2C1 of the first main frame, the I2C1 of the 3rd main frame are connected with between the I2C1 from machine;
3rd main frame is also provided with I2C bus second interface I2C2, the I2C2 of the first main frame is connected with between the I2C2 of the 3rd main frame;
First main frame through the I2C2 of I2C2 to the second main frame, the I2C2 sending controling instruction of the 3rd main frame of the first main frame, to realize the first main frame, the second main frame, the 3rd main frame time-sharing multiplex one from the I2C1 of machine.
Alternatively, the first main frame is also provided with the USB interface for connecting USB connector;
First main frame, for being received the next debugging upgrade of USB connector transmission and debugging ROMPaq by USB interface, and will debug ROMPaq write from machine according to debugging upgrade.
Alternatively, the first main frame is micro-control unit MCU;
Second main frame is mobile terminal high-definition audio and video standard interface MHL receiver;
One is EEPROM (Electrically Erasable Programmable Read Only Memo) EEPROM from machine.
Alternatively, the first main frame MCU, through the I2C2 interface sending controling instruction of the I2C2 interface of the first main frame to the second main frame MHL receiver after debugging upgrade being detected, makes the second main frame MHL receiver suspend access from machine EEPROM; And,
After the instruction that debugging ROMPaq completes being detected, the I2C1 interface of the first main frame MCU is hung up, be I2C mouth by the I2C2 interface configuration of the first main frame MCU, simultaneously through the I2C2 interface sending controling instruction of I2C2 interface to the second main frame MHL receiver, the I2C1 interface configuration making the second main frame MHL receiver is I2C mouth, recovers access from machine EEPROM.
Alternatively, the first main frame MCU is used for writing configuration information to from machine EEPROM;
Store configuration information is used for from machine EEPROM;
Second main frame MHL receiver is used for reading configuration information from from machine EEPROM.
Alternatively, the configuration information stored from machine EEPROM comprises: audio-video source format information;
Second main frame MHL receiver, for receiving the audio-video source of external transmission and reading audio-video source format information from from machine EEPROM, utilization is read audio-video source format information and is judged the audio-video source received from machine EEPROM, and handles accordingly according to judged result.
According to another aspect of the present invention, additionally provide a kind of electronic equipment, this electronic equipment comprises: as the I2C bus circuit of one aspect of the invention.
According to another aspect of the invention, provide a kind of implementation method of I2C bus circuit, the method comprises:
Choose as the first main frame of main equipment and the second main frame and as from equipment one from machine in circuit;
At the first main frame and the second main frame and, I2C bus first interface I2C1 is set from machine respectively, the I2C1 and of the I2C1 of the first main frame, the second main frame is coupled together between the I2C1 of machine;
I2C bus second interface I2C2 is set on the first main frame and the second main frame respectively, the I2C2 of the first main frame and the second main frame is coupled together; Utilize the first main frame through the I2C2 of the first main frame to the I2C2 sending controling instruction of the second main frame, to realize the first main frame and the second main frame time-sharing multiplex one I2C1 from machine.
Alternatively, the method also comprises: on the first main frame, be also provided with the USB interface for connecting USB connector;
Utilize the USB interface of the first main frame to receive the next debugging upgrade of USB connector transmission and debugging ROMPaq, and ROMPaq write will be debugged from machine according to debugging upgrade; And, choose micro-control unit MCU as the first main frame;
Choose mobile terminal high-definition audio and video standard interface MHL receiver as the second main frame;
Choose EEPROM (Electrically Erasable Programmable Read Only Memo) EEPROM as one from machine.
The invention has the beneficial effects as follows: technical scheme of the present invention by using as main equipment the first main frame and the second main frame and coupled together by I2C bus first interface I2C1 as from one of equipment from machine, coupled together as the first main frame of main equipment and the second main frame by I2C bus second interface I2C2 simultaneously, the I2C1 bus interface of two main frame time-sharing multiplexs one from machine is realized to the mode of the second main frame sending controling instruction by the first main frame, solve data collision problem during program online burning, first main frame or the second main frame all can communicate with from machine the transmission and storage that realize data, in addition, online burning also omit the recording device of off-line burning, provide cost savings, enhance the stability of system.
Embodiment
Core concept of the present invention is: for problems of the prior art, utilize the feature of I2C (Inter-Integrated Circuit) bus, propose a kind of time-sharing multiplex based on I2C bus mechanism, solve the collision problem of two main one digital independent existed from system and storage, data flow is effectively managed, facilitates the system later stage to upgrade and debugging simultaneously.I2C bus is a kind of universal serial bus of twin wire, for connecting microcontroller and peripherals thereof.It is a kind of special shape of synchronous communication, has interface line few, and control mode is simple, and device package form is little, and traffic rate is advantages of higher comparatively.I2C bus is being connected to transmission of information between the device of bus by serial data (SDA) line and serial clock (SCL) line.Time-sharing multiplex in the embodiment of the present invention refers to that the first moment was carried out the write work of data from machine by the first host access one, second moment was carried out the read work of data from machine by the second host access one, two main frame time-sharing multiplexs are same as machine, thus avoid data collision problem.Control realization can be carried out by the first main frame during concrete enforcement and access switching.
Fig. 1 is the structural representation of a kind of I2C bus circuit of one embodiment of the invention, and see Fig. 1, this I2C bus circuit of the present invention comprises:
As the first main frame 101 of main equipment and the second main frame 102 and as from one of equipment from machine 103;
First main frame 101 and the second main frame 102 and are equipped with I2C bus first interface I2C1 from machine 103, and the I2C1 of the first main frame 101, the I2C1 of the second main frame 102 are connected between the I2C1 of machine 103 with one;
First main frame 101 and the second main frame 102 are also respectively equipped with I2C bus second interface I2C2, and the I2C2 of the first main frame 101 is connected with between the I2C2 of the second main frame 102;
First main frame 101 through the I2C2 of the first main frame 101 to the I2C2 sending controling instruction of the second main frame 102, to realize the first main frame 101 and the second main frame 102 time-sharing multiplex one I2C1 from machine 103.
In the present embodiment, the first main frame 101 is micro-control unit MCU, and the second main frame 102 is mobile terminal high-definition audio and video standard interface MHL receiver, and one is EEPROM (Electrically Erasable Programmable Read Only Memo) EEPROM from machine 103.Wherein, MHL is a kind of audio-visual standard interface connecting portable consumer electronic device, the audio, video data of outside audio-video source transmission can be received by this interface, second main frame MHL receiver has the few and advantage of good stability of required transmission line, but the chip of the second main frame MHL receiver does not have fixed storage function, meeting obliterated data during power-off, the second main frame MHL receiver obtains configuration information by access one from machine EEPROM.In the present embodiment be a kind of power down from machine EEPROM after the storage medium do not lost of data, EEPROM can the existing information of erasing on computers or on specialized equipment, reprogramming.It should be noted that, the size of data considering main frame and configuration information upgrading ascending order is needed from the selection of machine, the data such as configuration information and MCU system debug ROMPaq needed due to MHL receiver in the present embodiment are not too large, so select EEPROM as from machine, in other embodiments of the invention from machine can be erasable programmable EPROM or other ROM storeies.
In addition, in one embodiment of the invention, I2C bus circuit comprises the first main frame and the second main frame as from equipment, and the second main frame is MHL receiver, for receiving audio/video information.But in other embodiments of the invention, I2C bus circuit can also comprise the 3rd main frame, the 3rd main frame is provided with I2C bus first interface I2C1, and the I2C1 of the first main frame, the I2C1 of the 3rd main frame are connected with between the I2C1 from machine;
3rd main frame is also provided with I2C bus second interface I2C2, the I2C2 of the first main frame is connected with between the I2C2 of the 3rd main frame;
First main frame through the I2C2 of I2C2 to the second main frame, the I2C2 sending controling instruction of the 3rd main frame of the first main frame, to realize the first main frame, described second main frame, the 3rd main frame time-sharing multiplex one from the I2C1 of machine.
3rd main frame is for receiving the information of other types data, and under the control of the first main frame, time-sharing multiplex one is from the I2C1 bus interface of machine, now, first main frame, the second main frame and the 3rd main frame time-sharing multiplex one are from the I2C1 interface of machine, first main frame is responsible for writing data to from machine, and when data write by the first main frame, other two main frames (the second main frame and the 3rd main frame) all suspend access from machine.After the write operation is completed, one of them main frame of the first host computer control (the second main frame or the 3rd main frame) access is fetched data from machine-readable, and another main frame (the second main frame or the 3rd main frame) suspends access from machine.Concrete second or the 3rd the host access application that can be realized by the second main frame or the 3rd main frame from machine determine, when the second main frame or the 3rd main frame need to carry out read data operation, specifically control the second main frame or the 3rd host access from machine by the first main frame.
In the circuit shown in Fig. 1, first main frame MCU by I2C1 bus by system configuration information programming to from machine EEPROM, second main frame MHL receiver to read the system configuration information storer from machine EEPROM by I2C1 bus access, the I2C2 that first main frame MCU controls the second main frame MHL receiver by I2C2 realizes two main frames by the function of the multiplexing access of I2C1 bus time-sharing from the I2C1 bus interface of machine EEPROM, solve the first main frame and the second main frame and access data collision problem from machine simultaneously, also save hardware cost and improve the stability of system.
Fig. 2 is the structural representation of a kind of I2C bus circuit of another embodiment of the present invention; First main frame 101 is also provided with the USB interface for connecting USB connector;
First main frame 101 for being received the next debugging upgrade of USB connector transmission and debugging ROMPaq by USB interface, and will debug ROMPaq write from machine 103 according to debugging upgrade.
First main frame MCU101, through the I2C2 interface sending controling instruction of the I2C2 interface of the first main frame MCU101 to the second main frame MHL receiver 102 after receiving debugging upgrade, makes the second main frame MHL receiver 102 suspend access EEPROM103; And, after the instruction that debugging ROMPaq completes being detected, the I2C1 interface of MCU101 is hung up, be I2C mouth by the I2C2 interface configuration of the first main frame MCU101, simultaneously through the I2C2 interface sending controling instruction of I2C2 interface to the second main frame MHL receiver 102, the I2C1 interface configuration making the second main frame MHL receiver is I2C mouth, recovers access EEPROM103.
In the present embodiment, the first main frame MCU101 is used for writing configuration information in EEPROM103; Store configuration information is used for from machine EEPROM103; Second main frame MHL receiver 102 is for reading configuration information from from machine EEPROM103.The configuration information stored from machine EEPROM103 comprises: audio-video source format information; Second main frame MHL receiver 102 is also for receiving the audio-video source of external transmission and reading audio-video source format information from from machine EEPROM103, utilization is read audio-video source format information and is judged the audio-video source received from machine EEPROM103, and handles accordingly according to judged result.The concrete course of work is, when I2C circuit normally works, second main frame MHL receiver is by after detecting the input of outside audio-video source and input format, by I2C1 bus access from machine EEPROM, whether the form of the video source of matching judgment outside input is consistent with the configuration information stored from machine EEPROM.If consistent, audio-video source continues to transmit to the back-end to do to process further by the second main frame MHL receiver; If inconsistent, video source is cut off and is not transmitted to the back-end by the second main frame MHL receiver.Here just in an embodiment of the invention, judgement processing procedure is carried out as during a main frame by reading the configuration information stored from machine when have chosen MHL receiver, when choosing the main frame of other devices as I2C bus circuit of the present invention, it may not be the judgement to audio-video source form, the function that can should realize according to other devices and the configuration information stored from machine do concrete process, do not limit this.
Work as the later stage, when system needs DFU (Device Firmware Upgrade) to debug and upgrades, after first main frame MCU detects the DFU debugging that USB connector transmission comes and upgrade by USB interface, by I2C2 bus interface to the second main frame MHL receiver sending controling instruction, make the I2C1 interface configuration of MHL receiver for input high-impedance state, I2C1 bus hung up by MHL receiver; After above-mentioned configuration completes, the first main frame MCU is by I2C1 bus access from machine EEPROM, and the debugging come the transmission of USB transmission channel and ROMPaq pass through I2C1 channel transfer extremely from machine EEPROM; After the first main frame MCU detects that program debug and upgrading complete instruction, the I2C1 interface configuration of the first main frame MCU is input high-impedance state by the first main frame MCU, be I2C interface by the I2C2 interface configuration of the first main frame MCU, by I2C bus to the second main frame MHL receiver sending controling instruction, the I2C1 interface of the second main frame MHL receiver is made also to be configured to I2C mouth, second main frame MHL receiver release I2C1 bus, make the function of its bus of I2C1 bus recovery, ensure that the second main frame MHL receiver can communicate with from machine EEPROM.In an embodiment of the present invention, I2C interface is a kind of general data transmission interface, it can also can as the I2C interface of transmission I2C bus data as common data transmission interface, here be I2C interface by the I2C2 interface configuration of the first main frame MCU and the I2C1 interface of the second main frame MHL receiver is also configured to I2C mouth can be understood as, by the I2C1 interface configuration of the I2C of the first main frame MCU and the second main frame MHL receiver for realizing I2C bus functionality.Thus achieve two main frames (the first main frame MCU and the second main frame MHL receiver) by the I2C1 bus interface function of the multiplexing access of I2C1 bus time-sharing from machine EEPROM.
Corresponding with above-mentioned I2C bus circuit, present invention also offers a kind of implementation method of I2C bus circuit, Fig. 3 be a kind of I2C bus circuit implementation method process flow diagram of one embodiment of the invention see Fig. 3, the method comprises:
Step S301, chooses as the first main frame of main equipment and the second main frame and as from equipment one from machine in circuit;
Step S302, arranges I2C bus first interface I2C1 at the first main frame and the second main frame and from machine respectively, is coupled together by the I2C1 and of the I2C1 of the first main frame, the second main frame between the I2C1 of machine;
Step S303, arranges I2C bus second interface I2C2 respectively, is coupled together by the I2C2 of the first main frame and the second main frame on the first main frame and the second main frame; Utilize the first main frame through the I2C2 of the first main frame to the I2C2 sending controling instruction of the second main frame, to realize the first main frame and the second main frame time-sharing multiplex one I2C1 from machine.
In the present embodiment, the method also comprises: on the first main frame, be also provided with the USB interface for connecting USB connector;
Utilize the USB interface of the first main frame to receive the next debugging upgrade of USB connector transmission and debugging ROMPaq, and ROMPaq write will be debugged from machine according to debugging upgrade; And, choose micro-control unit MCU as the first main frame;
Choose mobile terminal high-definition audio and video standard interface MHL receiver as the second main frame;
Choose EEPROM (Electrically Erasable Programmable Read Only Memo) EEPROM as one from machine.
It should be noted that, the implementation method of this I2C bus circuit of the present invention is corresponding with aforesaid I2C bus circuit, thus the implementation method performing step of this I2C bus circuit can illustrating see the part of aforementioned I2C bus circuit, do not repeat them here.
In addition, present invention also offers a kind of electronic equipment, Fig. 4 is the block diagram of a kind of electronic equipment of one embodiment of the invention, and see Fig. 4, this electronic equipment 400 comprises: I2C bus circuit 100.Because this electronic equipment 400 of the present invention is integrated with this spi bus circuit 100 of this invention, thus can online burning program and avoid data collision, stability is strong, and cost is low.In one embodiment of the invention, electronic equipment 400 can be head-mounted display apparatus HMD (Head Mount Display).
In sum, I2C bus circuit of the present invention and its implementation by using as main equipment the first main frame and the second main frame and coupled together by I2C bus first interface I2C1 as from one of equipment from machine, coupled together as the first main frame of main equipment and the second main frame by I2C bus second interface I2C2 simultaneously, the I2C1 bus interface of two main frame time-sharing multiplexs one from machine is realized to the mode of the second main frame sending controling instruction by the first main frame, solve data collision problem during program online burning, enhance the stability of system, also omit the recording device of off-line burning, provide cost savings.First main frame or the second main frame all can communicate with from machine the transmission and storage that realize data.Present invention also offers a kind of electronic equipment comprising above-mentioned I2C bus circuit, because this I2C bus circuit has above-mentioned advantage, therefore, the electronic equipment being integrated with this I2C bus circuit also has that stability is strong, cost is low, the problem of data collision when avoiding online burning program, improves the competitive power of electronic equipment.
The foregoing is only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.All any amendments done within the spirit and principles in the present invention, equivalent replacement, improvement etc., be all included in protection scope of the present invention.