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.

Host crashes when creating multiple COM ports using USB gadget serial driver

Hi,

I am using embedded linux on TI AM335x board. The goal is to create a 4-port USB serial bridge and I am using USB gadget serial driver to create 4 virtual COM ports over USB.

I had no problem creating 1 virtual COM port using
modprobe g_serial

However the Windows host crashes when I tried to create multiple COM ports
modprobe g_serial n_ports=4

I have searched internet and saw no solution to this problem. Please let me know if you have any thoughts.

Thanks,
Jessie

  • Hi Jessie,

    This is most probably Windows related issue. Are you using a virtual machine inside windows? Please try this on a Linux host (no virtual machine).

    It would also be of use if you specify the board you are using and the version of the software (SDK/PSP).

    Best regards,
    Miroslav

  • Hi Miroslav,

    The board is running embedded linux but the host is Windows machine not Linux. So I don't think the problem is in the VMWare. The version of the software is ti-sdk-am335x-evm-05.06.00.00.

    Thanks a lot.

    Jessie

  • Hi Jessie,

    I'm sorry, but we can't debug Windows host crashes. You are running a Linux host inside a VMWare virtual machine inside a Windows host. There are just too many variables.

    Please try to provide logs from the target device at the moment of the Windows crash. What happens with the device at that particular moment?

    Best regards,
    Miroslav

  • Hi Jessie,

    I recommend you do some realistic load testing of g_serial before going too far.  I found some issues when sending large amounts of data.  The old thread is here:

    http://e2e.ti.com/support/arm/sitara_arm/f/791/p/215301/762270.aspx#762270

    Since then, there have been a lot of MUSB fixes in v3.2-staging, so it may be resolved.

    Regards,

       John

  • The crash happens during usb device enumeration, so load test is not applicable.

    I am able to replicate the crash on Win7 and WinXP with the latest v3.2-staging kernel (tag v3.2_AM335xPSP_04.06.00.10-rc3), when 'insmod g_serial.ko n_ports=2'. The crash is in the Windows USB serial class driver usbser.sys. The USB protocol trace tells the crash happens after the 'SET_CONFIGURATION' is complete, and the next should be usbser.sys to continue enumerate the USB device.

    Without any information of Windows usbser.sys driver, I would guess the issue is because usbser.sys does not support more than 1 serial device within a single USB device, and does not handle the case properly, and crashes the system due to invalid pointer or something.

  • Hi Bin,

    I changed g_multi and g_acm_ms source file to create multiple serial ports and load them using

    modprobe g_multi

    or

    modprobe g_acm_ms

    More than 1 serial ports were successfully created. I compared the source code of g_serial. It is essentially creating the serial ports in the same way but coded differently. I guess there are defects in g_serial code but I cannot tell how to fix it. I am going to write my own driver based on g_acm_ms.

  • Yeah, you probably have to write your own composite driver to implement the multi serial port feature, since 'most likely' the Windows serial class driver does not support multi ports in a single usb device.

    By the way, I don't think there is a detect in how g_serial supports multi ports. It is just that g_serial enables multi ports within a single usb function, and Windows driver does not support it (but usbser.sys should not crash the system though...). While the composite driver supports multi ports by implementing each serial port into a single usb function, which is supported by Windows.

  • Hello Ti, first i would like to thanks for your wonderful support. I have a quick questions regarding the gadget serial: I had configured gadget serial without ACM and exposed to linux host and trying to test the gadget throughput with setup usbtest.ko But it just reaching only 300kbytes/sec(used the usb analyzer) ,but according to my project i need way more than this...!!! Do you think the tty interface is doing the damage??? Can suggest me best driver which uses communication class(heavy stream of data) and transfers data from my linux or windows host(will try to write suitable .inf file later) Please let me know if you need more info regarding the same.
  • Hi Jessie,

    I was wondering if you can share the changes you made to those source files to get g_multi to instantiate multiple serial ports.

    This is my situation: I'm currently running Debian distro on a BeagleBone Black and have successfully loaded the libcomposite and g_multi driver to instantiate the gadget USB mass storage, USB network, and serial interfaces to a Linux box (USB host); on the Linux box, I can communicate on all 3 of those interfaces (/media/sdx1, usb0, /dev/ttyACM0) to the BeagleBone. Now I want to modify the g_multi driver to create more "virtual" interfaces, like adding another network interface and another serial interface; this means the Linux box will now see 2 network interfaces (.i.e. usb0 and usb1) and 2 serial interfaces (.i.e. /dev/ttyACM1). If I can see how you did your changes to create multiple serial ports, I can then try to do the same for creating multiple USB network interfaces. Thanks!

    Regards,
    Andy