Changes between Version 13 and Version 14 of linux/OTG


Ignore:
Timestamp:
01/15/2026 10:38:21 PM (2 hours ago)
Author:
Ryan Erbstoesser
Comment:

add otg example

Legend:

Unmodified
Added
Removed
Modified
  • linux/OTG

    v13 v14  
    440440}}}
    441441
     442The ID pin on OTG to Host cable (provided in our dev-kits) is grounded where-as the pin is floating on an OTG to device cable. When the ID pin is grounded the USB host controller will enumerate on the bus (regardless of having an actual USB device plugged in) and you first should verify that you see this occur.
     443
     444 * Start out by enabling kernel messages to the console so we can see the enumeration occur
     445{{{
     446echo 8 > /proc/sys/kernel/printk
     447}}}
     448
     449 * Now with no cable plugged into the OTG connector:
     450{{{
     451lsusb
     452Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
     453Bus 001 Device 002: ID 0424:2744 Microchip Technology, Inc. (formerly SMSC) Hub
     454Bus 001 Device 003: ID 0424:2740 Microchip Technology, Inc. (formerly SMSC) Hub Controller
     455^^^ the first device is the controller for USB1 which goes to the USB hub (not the front panel connector)
     456^^^ there is only one 1d6b:0002 device enumerated which is USB1 as the USB2 root hub should not yet be enumerated
     457}}}
     458
     459 * Now plug in the OTG to host cable (without anything plugged into the other end) and you should see the USB host controller enumerate because the ID pin gets grounded
     460{{{
     461[  152.460804] ci_hdrc ci_hdrc.0: EHCI Host Controller
     462[  152.465742] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 2
     463[  152.485200] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
     464[  152.490877] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.12
     465[  152.499172] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
     466[  152.500834] systemd-journald[147]: sd-device: Failed to chase symlinks in "/sys/dev/char/189:128".
     467[  152.506424] usb usb2: Product: EHCI Host Controller
     468[  152.515775] systemd-journald[147]: sd-device: Failed to chase symlinks in "/sys/dev/char/189:128".
     469[  152.520279] usb usb2: Manufacturer: Linux 6.12.0-00037-g7a3ed01ed94e ehci_hcd
     470[  152.520286] usb usb2: SerialNumber: ci_hdrc.0
     471[  152.529855] systemd-journald[147]: sd-device: Failed to chase symlinks in "/sys/dev/char/189:128".
     472[  152.537747] hub 2-0:1.0: USB hub found
     473[  152.553610] hub 2-0:1.0: 1 port detected
     474^^^ the controller enumerates
     475^^^ if this does not occur then you have a faulty/incompatible OTG-to-Host cable that doesn't GND the ID pin or there is a fault with the Gateworks board
     476}}}
     477
     478 * Run the lsusb command:
     479{{{
     480lsusb
     481Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
     482Bus 001 Device 002: ID 0424:2744 Microchip Technology, Inc. (formerly SMSC) Hub
     483Bus 001 Device 003: ID 0424:2740 Microchip Technology, Inc. (formerly SMSC) Hub Controller
     484Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
     485^^^ now we have both 1d6b:0002 root hubs
     486}}}
     487
     488 * Now, plug a USB device into the type-A socket on the OTG-to-Host cable and it should enumerate; here is a Gateworks JTAG adapter:
     489{{{
     490[  778.779644] usb 2-1: Manufacturer: Gateworks
     491[  778.779651] usb 2-1: SerialNumber: GW16042-D4
     492[  778.824160] usbcore: registered new interface driver usbserial_generic
     493[  778.830994] usbserial: USB Serial support registered for generic
     494[  778.849159] usbcore: registered new interface driver ftdi_sio
     495[  778.855051] usbserial: USB Serial support registered for FTDI USB Serial Device
     496[  778.862576] ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
     497[  778.869425] usb 2-1: Detected FT2232H
     498[  778.873673] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0
     499[  778.881092] ftdi_sio 2-1:1.1: FTDI USB Serial Device converter detected
     500[  778.887940] usb 2-1: Detected FT2232H
     501[  778.892161] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB1
     502^^^ if you see no device enumerate then we need to question of VBUS is getting enabled; you can check this with a voltmeter or use a device that has an LED on it indicating bus voltage such as a Gateworks JTAG adapter which has a green LED on it indicating vbus is present
     503}}}
     504
     505 * Run the lsusb command:
     506{{{
     507lsusb
     508Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
     509Bus 001 Device 002: ID 0424:2744 Microchip Technology, Inc. (formerly SMSC) Hub
     510Bus 001 Device 003: ID 0424:2740 Microchip Technology, Inc. (formerly SMSC) Hub Controller
     511Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
     512Bus 002 Device 002: ID 0403:6010 Future Technology Devices International, Ltd FT2232C/D/H Dual UART/FIFO IC
     513}}}
    442514
    443515[=#device-mode]