How to create an USB 2.0 / USB 3.0 ADB Gadget

This document demonstrates how to create an USB 2.0 / USB 3.0 ADB gadget on SP7350 platforms.

 

Table of Contents

Compiling code for Buildroot root file-system

Please refer to https://sunplus.atlassian.net/wiki/x/1gB-dg to download the source code. Use the following command to set up the compilation environment. In “Select rootfs“, “5“ should be selected for Buildroot root file-system.

# make config

 

image-20240806-022759.png

 

adbd utility for the target

Use the following command to enter Buildroot Configuration and select submenus for the adbd utility for the target : Target Packages > System tools. Select [*] for “android-tools” (it selects “adbd” by default).

# make bconfig

 

image-20240806-032119.png

 

kernel Setup

Enter the kernel configuration by running the following command in the top directory of project.

# make kconfig

 

  1. Select submenus for USB 2.0 controller : Device Drivers > USB support > USB Gadget Support > USB Peripheral Controller. Select <*> for “Sunplus USB 2.0 Device Controller“.

 

  1. Select submenus for USB OTG Transceive driver : Device Drivers > USB support > USB Physical Layer drivers. Select <*> for “Sunplus USB OTG Transceive driver“.

 

  1. Select submenus for USB 3.0 controller : Device Drivers > USB support. Select <*> for “DesignWare USB3 DRD Core Support“ and select “Dual Role mode“ for “Deware USB3 DRD Core Support“.

 

  1. Select submenus for USB Gadget configfs : Device Drivers > USB support > USB Gadget Support. Select <M> for “USB Gadget functions configurable through configfs“ and [*] for “Function filesystem (FunctionFS)“.

 

  1. Execute the make command to build the Linux image.

 

ConfigFS

Configure the adb gadget through configfs saved as a file named setup_adb.

 

Implementation

After updating the image to the SP7350 platform and booting the system, use sh setup_adb command to configure USB 2.0 or USB 3.0 as an adb device.

 

After connecting the adb gadget to a Windows PC through an USB cable, “FunctionFS gadget (adb)”will show up in “Universal Serial Bus devices” of “Device Manager”.

 

Download the “Minimal ADB and Fastboot” application and install it on your Windows computer. After the installation, open the Windows Command Prompt. After issuing the command of “adb devices”, you will see a device (ADB gadget).

 

Re-connection

If the ADB gadget re-connects to the Windows pc after disconnection, the following command should be issued after the re-connection.