The invention discloses a method which realizes the universal serial
bus USB OTG and includes that the processor detects the principal- subordinate identification interface
signal though the second GPIO and judges the level of the principal-subordinate identification interface
signal; if the principal-subordinate identification interface
signal is low level, the
USB principle device controller is started; if the principal-subordinate identification interface signal is high level, the
USB subordinate device controller is started; meanwhile, the invention also discloses a device which realizes the universal serial
bus USB OTG; the device comprises a processor, a plurality of analog switches, a
power module and a MINI_AB interface module; wherein, the processor includes a USB principle device controller, a USB subordinate device controller, four GPIO interfaces, two
data interface signals, a power interface signal and a principal-subordinate identification interface signal. The method and the device which realize the universal serial
bus USB OTG provide the
client with a set of universal serial bus USB OTG solution which has the advantages of
simple circuit, low cost, convenient application, wide application range and reliable performance.