ReTerminal USB OTG

Hi,

I’m trying to get USB OTG to work on the USB C port of ReTerminal and haven’t had any success yet - if someone can point out additional configuration changes needed to get the g_mass_storage gadget to work that would be much appreciated.

Background

I’ve had a lot of success using OTG and g_mass_storage gadget on the Pi Zero 2 W so I’m using that as the basis for my configuration on the ReTerminal.

ReTerminal Configuration

I’m using the default Raspbian that shipped with the ReTerminal, no modifications:

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.17-v7l+ #1421 SMP Thu May 27 14:00:13 BST 2021 armv7l GNU/Linux

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
...

I updated /boot/config.txt and removed dr_mode=host from the dtoverlay=dwc2 line:

pi@raspberrypi:~ $ cat /boot/config.txt | grep dwc2
dtoverlay=dwc2

Supposedly, according to this post dtoverlay=dwc2 is the only thing needed for Raspbian. For completeness I also tried dr_mode=peripheral and dr_mode=otg. Both yielded the same result.

Gadget configuration

I initialize the g_mass_storage gadget in the following manner. This is the same way I bring up the gadget on the Pi Zero 2 W (my working reference).

sudo modprobe g_mass_storage stall=0 file=storage.img removable=1 iSerialNumber=123456

Output from dmesg:

[ 1994.068799] LUN: removable file: (no medium)
[ 1994.068965] LUN: removable file: /home/pi/dev/otg-scripts/storage.img
[ 1994.068982] Number of LUNs=1
[ 1994.069269] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[ 1994.069290] g_mass_storage gadget: g_mass_storage ready
[ 1994.069436] dwc2 fe980000.usb: bound driver g_mass_storage

The result is that the host never sees the USB storage device.

For comparison, the working reference on the Pi Zero 2 W (using the same exact steps above), produce the following dmesg output:

[ 5632.598049] Mass Storage Function, version: 2009/09/11
[ 5632.598086] LUN: removable file: (no medium)
[ 5632.598317] LUN: removable file: /home/pi/dev/otg-scripts/storage.img
[ 5632.598339] Number of LUNs=1
[ 5632.598704] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[ 5632.598730] g_mass_storage gadget: g_mass_storage ready
[ 5632.598756] dwc2 20980000.usb: bound driver g_mass_storage
[ 5632.833746] dwc2 20980000.usb: new device is high-speed
[ 5632.962039] dwc2 20980000.usb: new device is high-speed
[ 5633.034773] dwc2 20980000.usb: new address 27

Things I’ve Tried

  1. I’ve tried recompiling the kernel (using the original shipped kernel’s configuration as the base configuration) and setting
  • CONFIG_USB_OTG=y
  • CONFIG_DWC2_PERIPHERAL=y
    • along with CONFIG_DWC2_DUAL_ROLE=n to force peripheral mode
  1. I’ve studied the schematics and found the following:

reterminal-block

Question for Seeed

Is there some other configuration switch needed to enable OTG on the USB C port?

Any update? I’m trying to get USB OTG to work too
I tried to add modules-load=dwc2 in /boot/cmdline.txt but with no success

I also am curious about this, did either of you have any luck or response on this?

@mr414 where you able to solve this?

I’m not quite clear about your meaning. Are you unable to use USB-C for the flashing process? Because the flashing process can also involve data transmission.

@Seeed_Seraphina I want to be able to set a usb a an host otg?