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.

usb serial gadget read problem

Hello all

I have done
modprobe g_serial on my BeagleBoard xm to use usb as serial port on Beagleboard

I have taken the program on the link below for testing uart communication on BeagleBoard xm
http://www.lvr.com/code/usb_serial_port.c

I have connected BeagleBoard uart to windows hyperterminal and its connected successfully .
Now i am able to write on uart from Beagleboard side ..

but as i read on Beagleboard ..i.e write something on Hyperterminal ..at once
These ERROR MESSAGES come on Beagleboard !!


[  236.729919] musb g_serial gadget disconnected.
[  238.990112] g_serial gadget: high speed config #2: CDC ACM config
[  274.613616] ------------[ cut here ]------------
[  274.618286] WARNING: at kernel/mutex.c:207 __mutex_lock_slowpath+0x6c/

0x278()
[  274.625488] Modules linked in: g_serial rfcomm ipv6 hidp l2cap bluetooth rfkill
[  274.632965] [<c0040c40>] (unwind_backtrace+0x0/0xdc) from [<c006cdb4>] (warn_slowpath_common+0x4c/0x80)
[  274.642425] [<c006cdb4>] (warn_slowpath_common+0x4c/0x80) from [<c04852a0>] (__mutex_lock_slowpath+0x6c/0x278)
[  274.652496] [<c04852a0>] (__mutex_lock_slowpath+0x6c/0x278) from [<c04854b8>] (mutex_lock+0xc/0x1c)
[  274.661621] [<c04854b8>] (mutex_lock+0xc/0x1c) from [<c029c014>] (echo_set_canon_col+0x18/0x40)
[  274.670379] [<c029c014>] (echo_set_canon_col+0x18/0x40) from [<c029e4d8>] (n_tty_receive_buf+0xc54/0xf38)
[  274.680023] [<c029e4d8>] (n_tty_receive_buf+0xc54/0xf38) from [<c02a0c70>] (flush_to_ldisc+0x114/0x1e0)
[  274.689514] [<c02a0c70>] (flush_to_ldisc+0x114/0x1e0) from [<bf09ce3c>] (gs_rx_push+0x140/0x220 [g_serial])
[  274.699340] [<bf09ce3c>] (gs_rx_push+0x140/0x220 [g_serial]) from [<c0072e00>] (tasklet_action+0x74/0xbc)
[  274.708984] [<c0072e00>] (tasklet_action+0x74/0xbc) from [<c0073400>] (__do_softirq+0xe8/0x1f0)
[  274.717742] [<c0073400>] (__do_softirq+0xe8/0x1f0) from [<c007354c>] (irq_exit+0x44/0x98)
[  274.725982] [<c007354c>] (irq_exit+0x44/0x98) from [<c003b078>] (asm_do_IRQ+0x78/0x98)
[  274.733947] [<c003b078>] (asm_do_IRQ+0x78/0x98) from [<c003bd40>] (__irq_usr+0x40/0xa0)
[  274.742004] Exception stack(0xdfbabfb0 to 0xdfbabff8)
[  274.747100] bfa0:                                     00000000 be9bbcdd 0000000a 00000003
[  274.755340] bfc0: 40020000 00000000 00008588 00000003 00000000 00000000 40025000 be9bbccc
[  274.763580] bfe0: 00000000 be9bbcb8 000089f0 400da29c 60000010 ffffffff
[  274.770233] ---[ end trace c191d2c1d7b00f1e ]---


please help me to interpret and how could i correct this ...


Thanks
Nidhi
  • The example code at LVR is intended for a board with it's USB port confiigured as a USB Host. The Serial Gadget expects the board's USB port to be configured as a USB Device. Using Host code on a Device might not work. On my OMAP EVM and an older 2.6.18 kernel, this is the test commands that I used:

    modprobe g_serial use_acm=1
    /sbin/getty -n  -l /bin/sh /dev/ttygserial 115200

    On newer kernels, "ttygserial" is replaced with "ttyGS0". Also "ttyGS0" is automatiically created when the board is plugged into the PC.

     

  • Hello ,

    Thanks for the reply ..but i tried testing usb port on Beagleboard without this lvr program too.

     

    i just did

    modprobe g_serial.

    connected Beagleboard with windows through usb cable.

    then echo "nidhi" > /dev/ttyGS0   -- it worked well

    then cat /dev/ttyGS0  -- typed something on Hyperterminal on windows.

    and it gives above said errors on Beagleboard side.

    is there someone whoc has tried using g_serial successfully ?

    if yes please tell me the kernel version you tried it on ...

     

    Thanks

     

    Nidhi

     

     

     

  • Google gave a few hits:

    http://lkml.org/lkml/2009/6/22/137
    http://lkml.org/lkml/2009/6/23/81
    http://lkml.org/lkml/2009/6/23/127

    http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.35

    Author: Jon Povey <jon.povey@racelogic.co.uk>
    Date:   Mon Jun 14 19:42:10 2010 +0900
        USB: g_serial: fix tty cleanup on unload
        Call put_tty_driver() in cleanup function, to fix Oops when trying to open
        gadget serial char device after module unload.
       
    Author: Jon Povey <jon.povey@racelogic.co.uk>
    Date:   Mon Jun 14 19:41:04 2010 +0900
        USB: g_serial: don't set low_latency flag
        No longer set low_latency flag as it causes this warning backtrace:
          WARNING: at kernel/mutex.c:207 __mutex_lock_slowpath+0x6c/0x288()
        Fix associated locking and wakeups.

    .