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/AM3352: Using both the USB ports as serial gadgets devices

Part Number: AM3352

Tool/software: Linux

Hi,

I am using AM3352 based board and I want to use both my usb ports are serial gadget devices. I have set both the ports as "peripheral" devices in dts file and enabled USB gadget support. When I try modprobe g_serial I get only /dev/ttyGS0 file which I suppose is for USB0. Is there anything extra that I have to do to get a /dev/ttyGS1 for USB1? Also, can I set one of the ports in "otg" mode and still use it as a serial gadget?

  • Hi Ison Thomas,

    Have you tried using n_ports while inserting the serial driver. e.g.: modeprobe g_serial n_ports=2
    Default would be 1.

    Yes, setting as otg should be fine, if you have taken care in connecting the correct type-B(Proper ID pin for device) cable, it would act as serial gadget driver.
  • Thanks Dwarakesh,

    Using n_ports=2 is giving me ttyGS1 file. This will be the file for USB1 right? This port is currently using otg connector on the board so i need to get the correct type of cable to test it.

    Is there anything else to be done to make it work? Can I directly open the "/dev/ttyGS0/1" file, use 'termios' to set the UART configurations and then use read and write function for communication right?

    Thanks and Regards
    Ison Thomas
  • Hi Ison Thomas,
    "Is there anything else to be done to make it work? "
    I have not tried it myself. Would ask you to give a try of configuring termios and let me know. Once you get the OTG connector ready, would be interested in knowing how both the ports get enumerated with the host. lsusb -v you can try in a linux machine to check how they get enumerated.

  • Hi Dwarakesh,

    Apologies for the delay in replying back.

    Unfortunately the "n_ports" is not working as expected.

    When I use only modprobe g_serial, ttyGS0 file is getting generated and I am able to communicate using this file on a PC. But when I use modprobe g_serial n_ports=2, both ttyGS0 and ttyGS1 are generated but communication fails on both the files. In short, if I dont use n_ports=2, atleast ttyGS0 is working as expected. I am not able to figure out what is wrong exactly

    Regards

    Ison Thomas

  • Hi Ison,

    How does the ports get enumerated in PC ? Can you try lsusb -v in a linux machine and check ?