Project Overview
Background In a custom project based on the Rockchip RK3568, the objective was to re-evaluate the on-board USB interfaces using the public SDK and resolve an issue where the on-board USB 3.0 OTG (Type-A) port could not correctly recognize U-disks and other Host-mode devices under the default BSP configuration.
My Role and Contributions: As the BSP engineer for the project, I was solely responsible for diagnosing and resolving this USB functionality issue. My core contributions include:
- Executed a systematic troubleshooting process, covering everything from hardware schematic verification, functional validation, and fault analysis to kernel Device Tree (DTS) code development, debugging,
sysfsruntime state analysis, and performance baseline testing. - Led and implemented the solution: Verified the operation of two USB-A ports and one USB-C port against the product’s hardware schematics. The final solution was established by modifying the Device Tree (DTS): forcibly changing the
dr_modeof theusbdrd_dwc3controller from"otg"to"host". - Pinpointed the root cause: The ID pin of the OTG port was not present in the current hardware design, which prevented the controller from automatically detecting plug-in events and switching between Host/Device modes.
- Completed full performance and functional validation, ensuring that the modified port not only reliably recognized devices but also achieved data transfer speeds compliant with the USB 3.0 standard.
- Documented the entire debugging process and technical analysis into a detailed technical report, providing a clear reference for similar issues in the future.
My Methodology: Embedded Peripheral Debugging Workflow
This debugging effort followed a standardized diagnostic workflow, moving from the surface level to the core and from software to hardware:
Documentation and Circuit Functional Analysis:
- Studied the RK3568 Technical Reference Manual (TRM) to understand its USB subsystem architecture (including 2x USB 3.0 controllers, OHCI/EHCI controllers, Combo PHY, etc.).
- Cross-referenced the hardware schematics to confirm the physical connections of the OTG port, paying special attention to the ID and VBUS pins.
- Mapped out the data flow paths for the two USB-A ports and one USB-C port.
Device Tree (DTS) & Driver Mapping:
- Conducted an in-depth analysis of chip-level device tree files like
rk3568.dtsito map the configurations and relationships between core nodes such asusbdrd30(OTG),usbhost30(Host), andusb2phy. - Clarified the
physproperty references between controllers and PHYs, summarizing the findings in a table.
- Conducted an in-depth analysis of chip-level device tree files like
Runtime State Diagnosis:
- Utilized the
extconinterface insysfs(/sys/class/extcon/extcon0) to check the kernel’s real-time perception of the OTG port state (USB-HOST=0), which confirmed the hypothesis that it was not entering Host mode. - Revisited the hardware schematics to study the plug-in detection principles for USB-A, mini-USB, micro-USB, and Type-C interfaces to find a solution.
- Utilized the
Solution Implementation & Verification:
- In the board-level DTS file, created an overlay node for
&usbdrd_dwc3and forcibly set itsdr_modeproperty to"host". - Recompiled and flashed the firmware, then re-verified the fix by testing with
hdparm. - With the SoC’s USB port acting as a host, it rejects connections from any other host-mode devices and supplies power. Therefore, firmware upgrades (a typical device-mode application) were re-routed to be triggered by an external button press to enter Maskrom mode.
- After the system successfully boots, the USB-A port functions as a standard host port.
- In the board-level DTS file, created an overlay node for
Technical Summarization and Documentation:
- Carefully documented the Hardware Dataflow Pipeline, which was finalized at the project’s conclusion.
- Updated the Notes on DTS (Device Tree) Debugging.
Project Outcomes
- Functionality Restored: The OTG port can now reliably recognize U-disks and other USB host devices.
- Performance Goals Met: After the fix, tests using
hdparm -t /dev/sdashowed the port’s read speed restored to ~48MB/s, in line with the USB 3.0 standard. - Solution Hardened: The final DTS modification was merged into the product’s codebase, becoming the standard configuration for this hardware.
- Knowledge Capitalized: The complete debugging process, code analysis, and related materials were organized and archived.
Tech Stack & Tools
- Hardware Platform: Rockchip RK3568 SoC
- Software Environment: Linux Kernel 5.10, Buildroot
- Core Technologies: Device Tree (DTS), USB 2.0/3.0 Subsystem, OTG, XHCI/EHCI/OHCI, Kernel
extconFramework - Debugging Tools:
hdparm,sysfs,dmesg, Serial Console