This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: USB OTG network works intermittently

Part Number: AM5728

Tool/software: Linux

We have the USB OTG network interface working with our design, but the network doesn't always come up if the USB cable is connected to the OTG port when the board is powered up or restarted.

If I do a dmesg | grep usb when the network does come up, I see:

[    0.524827] ldousb: supplied by VMAIN
[    7.755716] extcon-usb-gpio extcon_usb2: GPIO lookup for consumer id
[    7.755729] extcon-usb-gpio extcon_usb2: using device tree for GPIO lookup
[    7.755738] of_get_named_gpiod_flags: can't parse 'id-gpios' property of node '/extcon_usb2[0]'
[    7.755807] of_get_named_gpiod_flags: parsed 'id-gpio' property of node '/extcon_usb2[0]' - status (0)
[    7.755862] extcon-usb-gpio extcon_usb2: GPIO lookup for consumer vbus
[    7.755869] extcon-usb-gpio extcon_usb2: using device tree for GPIO lookup
[    7.755877] of_get_named_gpiod_flags: can't parse 'vbus-gpios' property of node '/extcon_usb2[0]'
[    7.755885] of_get_named_gpiod_flags: can't parse 'vbus-gpio' property of node '/extcon_usb2[0]'
[    7.755892] extcon-usb-gpio extcon_usb2: using lookup tables for GPIO lookup
[    7.755900] extcon-usb-gpio extcon_usb2: lookup for GPIO vbus failed
[    9.134194] Modules linked in: dwc3(+) udc_core virtio_rpmsg_bus(+) ahci_platform libahci_platform ecb libahci pru_rproc libata pruss_intc scsi_mod sha512_generic omap_aes_driver extcon_usb_gpio snd_soc_omap_hdmi_audio omap_wdt sha512_arm rtc_omap pruss sha256_generic hmac md5 sha1_generic sha1_arm_neon sha1_arm omap_sham ti_vpe ti_sc ti_csc ti_vpdma dwc3_omap extcon omap_rng rng_core omap_des rtc_palmas omap_remoteproc remoteproc virtio virtio_ring
[    9.388480] usbcore: registered new interface driver usbfs
[    9.388533] usbcore: registered new interface driver hub
[    9.388595] usbcore: registered new device driver usb
[    9.406011] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    9.407220] dwc3 488d0000.usb: otg: primary host xhci-hcd.2.auto registered
[    9.407231] dwc3 488d0000.usb: otg: shared host xhci-hcd.2.auto registered
[    9.407239] dwc3 488d0000.usb: otg: can't start till gadget registers
[   10.516656] usb0: HOST MAC 72:82:02:55:3e:25
[   10.516708] usb0: MAC 2a:a6:81:17:55:50
[   10.516812] dwc3 488d0000.usb: otg: gadget gadget registered
[   11.259542] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[   40.751625] IPv6: ADDRCONF(NETDEV_CHANGE): usb0: link becomes ready

When it doesn't work, I see this:

[    0.524872] ldousb: supplied by VMAIN
[    8.069976] extcon-usb-gpio extcon_usb2: GPIO lookup for consumer id
[    8.069986] extcon-usb-gpio extcon_usb2: using device tree for GPIO lookup
[    8.069994] of_get_named_gpiod_flags: can't parse 'id-gpios' property of node '/extcon_usb2[0]'
[    8.070027] of_get_named_gpiod_flags: parsed 'id-gpio' property of node '/extcon_usb2[0]' - status (0)
[    8.070062] extcon-usb-gpio extcon_usb2: GPIO lookup for consumer vbus
[    8.070068] extcon-usb-gpio extcon_usb2: using device tree for GPIO lookup
[    8.070075] of_get_named_gpiod_flags: can't parse 'vbus-gpios' property of node '/extcon_usb2[0]'
[    8.070081] of_get_named_gpiod_flags: can't parse 'vbus-gpio' property of node '/extcon_usb2[0]'
[    8.070087] extcon-usb-gpio extcon_usb2: using lookup tables for GPIO lookup
[    8.070093] extcon-usb-gpio extcon_usb2: lookup for GPIO vbus failed
[    9.500910] Modules linked in: dwc3(+) udc_core virtio_rpmsg_bus(+) sha512_generic sha512_arm sha256_generic hmac md5 sha1_generic sha1_arm_neon extcon_usb_gpio sha1_arm snd_soc_omap_hdmi_audio pru_rproc pruss_intc ahci_platform libahci_platform libahci ecb libata omap_wdt omap_sham pruss scsi_mod omap_aes_driver ti_vpe ti_sc ti_csc ti_vpdma dwc3_omap extcon rtc_omap rtc_palmas omap_des omap_rng rng_core omap_remoteproc remoteproc virtio virtio_ring
[    9.670038] usbcore: registered new interface driver usbfs
[    9.670093] usbcore: registered new interface driver hub
[    9.670150] usbcore: registered new device driver usb
[    9.696746] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    9.698112] dwc3 488d0000.usb: otg: primary host xhci-hcd.2.auto registered
[    9.698121] dwc3 488d0000.usb: otg: shared host xhci-hcd.2.auto registered
[    9.698128] dwc3 488d0000.usb: otg: can't start till gadget registers
[   11.245905] usb0: HOST MAC 8e:69:c8:f2:8f:16
[   11.245959] usb0: MAC b2:e8:ad:6d:ae:c8
[   11.246064] dwc3 488d0000.usb: otg: gadget gadget registered

It seems like the network doesn't actually come up when the cable is connected even though the usb0 entry shows up in ifconfig.

This is the usb0 section in /etc/network/interfaces:

# Ethernet/RNDIS gadget (g_ether)
# Used by: /opt/scripts/boot/autoconfigure_usb0.sh
#auto usb0
allow-hotplug usb0
iface usb0 inet static
    address 192.168.7.2
    netmask 255.255.255.0
    #network 192.168.7.0
    #gateway 192.168.7.1


Is there anything I'm missing?

  • Is this a custom board? Which Linux version are you using? Can you post the USB portion of the schematic?
  • We're using Ubuntu 16.04.1 LTS with a kernel version of 4.4.32-rt41-ge26c84b0ac.

    Yes, this is a custom board. Here's the USB portion of the schematic:

  • Heather Rysenga said:
    We're using Ubuntu 16.04.1 LTS with a kernel version of 4.4.32-rt41-ge26c84b0ac.

    We don't support Ubuntu on TI devices, please try with Processor SDK filesystem to replicate the issue.

    I am unable to see the issue with Processor SDK v4.0. With the usb cable always connected, every time when I run 'modprobe g_ether' after kernel booted, the console always show the following message which means the usb host enumerates the ethernet gadget.

    [......] g_ether gadget: high-speed config #1: CDC Ethernet (ECM)

  • This isn't our problem. The module is already loaded, even in the situation where OTG does not work. Doing 'lsmod | grep g_ether' I get:

    g_ether                5054    0
    usb_f_rndis         15626  2 g_ether
    u_ether                12945  3 usb_f_ecm,usb_f_rndis,g_ether
    libcomposite        43854  3 usb_f_ecm,usb_f_rndis,g_ether


    We have found a reasonable workaround, though. It seems like there's a sort of race condition where if the USB network isn't ready when the udhcpd service starts, it won't come up. Our solution was to add 'systemctl restart udhcpd' to /etc/rc.local to restart the udhcpd service after the system has finished booting up, and now the USB network consistently works.