Achieving Device Communication via USB Virtual NIC on OK3588 (Linux 5.10.66 + Buildroot)
In embedded system debugging, device interconnection, and system integration, a stable, low-cost, and easily deployable communication method is crucial. On the Rockchip OK3588 platform (Linux 5.10.66 + Buildroot), a solution has been implemented that enables device-to-device communication through a USB NIC, allowing fast point-to-point network connections without requiring additional Ethernet ports or switching equipment.
Solution Overview
This solution leverages the Linux USB Gadget mechanism, allowing the board to automatically create a virtual NIC (usb0) in either USB Host or Device mode. By combining USB physical connectivity with network-protocol communication, it supports:
- TCP/IP communication between devices
- Rapid debugging / remote maintenance
- System integration / functional validation
- Cross-platform collaboration (OK3588 + RK3562)
1. Source Code Modification
RK3562: In addition to the article's configurations, the following should be added:
OK3588: No device-tree changes are needed. Simply enable the same options in menuconfig.
2. Commands
Master-slave mode switching command of #3562usb interface cat /sys/kernel/debug/usb/fe500000.usb/mode echo host > /sys/kernel/debug/usb/fe500000.usb/mode echo device > /sys/kernel/debug/usb/fe500000.usb/mode Master-slave mode switching command of #3588typec0 interface cat /sys/kernel/debug/usb/fc000000.usb/mode Master-slave mode switching command of #3588typec1 interface cat /sys/kernel/debug/usb/fc400000.usb/mode
Use the above commands to view the current USB mode (host/device).
In device mode, a virtual NIC usb0 is generated for recognition by host devices.
In host mode, the USB interface detects the virtual NIC of another board and creates a usb0 node for communication.
Note: Communication requires one device in host mode and the other in device mode.
Switch with the above two commands
OK3588 has two Type-C ports: typec0 and typec1. typec0 operates in Device mode only, while typec1 operates in Host mode only. When switching modes, be mindful of hardware connections.
typec0 address: sys/kernel/debug/usb/fc000000.usb/mode
typec1 address: sys/kernel/debug/usb/fc400000.usb/mode
3. Testing Steps
3.1 OK3588 as Host, RK3562 as Device:
Usb0 is the node generated by typec0 as the device, and usb1 is the node detected by typec1 connected to 3562. Therefore, in this test, usb1 is selected for the ping connectivity test.
On 3588:
On 3562:
3.2 OK3588 as Device, RK3562 as Host
On 3588:
On 3562:
The USB virtual network card communication product solution is designed with a focus on simplicity, stability, and low cost. It provides an efficient method for device interconnection on the OK3588 platform. It serves not only as a debugging tool but also as a standardized communication capability ready for product integration, helping customers quickly build reliable embedded network systems.




