This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: Problem with g_serial on AM5728

Part Number: AM5728


Tool/software: Linux

Linux experts,

We have a customer with the following problem, while working on the AM5728 EVM:

I was having trouble getting the USB port (acting as a device) to work (the /dev/ttyGS0 device not was being created and when I attach the USB port to a Windows PC, the PC did not auto create a COM port device.  I finally determined that I needed to load the g_serial module.  With the g_serial module loaded, the /dev/ttyGS0 device is now being created and  when attached to a Windows PC, a COM port is auto created.

I am now trying to statically link the gadget serial driver into the linux kernel but the USB in device mode doesn’t seem to work with this configuration. The /dev/ttyGS0 device is not created and attaching the USB port to a Windows PC does not auto create a COM port device.

Do you know which other drivers are needed to statically link the gadget serial driver into the linux kernel?

Additional observation:

when I tried to statically compile in support for gadget serial the other USB ports operating in host mode stopped working.

Any advice?


Thanks,

Darren

  • Hi Darren,

    Do you know which other drivers are needed to statically link the gadget serial driver into the linux kernel?


    They could navigate to drivers/usb/gadget/legacy and explore the Kconfig file. It defines the driver dependencies, i.e. for kernel 4.4.19 they are as follows:
    config USB_G_SERIAL
    tristate "Serial Gadget (with CDC ACM and CDC OBEX support)"
    depends on TTY
    select USB_U_SERIAL
    select USB_F_ACM
    select USB_F_SERIAL
    select USB_F_OBEX
    select USB_LIBCOMPOSITE
    help
    The Serial Gadget talks to the Linux-USB generic serial driver.
    This driver supports a CDC-ACM module option, which can be used
    to interoperate with MS-Windows hosts or with the Linux-USB
    "cdc-acm" driver.

    This driver also supports a CDC-OBEX option. You will need a
    user space OBEX server talking to /dev/ttyGS*, since the kernel
    itself doesn't implement the OBEX protocol.

    Say "y" to link the driver statically, or "m" to build a
    dynamically linked module called "g_serial".

    For more information, see Documentation/usb/gadget_serial.txt
    which includes instructions and a "driver info file" needed to
    make MS-Windows work with CDC ACM.

    Best Regards,
    Yordan
  • Thank you Bin.

    Those instructions specify EVMs for DRA7, OMAP5, AM437x. Which should they select for AM5728-evm.

    And which USB peripheral controller should be configured in the kernel?

    Darren
  • Thanks Yordan.
    The customer tried this but the /dev/ttyGS0 does not get created. He also tried creating it manually (after boot was complete), and it didn't work either.

    When he enables the option to statically link, the USB host stops working on the other USB ports too.
  • Darren,

    AM57x uses the same USB IP family as that in DRA7, OMAP5 and AM437x, so the wiki I pointed is applicable to AM57x too.

    DWC3 (DesignWare USB3 DRD Core) is the UDC.

    If you provide the customer's .config (/proc/config.gz), I can help to check if the kernel config has any problem.
  • Darren,

    Thanks for sending me the config.gz, it mostly correct, but I confirmed it doesn't make g_serial work when built-in.

    After some investigation, it seems that built-in any usb gadget driver on am57x is not supported in kernel up to v4.4. The gadget driver doesn't associate to the dwc3 udc.

    I also confirmed this issue seems to be fixed in community v4.9 kernel, which is the version TI will be migrating to in 2017 Processor SDK.

    Do you know the reason why the customer wants to build in g_serial instead of as a module?

  • Bin,

    Here is the explanation from the customer:

    We have been developing linux based embedded products for many years now and our policy is to statically link any required drivers unless we need to pass in parameters to change their behaviour at kernel load time.

    Our new product needs to use several USB ports in host mode and 1 USB port in gadget mode.

    Is there is workaround for the 4.4.32 kernel?

    When is the 4.9 kernel 2017 SDK expected to be released by TI.

    Can you send a config file to be used with the 4.9 kernel to statically link support for USB host and gadget mode?

    Thanks,

    Darren

  • Darren,

    Is there is workaround for the 4.4.32 kernel?

    Build the usb related drivers as module, then add the following file in the filesystem, modprobe will automatically load g_serial.ko.

        $ cat /etc/modules-load.d/gserial.conf
        g_serial
    

    When is the 4.9 kernel 2017 SDK expected to be released by TI.

    The first v4.9 kernel based SDK will be released at this summer time.

    Can you send a config file to be used with the 4.9 kernel to statically link support for USB host and gadget mode?

    7610._am57x-config.v4.9-g_serial-builtin.txt

    The customer's .config is almost right, the only thing missing is to build in xHCI drivers and configure DWC3 to dual-role mode instead of gadget-only.