Need help! Can't get device mode to work.
#1
Hi, 

I'm running Debian on rockpro64, I want to setup rndis when device is plug into a linux host. I have modified the device tree to have USB-c port as peripheral. I have also setup configfs according to a lot of posts on the net, but every time I plug it in, linux host would give this error:

[Dec10 14:40] usb 1-2: new full-speed USB device number 57 using xhci_hcd
[  +0.128029] usb 1-2: device descriptor read/64, error -71
[  +0.236017] usb 1-2: device descriptor read/64, error -71
[  +0.235946] usb 1-2: new full-speed USB device number 58 using xhci_hcd
[  +0.128047] usb 1-2: device descriptor read/64, error -71
[  +0.235999] usb 1-2: device descriptor read/64, error -71
[  +0.108108] usb usb1-port2: attempt power cycle
[  +0.411868] usb 1-2: new full-speed USB device number 59 using xhci_hcd
[  +0.000146] usb 1-2: Device not responding to setup address.
[  +0.207999] usb 1-2: Device not responding to setup address.
[  +0.207841] usb 1-2: device not accepting address 59, error -71
[  +0.127874] usb 1-2: new full-speed USB device number 60 using xhci_hcd
[  +0.000143] usb 1-2: Device not responding to setup address.
[  +0.208144] usb 1-2: Device not responding to setup address.
[  +0.207847] usb 1-2: device not accepting address 60, error -71
[  +0.000175] usb usb1-port2: unable to enumerate USB device


I have bind fe800000.usb to UDC in configfs, but seems like whatever I change in configfs won't affect the result, as if configfs has nothing to do with the usb port.

I found someone else also had similar issue in another post on this forum, but there is no detail whether he found a solution or what the solution was. 
Can anyone help?
  Reply
#2
I was looking for similar info, and this looks relevant, specifically the steps at the end:

https://forum.pine64.org/showthread.php?tid=11523
  Reply
#3
(12-14-2021, 12:08 AM)djonathan Wrote: I was looking for similar info, and this looks relevant, specifically the steps at the end:

https://forum.pine64.org/showthread.php?tid=11523

Thanks for the reply. That's the exact post I was referring to in my first post, but for the life of me, I just can't echo device to mode no matter what, it doesn't give me any error, but after doing that, I cat mode and it is still host. I can't seem to be able to change mode to device (using root). I don't know what I'm doing wrong. I can set USB-c to device mode via dtb modifiction, but that means the board is booting with mode set to device already. Is the solution actually need the board to boot in "host" mode and then set it to "device"?
  Reply
#4
My /sys/class/udc is an empty directory.  Is your's populated?

I followed the configfs recipe here https://elinux.org/images/e/ef/USB_Gadge..._API_0.pdf, right up to the end where /sys/class/udc is expected to have content.

I also get a /var/log/syslog message that is related: udc-core: couldn't find an available UDC - added [g_ether] to list of pending drivers

And doing echo device > /sys/kernel/debug/fe800000.usb/mode   does not change the mode, which continues to have "host" value.

Looking in /boot/config-5.10.0-7-arm64, I see # CONFIG_USB_OTG is not set.

(12-14-2021, 12:08 AM)djonathan Wrote: I was looking for similar info, and this looks relevant, specifically the steps at the end:

https://forum.pine64.org/showthread.php?tid=11523

Thanks for the reply. That's the exact post I was referring to in my first post, but for the life of me, I just can't echo device to mode no matter what, it doesn't give me any error, but after doing that, I cat mode and it is still host. I can't seem to be able to change mode to device (using root). I don't know what I'm doing wrong. I can set USB-c to device mode via dtb modifiction, but that means the board is booting with mode set to device already. Is the solution actually need the board to boot in "host" mode and then set it to "device"?
  Reply
#5
@scanboy , were you able to get the device to enumerate?

I am running a Debian 5.15 kernel that does not have USB_OTG or device-tree OVERLAY enabled.  The original device-tree has dr_mode="host", so:
  • on the  running system I edited and replaced the dtb so that dr_mode="peripheral"
  • I can set up the configfs  /sys/kernel/config/usb_gadget/g1/ with files according to recipes for enabling RNDIS
  • /sys/class/udc has content, so I no longer get the "could not find an available udc" complaint
  • modprobe what look like the right drivers, and I see the kernel message g_ether gadget: g_ether ready
  • ip address shows usb0


I am trying to connect to a Windows 10 PC, and I get USB device not recognized when I plug in the cable, and running usbview.exe I see the real problem is FailedEnumeration.

So I think we are at the same point: the rockpro64 gadget is not responding to enumeration requests.
  Reply
#6
(12-29-2021, 04:47 PM)djonathan Wrote: @scanboy , were you able to get the device to enumerate?

I am running a Debian 5.15 kernel that does not have USB_OTG or device-tree OVERLAY enabled.  The original device-tree has dr_mode="host", so:
  • on the  running system I edited and replaced the dtb so that dr_mode="peripheral"
  • I can set up the configfs  /sys/kernel/config/usb_gadget/g1/ with files according to recipes for enabling RNDIS
  • /sys/class/udc has content, so I no longer get the "could not find an available udc" complaint
  • modprobe what look like the right drivers, and I see the kernel message g_ether gadget: g_ether ready
  • ip address shows usb0


I am trying to connect to a Windows 10 PC, and I get USB device not recognized when I plug in the cable, and running usbview.exe I see the real problem is FailedEnumeration.

So I think we are at the same point: the rockpro64 gadget is not responding to enumeration requests.

I was pretty much stuck at the same point you are, no matter what I changed in configfs, it didn't seemed to matter which made me think that dt overlay is necessary. I haven't had much time to mess with this lately, the last thing I did was trying to recompile the kernel to include dt overlay, but failed, haven't had time to look into it.
  Reply
#7
I changed to an Armbian load because that kernel has CONFIG_USB_OTG=y, thinking that would let me toggle between host and device in /sys/kernel/debug/fe800000.usb/mode, but I the mode doesn't change.  No idea why...

So I took a step back and just wondered is the device-tree correct for OTG behavior... did a web search for device-tree otg, and got this hit:

https://wiki.st.com/stm32mpu/wiki/OTG_de...nconnected

All those additional OTG-related keywords... I'm getting a bad feeling that the rockpro64 device-tree needs a lot of work.  Scroll up to the pins stanzas -- I see nothing like that in the rockpro64 device-tree.

The stm32 is microprocessor, and they provide this level of documentation...   Where is something similar for the rk3399?
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using the PCIe slot of ROCKPro64 as EndPoint mode nonoriri 1 647 11-20-2021, 10:53 AM
Last Post: fire219
  slave mode on Rockpro64 Radhika.gabani 1 1,371 09-22-2021, 05:35 AM
Last Post: mahtew
  Linux distro that will work with Kodi? SBCraok 9 7,072 09-18-2019, 02:12 AM
Last Post: mtrcycllvr
  USB device mode tikonen 1 1,851 07-02-2019, 05:49 AM
Last Post: tikonen
Information PCIe -> SATA and NVMe work as of 0.6.59 Luke 13 9,501 08-06-2018, 11:33 AM
Last Post: dukla2000

Forum Jump:


Users browsing this thread: 1 Guest(s)