Problem in reading through USB Serial - Jan Axelson Program

Hello Jan, Vladimir, Ben and all ....

I have taken the program on the link below
as suggested by Jan on this forum ...for using usb as uart on
BeagleBoard xm and interfaced with the windows PC.

http://www.lvr.com/code/usb_serial_port.c

I have connected BeagleBoard uart to windows hyperterminal and its
connected successfully .

Now writing from BeagleBoard to Windows Hyperterminal is done
comfortably but but as i read on Beagleboard ..i.e write something on
Hyperterminal ..at once

These ERROR MESSAGES come on the BB side. Please help as I am stuck.

Thanks and Regards,

Mohit

[ 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 ]---

Hi,

Test whether this code is working? Also be careful about the bps you set in BB(using C code)… The attached code has 115200…

Bye

serialtestv1.0.c (1.55 KB)

Hi Arun,
Could you please tell me , which kernel version , have you tried this successfully on ?

as it seems its a problem in some kernel version…!!

Thanks
Nidhi

hi Arun,

we tried ur program…

we have BB on one side and Windows on other connected through usb gadget serial.

we first do modprobe g_serial

and then run ur program by using ./executable /dev/ttyGS0 command

the following are the results:

1))program seems to catch q as it exits on pressing q

2)but any other character not being printed on BB cmd prompt …as program says it should.

3)we tried replacing macro STDOUT_FILENO with 2 but no result. again nothing is being typed from key board to BB cmd prompt…

4)we tried with printf after read from Windows :

while (c!=‘q’)
{
if (read(tty_fd,&c,1)>0)
{
printf(“i have got %c”,c);
fflush(stdout);
fflush(stdin);
return 0;
}
}

It pressed 'k ’ on HT on windows and i got the following result:

root@beagleboard:~# ./serialtestv3 /dev/ttyGS0
^Z�
and the program exited.

nothing worked
please help

Regards

Mohit