OTG on Linux on UP Squared EDGE

paurea
paurea New Member Posts: 1

We have just bought (this is April 2025) three UP^2 EDGE from mouser, which has a CPU:

Intel(R) Atom(TM) Processor E3950 @ 1.60GHz

It has the latest BIOS you have on the webpage I have updated it in one of the machines, without any change.

We bought them because of the advertised USB OTG 3.0, which we have not been able to make work (at all, in any way,
not even 2.0).
We want to see how fast it is for an application (and maybe buying more of them in the future).

I have tried it with different distros/kernels to no avail:

I am using a 3.1 USB A- Micro-B 10 pin cable like the one in the photo of the wiki
(I have tried just in case with the standard A on the other side of the corner
of the board, but it does not seem to work either).

############### Ubuntu 18.0.4

The machines came with an Ubuntu 18.0.4 LTS, with a kernel:

uname -a
Linux UP-APL01 5.0.0.1-generic #2~upboard5-Ubuntu SMP Wed Apr 8 06:17:43 UTC 2020 x86_64 x86_64 GNU/Linux

I tried following the wiki description to use the mass storage (the file /tmp/image.img contains a valid file which I can
mount on the loop device):

modprobe g_mass_storage file=/tmp/image.img stall=0

dmesg reports that it works

[ 2678.210295] Mass Storage Function, version: 2009/09/11
[ 2678.210309] LUN: removable file: (no medium)
[ 2678.210393] LUN: removable file: /tmp/image.img
[ 2678.210397] Number of LUNs=1
[ 2678.210709] g_mass_storage gadget.0: Mass Storage Gadget, version: 2009/09/11
[ 2678.210724] g_mass_storage gadget.0: userspace failed to provide iSerialNumber
[ 2678.210726] g_mass_storage gadget.0: g_mass_storage ready

the port powers the UP and seems to be in device mode:

cat /sys/kernel/debug/usb/dwc3.1.auto/mode
device
cat /sys/kernel/debug/usb/dwc3.1.auto/link_state
Compliance

On the host machine (I am running Linux too). I never see a new USB device appear (with dmesg, there is no
new message when plugging in the USB on either machine) or anything, it does not work.

I have tried also with a new Ubuntu:

############### Ubuntu 24.04.1

uname -a
Linux fastsoca 6.11.0-24-generic #24~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 25 20:14:34 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble

modprobe g_mass_storage file=/tmp/image.img stall=0

dmesg reports the same:

[ 2678.210295] Mass Storage Function, version: 2009/09/11
[ 2678.210309] LUN: removable file: (no medium)
[ 2678.210393] LUN: removable file: /tmp/image.img
[ 2678.210397] Number of LUNs=1
[ 2678.210709] g_mass_storage gadget.0: Mass Storage Gadget, version: 2009/09/11
[ 2678.210724] g_mass_storage gadget.0: userspace failed to provide iSerialNumber
[ 2678.210726] g_mass_storage gadget.0: g_mass_storage ready

I never see the device either.

(I also tried modprobe
g_mass_storage file=/tmp/image.img removable=y idVendor=0x0525 idProduct=0xa4a5
it did not work either).

I tried also with libcomposite, but didn't even see the LUN:

cd /sys/kernel/config/usb_gadget/
mkdir g1
cd g1
mkdir strings/0x409
echo "0x0525" > idVendor # Netchip Technology, Inc.
echo "0xa4a5" > idProduct # Linux-USB File-backed Storage Gadget
echo "0x0606" > bcdDevice # v1.0.0
echo "0x0300" > bcdUSB # USB 3.0

echo "1234567890" > strings/0x409/serialnumber
echo "me" > strings/0x409/manufacturer
echo "My USB Device" > strings/0x409/product

mkdir configs/c.1
mkdir configs/c.1/strings/0x409

echo "USB Mass Storage config" > configs/c.1/strings/0x409/configuration
echo 250 > configs/c.1/MaxPower

mkdir functions/mass_storage.usb0
mkdir -p functions/mass_storage.usb0/lun.0 2> /dev/null
echo setting medium 1>&2
echo -n "/tmp/image.img" > /sys/kernel/config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/file
echo 1 > /sys/kernel/config/usb_gadget/g1/functions/mass_storage.usb0/lun.0/removable
ln -s functions/mass_storage.usb0 configs/c.1
udc=$(ls /sys/class/udc|head -1)
echo $udc > UDC

This case is even worse,
dmesg reports that it does never see the file:

[ 1162.004495] nbd0: detected capacity change from 0 to 2097152
[ 1162.899689] Mass Storage Function, version: 2009/09/11
[ 1162.899703] LUN: removable file: (no medium)

I also tried it with an an Ubuntu (with g_mass_storage) 20.04 with similar results:

############### Ubuntu 20.04.6

Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
Linux ubuntu 5.15.0-67-generic #74~20.04.1-Ubuntu SMP Wed Feb 22 14:52:34 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

############### Yocto Image.

I also tried the Yocto image in your web page without any improvement:

Yocto_3.1_YC31D.IA01.UPN-APL01.0.zip

We bought the boards just to be able to use the USB OTG 3.0. Should we return them?
Is there any repeatable procedure (installing a kernel/distribution available right now in 2025) I can follow?

G.

Privacy Policy