Accessing USB0 on a Colibri Board from a Linux or Windows Laptop

Hi,

one of our clients has given us a colibri board to perform some tests.

One of his requirements is, that we should configure a second access to the board, beside the network connection on eth0.
Since there is a network interface usb0 with an assigned ip address, we tried to access it.
But although we have now read a lot about RNDIS and usb tethering, neither the Linux (Ubuntu 16.04 664bit) Laptop, nor the Windows 7 one reacts on a USB connection to the board.

Do we have to activate some additional service on the board, to initiate the connection?

Some information about the installed OS:

Linux 0000201E 4.1.15-v2.5b3+ge6d111c #1 Tue Feb 16 14:55:43 CET 2016 armv7l GNU/Linux

Thanks for any suggestions and hints,

Stefan

I tried reproducing the issue here with a Linux machine but the 2.5 Beta 3 image works correctly here with my Arch Linux setup.

root@colibri-vf:~# cat /etc/issue
.---O---.                                           
|       |                  .-.           o o        
|   |   |-----.-----.-----.| |   .----..-----.-----.
|       |     | __  |  ---'| '--.|  .-'|     |     |
|   |   |  |  |     |---  ||  --'|  |  |  '  | | | |
'---'---'--'--'--.  |-----''----''--'  '-----'-'-'-'
                -'  |
                '---'

The Angstrom Distribution \n \l

Angstrom v2015.06 - Kernel \r

Colibri_VF_LinuxImageV2.5_20151215

root@colibri-vf:~# uname -a
Linux colibri-vf 4.1.15-v2.5b3+ge6d111c #1 Tue Dec 15 16:32:48 CET 2015 armv7l GNU/Linux

I can ping the usb0 interface on Vybrid from host Linux machine and vice versa. What carrier board do you use and how exactly is the connection? I tested with a Colibri Evaluation Board v3.2.

For it to work with Windows 7, can you modify the /etc/usbg/g1.schema to not include the USB serial class functionality?

root@colibri-vf:~# cat /etc/usbg/g1.schema 
attrs : 
{
    bcdUSB = 0x0;
    bDeviceClass = 0x0;
    bDeviceSubClass = 0x0;
    bDeviceProtocol = 0x0;
    bMaxPacketSize0 = 0x40;
    idVendor = 0x1d6b;
    idProduct = 0x0104;
    bcdDevice = 0x400;
};
strings = ( 
    {
        lang = 0x409;
        manufacturer = "Toradex";
        product = "Unknown";
        serialnumber = "";
    } );
functions : 
{
     rndis_0 : 
    {
        instance = "0";
        type = "rndis";
        attrs : 
        {
            dev_addr = "00:14:2d:ff:ff:ff";
            host_addr = "00:14:2d:ff:ff:fe";
            qmult = 5;
        };
    };
};
configs = ( 
    {
        id = 1;
        name = "c";
        attrs : 
        {
            bmAttributes = 0x80;
            bMaxPower = 0x2;
        };
        strings = ( 
            {
                lang = 0x409;
                configuration = "Conf 1";
            } );
        functions = ( 
            {
                name = "rndis.0";
                function = "rndis_0";
            } );
    } );

You should have an output like above instead of default one.

Windows seems to get confused due to our default configuration of exporting both USB serial and rndis configuration in usb gadget schema. Also make sure that usbg systemd service is correctly running.

