This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
products:sbc:vim3:configurations:usb-gadget [2022/07/06 23:28] frank created |
products:sbc:vim3:configurations:usb-gadget [2025/08/13 03:55] (current) nick |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== USB Gadget ====== | + | ====== |
| ===== Introduction ===== | ===== Introduction ===== | ||
| This document mainly introduces USB gadget. You will learn how to configure and enable USB gadget Usage. | This document mainly introduces USB gadget. You will learn how to configure and enable USB gadget Usage. | ||
| + | |||
| + | <WRAP important > | ||
| + | From version **1.7.5**, USB gadget is enabled by default, no need any setup, you can just skip the overlay and service setup. | ||
| + | </ | ||
| ===== System Configuration ===== | ===== System Configuration ===== | ||
| Line 12: | Line 16: | ||
| ==== Configure DTS Overlays ==== | ==== Configure DTS Overlays ==== | ||
| + | |||
| + | <tabbox VIM3/3L with 4.9 kernel> | ||
| + | |||
| + | Take VIM3 as an example. | ||
| Open ''/ | Open ''/ | ||
| - | ```sh | + | ```shell |
| - | khadas@khadas: | + | sudo vim / |
| ``` | ``` | ||
| Line 24: | Line 32: | ||
| overlays=uart3 pwm_f i2c3 os08a10 --> overlays=uart3 pwm_f i2c3 os08a10 otg-device | overlays=uart3 pwm_f i2c3 os08a10 --> overlays=uart3 pwm_f i2c3 os08a10 otg-device | ||
| ``` | ``` | ||
| + | |||
| + | <WRAP important > | ||
| + | If you have issues, please try the extra steps below: | ||
| + | |||
| + | ```shell | ||
| + | wget https:// | ||
| + | sudo cp / | ||
| + | ``` | ||
| + | </ | ||
| + | |||
| + | <tabbox VIM3/3L with 5.15 kernel> | ||
| + | |||
| + | Take VIM3 as an example. | ||
| + | |||
| + | Open ''/ | ||
| + | |||
| + | ```shell | ||
| + | sudo vim / | ||
| + | ``` | ||
| + | |||
| + | Add '' | ||
| + | |||
| + | ``` | ||
| + | fdt_overlays=otg-device | ||
| + | ``` | ||
| + | |||
| + | </ | ||
| ==== Enable Service ==== | ==== Enable Service ==== | ||
| - | ```sh | + | ```shell |
| - | khadas@khadas: | + | sudo systemctl enable usb-gadget-khadas.service |
| ``` | ``` | ||
| Reboot to effect. | Reboot to effect. | ||
| - | ```sh | + | ```shell |
| - | khadas@khadas: | + | sync |
| - | khadas@khadas: | + | sudo reboot |
| ``` | ``` | ||
| + | ===== RNDIS Setup IP Address ===== | ||
| + | |||
| + | Setup IP address manyally, e.g. setup IP address as '' | ||
| + | |||
| + | ```shell | ||
| + | sudo ifconfig usb0 192.168.35.100 up | ||
| + | ``` | ||
| + | |||
| + | Also need to setup the IP address on your PC, e.g. '' | ||
| + | |||
| + | Check network connection: | ||
| + | |||
| + | ```shell | ||
| + | khadas@Khadas: | ||
| + | PING 192.168.35.1 (192.168.35.1) from 192.168.35.100 usb0: 56(84) bytes of data. | ||
| + | 64 bytes from 192.168.35.110: | ||
| + | 64 bytes from 192.168.35.110: | ||
| + | ``` | ||
| + | |||
| + | ===== Usage of ADB ===== | ||
| + | |||
| + | Try to access the devices via adb. | ||
| + | |||
| + | ```shell | ||
| + | $ adb kill-server | ||
| + | $ adb devices | ||
| + | * daemon not running; starting now at tcp:5037 | ||
| + | * daemon started successfully | ||
| + | List of devices attached | ||
| + | 363233573350 | ||
| + | |||
| + | $ adb shell | ||
| + | root@Khadas:/# | ||
| + | root@Khadas:/# | ||
| + | root@Khadas:/# | ||
| + | root@Khadas:/# | ||
| + | root@Khadas:/# | ||
| + | bin dtb.img | ||
| + | bin.usr-is-merged | ||
| + | boot | ||
| + | dev Image | ||
| + | dtb initrd.img | ||
| + | ``` | ||
| + | |||
| + | ===== Troubleshooting ===== | ||
| + | |||
| + | If adb not work on windows, you can edit ''/ | ||
| + | |||
| + | ```diff | ||
| + | diff --git a/ | ||
| + | index 520a9b9a..299569f0 100755 | ||
| + | --- a/ | ||
| + | +++ b/ | ||
| + | @@ -57,7 +57,7 @@ echo " | ||
| + | echo " | ||
| + | |||
| + | # Bind function to configuration | ||
| + | -ln -s $F_RNDIS $GADGET/ | ||
| + | +#ln -s $F_RNDIS $GADGET/ | ||
| + | ln -s $GADGET/ | ||
| + | |||
| + | # Enable the Gadget | ||
| + | ``` | ||