USB Serial Gadget Issue in LS208xA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB Serial Gadget Issue in LS208xA

3,051 Views
priyadharshinik
Contributor II

Hi,

USB Serial gadget device comunication is not working on custom board based on LS2088a.

Enabled "dr_mode = peripheral" in device tree.

 

root@atomas:legacy# ls /sys/class/udc/3100000.usb/

a_alt_hnp_support  device             maximum_speed      subsystem

a_hnp_support      function           power              suppliers

b_hnp_enable       is_a_peripheral    soft_connect       uevent

consumers          is_otg             srp

current_speed      is_selfpowered     state

root@atomas:legacy#

 

Installed serial gadget Driver

[  870.419436] udc 3100000.usb: registering UDC driver [g_serial]

[  870.419519] g_serial gadget: adding 'acm'/000000003a254470 to config 'CDC ACM config'/00000000e63ca627

[  870.419533] g_serial gadget: acm ttyGS0: super speed IN/ep1in OUT/ep1out NOTIFY/ep2in

[  870.419540] g_serial gadget: Gadget Serial v2.4

[  870.419544] g_serial gadget: g_serial ready

root@atomas:legacy#

 

/dev/ttyGS0 node created.

USB Cable concected between PC and Target (USB Type A to Mini-B cable)

Device not detected in host

[32310656.199523] usb 2-1-port6: attempt power cycle

[32310656.803346] usb 2-1.6: new high-speed USB device number 3 using ehci-pci

[32310657.227333] usb 2-1.6: device not accepting address 3, error -71

[32310657.307351] usb 2-1.6: new high-speed USB device number 4 using ehci-pci

[32310657.731350] usb 2-1.6: device not accepting address 4, error -71

[32310657.731488] usb 2-1-port6: unable to enumerate USB device

[32312721.484618] usb 2-1.6: new high-speed USB device number 5 using ehci-pci

[32312721.576623] usb 2-1.6: device descriptor read/64, error -71

[32312721.776615] usb 2-1.6: device descriptor read/64, error -71

[32312721.964616] usb 2-1.6: new high-speed USB device number 6 using ehci-pci

[32312722.056613] usb 2-1.6: device descriptor read/64, error -71

[32312722.256614] usb 2-1.6: device descriptor read/64, error -71

[32312722.364790] usb 2-1-port6: attempt power cycle

[32312722.968616] usb 2-1.6: new high-speed USB device number 7 using ehci-pci

[32312723.392605] usb 2-1.6: device not accepting address 7, error -71

[32312723.472619] usb 2-1.6: new high-speed USB device number 8 using ehci-pci

[32312723.896606] usb 2-1.6: device not accepting address 8, error -71

[32312723.896755] usb 2-1-port6: unable to enumerate USB device

 

 

Please help to find out the issue. 

0 Kudos
Reply
1 Reply

3,029 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please refer to the following procedure to enable USB serial gadget.

Update Kernel menuconfig to enable serial gadget.

yipingwang_0-1620288689663.png

yipingwang_1-1620288714600.pngyipingwang_2-1620288723104.png

  • Build whole Linux kernel, below KO will be compiled:
    • LD [M]  drivers/usb/gadget/function/usb_f_acm.ko
    • LD [M]  drivers/usb/gadget/function/u_serial.ko
    • LD [M]  drivers/usb/gadget/function/usb_f_obex.ko
    • LD [M]  drivers/usb/gadget/function/usb_f_serial.ko
    • LD [M]  drivers/usb/gadget/legacy/g_serial.ko

Device Tree update, change property dr_mode’s data from “host” to “peripheral”, add property maximum-speed = “super-speed”

Copy related ko files to Layerscape board by using SD card, insmod ko on Layerscape board console

  • insmod libcomposite.ko
  • insmod u_serial.ko
  • insmod usb_f_acm.ko
  • insmod usb_f_obex.ko
  • insmod usb_f_serial.ko
  • insmod g_serial.ko

Please run cat /sys/class/tty/ttyGS0/dev to get the device major number, then run "mknod /dev/ttyGS0 c major_num 0".

Connect USB cable between Layerscape and PC USB host port, then below message will pop on Layerscape platform:

yipingwang_3-1620289218844.png

Now you can see it on PC Device Manager

yipingwang_4-1620289310241.png

On PC, run PuTTY or similar tool to open COM port shown above (COM24)

yipingwang_5-1620289346236.png

Write test

  • On Layerscape board console, cat specific device file to ready receive data
    • cat /dev/ttyGS0
  • Type some text on PuTTY console, now you can see the same content displayed on Layerscape board.

Read test

  • On Layerscape board console, echo some text to /dev/ttyGS0, then you can see it on PuTTY console.

 

0 Kudos
Reply