root@colibri-vf:~# systemctl status usbg
â● usbg. service - Load default USB gadget schema g1.schema
   Loaded: loaded (/lib/systemd/system/usbg.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Thu 2016-09-29 07:41:02 UTC; 7min ago
  Process: 288 ExecStartPost=/bin/sh -c /bin/echo `ls /sys/class/udc/` >                                      /sys/kernel/o
nfig/usb_gadget/g1/UDC (code=exited, status=0/SUCCESS)
  Process: 279 ExecStartPost=/bin/sh -c /bin/cat /proc/device-tree/serial-number >                                     /sys
/kernel/config/usb_gadget/g1/strings/0x409/serialnumber (code=exited, status=0/SUCCESS)
  Process: 266 ExecStartPost=/bin/sh -c /bin/cat /proc/device-tree/model >                                     /sys/kernel/
config/usb_gadget/g1/strings/0x409/product (code=exited, status=0/SUCCESS)
  Process: 223 ExecStart=/usr/bin/gadget-import g1 /etc/usbg/g1.schema (code=exited, status=0/SUCCESS)
 Main PID: 223 (code=exited, status=0/SUCCESS)

Sep 29 07:41:00 colibri-vf systemd[1]: Starting Load default USB gadget schema g1.schema...
Sep 29 07:41:02 colibri-vf systemd[1]: Started Load default USB gadget schema g1.schema.

I have now received a second device, but still no access to usb0.

Here are the details of this second device:

The board is a Viola Ver. 1.1

oot@00001FE0:~# cat /etc/issue
.---O---.                                           
|       |                  .-.           o o        
|   |   |-----.-----.-----.| |   .----..-----.-----.
|       |     | __  |  ---'| '--.|  .-'|     |     |
|   |   |  |  |     |---  ||  --'|  |  |  '  | | | |
'---'---'--'--'--.  |-----''----''--'  '-----'-'-'-'
                -'  |
                '---'

The Angstrom Distribution \n \l

Angstrom v2015.12 - Kernel \r

Colibri_VF_LinuxConsoleImageV2.6_20160630


root@00001FE0:~# cat /etc/usbg/g1.schema 
attrs : 
{
    bcdUSB = 0x0;
    bDeviceClass = 0x0;
    bDeviceSubClass = 0x0;
    bDeviceProtocol = 0x0;
    bMaxPacketSize0 = 0x40;
    idVendor = 0x1d6b;
    idProduct = 0x0104;
    bcdDevice = 0x400;
};
strings = ( 
    {
        lang = 0x409;
        manufacturer = "Toradex";
        product = "Unknown";
        serialnumber = "";
    } );
functions : 
{
    acm_GS0 : 
    {
        instance = "GS0";
        type = "acm";
        attrs : 
        {
            port_num = 0;
        };
    };
    rndis_0 : 
    {
        instance = "0";
        type = "rndis";
        attrs : 
        {
            dev_addr = "00:14:2d:ff:ff:ff";
            host_addr = "00:14:2d:ff:ff:fe";
            qmult = 5;
        };
    };
};

configs = ( 
    {
        id = 1;
        name = "c";
        attrs : 
        {
            bmAttributes = 0x80;
            bMaxPower = 0x2;
        };
        strings = ( 
            {
                lang = 0x409;
                configuration = "Conf 1";
            } );
        functions = ( 
            {
                name = "acm.GS0";
                function = "acm_GS0";
            }, 
            {
                name = "rndis.0";
                function = "rndis_0";
            } );
    } );

root@00001FE0:~# systemctl status usbg
● usbg.service - Load default USB gadget schema g1.schema
   Loaded: loaded (/lib/systemd/system/usbg.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2016-09-28 11:27:35 CEST; 2 days ago
  Process: 318 ExecStartPost=/bin/sh -c /bin/echo `ls /sys/class/udc/` >                                      /sys/kernel/config/usb_gadget/g1/UDC (code=exited, status=0/SUCCESS)
  Process: 314 ExecStartPost=/bin/sh -c /bin/cat /proc/device-tree/serial-number >                                     /sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber (code=exited, status=0/SUCCESS)
  Process: 304 ExecStartPost=/bin/sh -c /bin/cat /proc/device-tree/model >                                     /sys/kernel/config/usb_gadget/g1/strings/0x409/product (code=exited, status=0/SUCCESS)
  Process: 285 ExecStart=/usr/bin/gadget-import g1 /etc/usbg/g1.schema (code=exited, status=0/SUCCESS)
 Main PID: 285 (code=exited, status=0/SUCCESS)

Sep 28 11:27:33 00001FE0 systemd[1]: Starting Load default USB gadget schema g1.schema...
Sep 28 11:27:35 00001FE0 systemd[1]: Started Load default USB gadget schema g1.schema.

When I connect this device to my Ubuntu laptop, nothing happens, dmesg doesn’t contain any message about a new usb connection.
But usb is working - when I connect my iphone, the system loads the modules ipeth and there are number of lines about usb in dmesg

I have removed the two section dealing with acm_GSO, so that /etc/usbg/g1.schema looks like the one sanchyan.tx posted, but still no reaction on windows or ubuntu.
And I guess a double male usb cable is the only way to connect the board and the laptop.
The cable seems to be okay, because it provides power to the boards, when I remove the power supply.

[Edit]
I just removed the extension board and now I can see that there is a Colibri VF50 V1.2A on top of the Viola. I already checked the relevant pages on USB in http://docs.toradex.com/101355-colibri-vf50-datasheet.pdf , but since I’m not a developper, I’m even more confused.

Thanks for your help,

Stefan

On a Ubuntu Laptop dmesg should definitely show something. There must be something wrong with cabeling/carrier board. Can you answer @sanchayan.tx 's question below?

Note that for the USB port in question we implement OTG functionality which relies on the state of SODIMM 137 pin. Please check Page 5 of Viola schematics. For Viola, this pin is by default connected to ground. Considering this, it would be configured in host mode, which is also stated in the Viola datasheet. Can you check if host mode works? If a permanent client functionality is required, this can be configured in device tree or the SODIMM 137 pin state should be fixed accordingly. Note that the change to the schema is only required for connection with a Windows host.