Verdin USB RNDIS working with evaluation board only

Hi,
I am using a USB RNDIS usb gadget on my Verdin Mini for communication. I already had a topic about this Verdin USB OTG Slave
and everything seemed to work fine on Dahlia evaluation board. I am using the systemd service to automatically enable the usb-gadget on linux boot, which also works fine.

I tested the RNDIS before manually and it works on my custom board, but now I’m testing it for the first time with the systemd service and windows is not recognizin that device (different errors, either device descriptor failed or device not migrated).
I am using a micro-USB on my custom board, whereas the Dahlia board has a usb-c port.

So to recap:
On Dahlia with systemd auto start → works always

On custom board manual enable → worked always before, only once today, other times it failed

On custom board systemd auto start → doesn’t work

I also thought it had to do with the other peripherals of the dahlia board, like the ethernet connector that might be important for the network connection and the network aspect of the rndis, so I changed my systemd service file to wait for the network to be up but no luck. So my usb-function.service file now looks like this:

[Unit]
Wants=network-online.target
After=network.target network-online.target

[Service]
ExecStart=/usr/local/bin/usb-function.sh

[Install]
WantedBy=default.target

And my usb-function.sh file looks like this:

#!/bin/bash

echo "usb-function.sh running" > /tmp/usb-function.log
date >> /tmp/usb-function.log

sudo mount -t configfs none /sys/kernel/config

cd /sys/kernel/config/usb_gadget/

# Create gadget
mkdir g2

# Use Toradex vendor and product id
echo 0x1b67 > g2/idVendor
echo 0x400c > g2/idProduct

# English language strings...
mkdir g2/strings/0x409
cat /proc/device-tree/serial-number > g2/strings/0x409/serialnumber
echo "Toradex" > g2/strings/0x409/manufacturer
cat /proc/device-tree/model > g2/strings/0x409/product


mkdir g2/configs/c.1
mkdir g2/configs/c.1/strings/0x409
echo "USB RNDIS" > g2/configs/c.1/strings/0x409/configuration
mkdir g2/functions/rndis.usb0
ln -s g2/functions/rndis.usb0 g2/configs/c.1
echo "EF" > g2/functions/rndis.usb0/class
echo "04" > g2/functions/rndis.usb0/subclass
echo "01" > g2/functions/rndis.usb0/protocol

echo "ci_hdrc.0" > g2/UDC
ifconfig usb0 169.254.21.151 netmask 255.255.0.0 up

ifconfig usb0 >> /tmp/usb-function.log

I know the problem sounds complicated but I would appreciate any help! Thanks

Hi @swiss ,

Are you using the same version of TorizonCore as on the other community post?

Would it be possible that you share some of the errors that you’re seeing? Maybe also a dmesg log when it successfully is discovered by windows. Would be interesting to see if there’s any difference.

Best Regards
Kevin

Hello @swiss ,
Were you able to perform the tests described above by @kevin.tx ? Do you need more help on our side?

Best regards,
Josep