@ken is investigating this issue now, you can send mail to support@radxa.com for further communication
Possible USB peripheral issue on Rock 5B+ (missing DISCONNECT event)?
What device should I connect to reproduce the problem?
Thank you @Peter.Wang!
@ken I am using a regular desktop PC as the host (Intel NUC8i7HVK2), where the 5B+ shows up as a mass storage device.
The following steps can be used for testing:
-
Flash the Rock 5B+ image: https://github.com/radxa-build/rock-5b-plus/releases/download/rsdk-b2/rock-5b-plus_bookworm_kde_b2.output.img.xz
-
Set the USB port at address
0xFC400000
(rear bottom USB3-A) to peripheral mode usingrsetup
Set the port at0xFC000000
(front USB-C) to host mode usingfdtput
, since overlay is missing:
sudo fdtput -t s /usr/lib/linux-image-6.1.43-15-rk2312/rockchip/rk3588-rock-5b-plus.dtb /usbdrd3_0/usb@fc000000 dr_mode host
-
Reboot
-
Verify modes:
cat /proc/device-tree/usbdrd3_0/usb@fc000000/dr_mode
# should return ‘host’
cat /proc/device-tree/usbdrd3_1/usb@fc400000/dr_mode
# should return ‘peripheral’ -
Create an image file:
dd if=/dev/zero of=disk.img bs=1 count=0 seek=10G
-
Activate the mass storage gadget:
sudo modprobe g_mass_storage file=disk.img
-
Enable logging of
dwc3_event
events:echo 1 | sudo tee /sys/kernel/tracing/events/dwc3/dwc3_event/enable
-
Trace the events:
sudo cat /sys/kernel/tracing/trace_pipe | egrep "Disconnect|Reset|Connection Done|Suspend|WakeUp"
When following the above steps on the 5B+, unplugging and replugging the USB cable 3 times results in the following log:
radxa@rock-5b-plus:~$ sudo cat /sys/kernel/tracing/trace_pipe | egrep “Disconnect|Reset|Connection Done|Suspend|WakeUp”
irq/79-dwc3-1697 [000] D… 180.328576: dwc3_event: event (00000101): Reset [U0]
irq/79-dwc3-1697 [000] D… 180.332902: dwc3_event: event (00000201): Connection Done [U0]
irq/79-dwc3-1697 [000] D… 184.795167: dwc3_event: event (00030601): Suspend [U3]
irq/79-dwc3-1697 [000] D… 189.082074: dwc3_event: event (00000101): Reset [U0]
irq/79-dwc3-1697 [000] D… 189.084271: dwc3_event: event (00000201): Connection Done [U0]
irq/79-dwc3-1697 [000] D… 189.094847: dwc3_event: event (00000101): Reset [U0]
irq/79-dwc3-1697 [000] D… 189.099212: dwc3_event: event (00000201): Connection Done [U0]
irq/79-dwc3-1697 [000] D… 196.790509: dwc3_event: event (00030601): Suspend [U3]
irq/79-dwc3-1697 [000] D… 201.082624: dwc3_event: event (00000101): Reset [U0]
irq/79-dwc3-1697 [000] D… 201.083816: dwc3_event: event (00000201): Connection Done [U0]
irq/79-dwc3-1697 [000] D… 201.088973: dwc3_event: event (00000101): Reset [U0]
irq/79-dwc3-1697 [000] D… 201.093340: dwc3_event: event (00000201): Connection Done [U0]
Performing the exact same procedure on a Rock 5A yields:
radxa@rock-5a:~$ sudo cat /sys/kernel/tracing/trace_pipe | egrep “Disconnect|Reset|Connection Done|Suspend|WakeUp”
irq/68-dwc3-1384 [000] D… 60.091399: dwc3_event: event (00000001): Disconnect: [U0]
irq/68-dwc3-1384 [000] D… 63.909461: dwc3_event: event (00000101): Reset [U0]
irq/68-dwc3-1384 [000] D… 63.913747: dwc3_event: event (00000201): Connection Done [U0]
irq/68-dwc3-1384 [000] D… 68.487150: dwc3_event: event (00000001): Disconnect: [U0]
irq/68-dwc3-1384 [000] D… 71.177394: dwc3_event: event (00000101): Reset [U0]
irq/68-dwc3-1384 [000] D… 71.181697: dwc3_event: event (00000201): Connection Done [U0]
irq/68-dwc3-1384 [000] D… 77.222313: dwc3_event: event (00000001): Disconnect: [U0]
irq/68-dwc3-1384 [000] D… 80.301649: dwc3_event: event (00000101): Reset [U0]
irq/68-dwc3-1384 [000] D… 80.305948: dwc3_event: event (00000201): Connection Done [U0]
irq/68-dwc3-1384 [000] D… 100.347759: dwc3_event: event (00000101): Reset [U0]
irq/68-dwc3-1384 [000] D… 100.348947: dwc3_event: event (00000201): Connection Done [U0]
As shown, on the 5B+ the Disconnect events are missing (during three cable removals, only two Suspend events occurred, which shouldn’t happen), and this directly impacts gadget driver functionality.
Hi @RadxaYuntian!
Thanks for keeping this topic active. Is there anyone on your team who could check whether this issue also exists on the Rock 5T? This is critical for our project, as we require USB 3 in peripheral mode to function flawlessly. If the issue is not present on the 5T, it would be a suitable alternative for us, but before ordering, I’d like to be sure.
It’s important to note that I intend to use the Type-A port in peripheral mode, because with the Type-C port, the speed in peripheral mode depends on the cable orientation, it can result in either HighSpeed or SuperSpeed . This was discussed previously in another topic (CM5 USB and touchscreen issues) but hasn’t been resolved yet. With the Type-A port, this speed issue doesn’t exist since the cable can only be inserted one way.
I’ll test it on ROCK 5T.
The ROCK 5T USB Type A port can only be used as a host.
Thanks for checking! I had assumed the 5T was the successor to the 5B+ and inherited its key specifications. I previously reviewed the 5T’s spec sheet, but for some reason I was under the impression that it also featured dual OTG like the 5B+. Unfortunately, that makes the 5T no longer a candidate for us.
Were you able to reproduce the missing USB disconnect event on the 5B+?
reproduced on ROCK 5B+.
Hi @Nasca!
I made the changes in the DTB, and it looks like they worked — USB Disconnect events are now detected correctly. When I unplug the cable, the current_speed
changes to UNKNOWN
, as it should.
I ran multiple plug/unplug tests in a row and noticed that the USB speed isn’t always SuperSpeed
— in fact, most of the time it’s not. Below I’m showing 4 screenshots, each displaying the USB connection event along with the corresponding current_speed
value. If you trace each one back to the last Disconnect event, you’ll see a pattern: when there are multiple consecutive Reset events (e.g. Reset -> Reset -> Connection Done -> Reset -> Reset...
), the speed is not SuperSpeed
(1st, 2nd, and 4th screenshots). When there’s only a single Reset before a Connection Done
(e.g. Reset -> Connection Done -> Reset -> Connection Done...
), that’s when the speed is SuperSpeed
(as seen in the 3rd screenshot).
I repeated the test many times and this behavior is consistent.
Also, the 4th screenshot shows several quick consecutive Suspend
and WakeUp
events — I don’t think this affects the speed, but it’s interesting and I’m not sure why it happens.
Do you have any idea what might cause these inconsistent speed negotiations? Why does it fail to establish SuperSpeed
every time?
Screenshot 1:
Screenshot 2:
Screenshot 3:
Screenshot 4:
I’ll reproduce and try to fix it.
it’s always high-speed on my end, I test it on ROCK 5B+
Thanks for checking! I’ve also run into another issue (which might be related to what I described in my previous post), where after several USB cable disconnects and reconnects, the kernel or at least parts of it, appeared to freeze. Unplugging and replugging the USB cable no longer triggered any events, or at least nothing was printed to the console.
When I tried to get the kernel log using sudo dmesg
or list the processes with ps aux
, neither command produced any output just a blinking cursor that I could interrupt with Ctrl+C. SSH access also stopped working. Meanwhile, the heartbeat LED started blinking faster and faster, indicating that the system was under some kind of load. However, the 5B+ could still be shut down using a long press of the power button. I managed to reproduce this freeze 3 times within a short period.
Once I was able to retrieve the kernel log before the system completely hung. It shows that the issue originated in the mass storage gadget driver, and the last log entry seems to point to a potential power supply or memory-related issue.
Have you encountered this kind of behavior before?
Here’s the kernel log:
usb_kernel_error.zip (11.1 KB)
Here’s the power supply I’m using:
and when I unplug the usb cable, the value /sys/class/udc/fc400000.usb/current_speed is UNKNOWN
Good behavior is when current_speed
switches to UNKNOWN
after unplugging the USB cable, this is triggered by the disconnect event.
Has this problem been reproduced in other adapters?
Hi @Nasca!
It turned out that there is interference in the electrical network as well, causing strange anomalies. I checked in another location with a different power adapter, and the freeze still occurred, although much less frequently. So let’s set this issue aside for now.
However, the speed issue still occurs every time. What I found out is that my desktop Intel NUC has both an ASMedia and an Intel host controller. The lower speeds (full-speed and high-speed) seem to occur only when the 5B+ is connected to the USB ports controlled by the ASMedia controller.
On the other hand, if I connect a USB flash drive to these ports, it never switches to the lower speeds, it always works at SuperSpeed.
How can I find out what is causing this speed issue with the 5B+? Could you take a look at this?