7 Replies Latest reply on Feb 23, 2015 7:24 PM by kolosy

    connecting directly to the OTG port

    kolosy

      I'm using the intel mini breakout. I'd like to connect a standard USB2.0 peripheral directly to the OTG port. It worked fine when I bought an adapter, which appears to show itself as a 1-port USB hub, but my device doesn't seem to be showing up in dmesg or on lsusb if i connect directly. I bought a micro-b breakout plug, cut the standard USB tail off my peripheral, and soldered the wires to the plug. Is there something magical about OTG which requires this intermediate hub?

        • 1. Re: connecting directly to the OTG port
          Bunsen

          There's nothing that requires a hub, but the hub might be doing something that your homebrew cable isn't -- grounding the ID pin.  USB OTG uses it to tell whether to act as a slave device (ID pin left floating) or as a host (ID pin grounded).  USB Micro-B plugs usually don't even bring out a wire for the ID pin, leaving it disconnected.  USB Micro-A plugs have it internally grounded.  Find a Micro-A cable or ground the USB_ID pin some other way and it will probably be okay.

          • 2. Re: connecting directly to the OTG port
            kolosy

            I'm using a micro-b breakout specifically to get at pin 4 (the ID pin). Here's the thing though - grounding the pin marks the device as a host, which it isn't. A hub is a host, the device shouldn't be. When I ground the pin, I get:

             

             

            [ 1309.251556] pmic_ccsm pmic_ccsm: USB VBUS Detected. Notifying OTG driver

            [ 1310.283910] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?

            [ 1311.183748] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?

            [ 1312.083620] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?

            [ 1312.983514] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?

            [ 1312.990517] hub 1-0:1.0: unable to enumerate USB device on port 1

             

            I read that as it's trying to treat whatever's attached (a webcam in my case) as a hub, and isn't able to do so. After your comment, I'm starting to think that maybe it's behaving correctly, port 1 is on the edison itself, and this message really is about some other connectivity issue...?

            • 3. Re: connecting directly to the OTG port
              Bunsen

              Grounding the ID pin tells the Edison to act as a host, and a hub acts a slave on its upstream port and a host on its downstream ports.  The only reason I can think of for an adapter to act as a hub is if it's also handling power (does that adapter have an external power supply?), so battery-powered OTG hosts don't have to burn watt-hours running USB peripherals.

               

              But it looks like the Edison is also interpreting 5V on VBUS as an indication that it should act as a slave.  From the module hardware guide: "The USB_VBUS signal should be applied to pin 20. This signal is only used to alert the Intel® Edison that it has been connected to a host port."

               

              Looking at the schematic for the Arduino board, 5V from USB is only applied to the Edison's VBUS pin (through Q10) if the Arduino board's switch is set for slave mode -- which also leaves USB_ID floating (Q11 is off).  If it's set for master mode, the Edison's VBUS pin isn't connected to anything (Q10 is turned off), the board's 5V bus is used to supply power to the slave device (through U36), and the Edison's USB_ID pin is grounded (by Q11 turning on).  So on that board, the VBUS and USB_ID signals are set up to always tell the Edison the same thing -- either both say "be a master" or both say "be a slave."  I haven't tried giving it conflicting signals, but it apparently gets confused.

              • 4. Re: connecting directly to the OTG port
                kolosy

                So I've been interpreting the ID pin thing backwards.. Which makes sense. I was assuming it was talking about the "owner" of the cable (i.e. the attached peripheral) being viewed as the host or the slave based on pin 4.

                 

                I'm using the mini breakout board, not the arduino one - there's no USB selector switch on it.

                 

                Here's the full dmesg output when it's connected with the pin grounded:

                 

                [ 1308.317793] pmic_ccsm pmic_ccsm: USB ID Detected. Notifying OTG driver
                [ 1309.183963] dwc3-host dwc3-host.2: xHCI Host Controller
                [ 1309.184673] dwc3-host dwc3-host.2: new USB bus registered, assigned bus number 1
                [ 1309.184925] dwc3-host dwc3-host.2: irq 34, io mem 0xf9100000
                [ 1309.185074] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
                [ 1309.185097] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
                [ 1309.185117] usb usb1: Product: xHCI Host Controller
                [ 1309.185136] usb usb1: Manufacturer: Linux 3.10.17-poky-edison+ dwc-xhci
                [ 1309.185154] usb usb1: SerialNumber: dwc3-host.2
                [ 1309.185918] xHCI xhci_add_endpoint called for root hub
                [ 1309.185939] xHCI xhci_check_bandwidth called for root hub
                [ 1309.186198] hub 1-0:1.0: USB hub found
                [ 1309.186242] hub 1-0:1.0: 1 port detected
                [ 1309.186761] dwc3-host dwc3-host.2: xHCI Host Controller
                [ 1309.191235] dwc3-host dwc3-host.2: new USB bus registered, assigned bus number 2
                [ 1309.191418] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
                [ 1309.191442] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
                [ 1309.191462] usb usb2: Product: xHCI Host Controller
                [ 1309.191481] usb usb2: Manufacturer: Linux 3.10.17-poky-edison+ dwc-xhci
                [ 1309.191500] usb usb2: SerialNumber: dwc3-host.2
                [ 1309.203978] xHCI xhci_add_endpoint called for root hub
                [ 1309.204003] xHCI xhci_check_bandwidth called for root hub
                [ 1309.204286] hub 2-0:1.0: USB hub found
                [ 1309.204332] hub 2-0:1.0: 1 port detected
                [ 1309.251556] pmic_ccsm pmic_ccsm: USB VBUS Detected. Notifying OTG driver
                [ 1310.283910] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
                [ 1311.183748] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
                [ 1312.083620] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
                [ 1312.983514] hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
                [ 1312.990517] hub 1-0:1.0: unable to enumerate USB device on port 1
                
                • 5. Re: connecting directly to the OTG port
                  Bunsen

                  Okay, looking at the mini breakout schematic, it looks like the board connects the Edison's VBUS pin straight to pin 1 of the microUSB connector.  Combined with "[ 1309.251556] pmic_ccsm pmic_ccsm: USB VBUS Detected. Notifying OTG driver," that makes me wonder if OTG host mode can even work on the mini breakout. Does that line show up when nothing is connected to the USB port?  Or if you just ground USB_ID without connecting anything else?  Because it's starting to look like putting the Edison in host mode sends the PSW pin high, which turns the switch IC U36 on, which supplies 5V_SYS to VBUS, which tells the Edison not to be a host.  Maybe I'm misunderstanding something about OTG, but that seems broken.

                  • 6. Re: connecting directly to the OTG port
                    kolosy

                    i'll check when i get home tonight.

                     

                    this peripheral *does* work when connected through a regular usb -> micro b adapter as I mentioned before (though there's a very real possibility that I either damaged it in the process of attaching the new connector, or wired the connector wrong)

                    • 7. Re: connecting directly to the OTG port
                      kolosy

                      so the issue was the need to ground pin 4. as i said before, i misinterpreted who becomes host when the pin is grounded. the last problem (the one from the log above) was me flipping D+ and D- on the header