Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Description:

Using USB based CAN device connected on AR9350 mips processor based Atheros reference board with linux kernel 2.6.32.61. Which is coming up as /dev/ttyACM0 device. In which Able to transmit data from application to the H/W device, but not able to receive data from the CAN device to the board.

Tested this on Fedora12 with linux 2.6.31 kernel where every thing is working fine. Also tested on AR71xx mips based Atheros reference board with linux kernel 2.6.32.61, here also every thing is working fine.

Device entry output:

cat /proc/bus/usb/devices

T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0

D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 8 #Cfgs= 1

P: Vendor=04d8 ProdID=00df Rev= 1.01

S: Manufacturer=Microchip Technology Inc.

S: Product=MCP2200 USB Serial Port Emulator

S: SerialNumber=0000472727

C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=100mA

A: FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=02 Prot=01

I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm

E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=2ms

I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm

E: Ad=03(O) Atr=02(Bulk) MxPS= 32 Ivl=0ms

E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms

I:* If#= 2 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=(none)

E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms

E: Ad=01(O) Atr=03(Int.) MxPS= 16 Ivl=1ms

Device terminal settings:

Below are the terminal settings used for /dev/ttyACM0 device on both AR9350 and AR71xx boards,

[root@localhost /root]# stty -a < /dev/ttyACM0

speed 460800 baud; rows 24; columns 80; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 -isig -icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

Main Problem:

when we open the device acm_rx_tasklet is getting invoked but the list in acm filled_read_bufs is empty. And also acm_read_bulk func is not getting called for adding receive buffer into filled_read_bufs list.

Note:

Have observed the same problem as mentioned above in AR71xx board and Fedora12 system when baud-rate is other than 460800.

Debug Log:

Below is the debug log with enabling CONFIG_USB_DEBUG option in kernel and DEBUG option in cdc-acm.c file. Here acm_read_bulk func is not getting called which is needed.

drivers/usb/class/cdc-acm.c: Entering acm_tty_open.

ehci_urb_enqueue:910: LOCAL DEBUG: within PIPE_INTERRUPT

usb 1-1.1: link qh2-0601/83ae1b40 start 1 [1/2 us]

ehci_urb_enqueue:893: LOCAL DEBUG: PIPE_CONTROL

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 82cd8200 ep0out len 0, qtd a38d8ae0 [qh 83ae17c0]

submit_async:1125:MANOJ calling qh_link_async

ath-ehci ath-ehci.0: irq status cc089 Async Periodic FLR INT

ath-ehci ath-ehci.0: ehci_urb_done 1.1 urb 82cd8200 ep0out status 0 len 0/0

drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0 result: 0

drivers/usb/class/cdc-acm.c: Entering acm_rx_tasklet

acm_rx_tasklet:418: calling filled read buf list empty. goto urbs label.

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c300 ep3in len 128, qtd a38d8b40 [qh (null)]

submit_async:1125:MANOJ calling qh_link_async

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c300, rcv 0x83a43b18, buf 0x83a43c58

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c280 ep3in len 128, qtd a38d8ba0 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c280, rcv 0x83a43b04, buf 0x83a43c44

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c200 ep3in len 128, qtd a38d8c00 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c200, rcv 0x83a43af0, buf 0x83a43c30

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c180 ep3in len 128, qtd a38d8c60 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c180, rcv 0x83a43adc, buf 0x83a43c1c

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c100 ep3in len 128, qtd a38d8cc0 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c100, rcv 0x83a43ac8, buf 0x83a43c08

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c080 ep3in len 128, qtd a38d8d20 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c080, rcv 0x83a43ab4, buf 0x83a43bf4

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 82e1c000 ep3in len 128, qtd a38d8d80 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82e1c000, rcv 0x83a43aa0, buf 0x83a43be0

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 82c60700 ep3in len 128, qtd a38d8de0 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82c60700, rcv 0x83a43a8c, buf 0x83a43bcc

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0:submit_async 1.1 urb 82c60200 ep3in len 128, qtd a38d8e40 [qh83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x82c60200, rcv 0x83a43a78, buf 0x83a43bb8

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 8390dd80 ep3in len 128, qtd a38d8ea0 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x8390dd80, rcv 0x83a43a64, buf 0x83a43ba4

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 8390d800 ep3in len 128, qtd a38d8f00 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x8390d800, rcv 0x83a43a50, buf 0x83a43b90

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 8390da00 ep3in len 128, qtd a38d8f60 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x8390da00, rcv 0x83a43a3c, buf 0x83a43b7c

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 83a77e80 ep3in len 128, qtd a2e21000 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x83a77e80, rcv 0x83a43a28, buf 0x83a43b68

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 839a2f80 ep3in len 128, qtd a2e21060 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x839a2f80, rcv 0x83a43a14, buf 0x83a43b54

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 839a2080 ep3in len 128, qtd a2e210c0 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x839a2080, rcv 0x83a43a00, buf 0x83a43b40

LOCAL DEBUG: tty->name = ttyACM1, acm->is_int_ep = 0

ehci_urb_enqueue:902: LOCAL DEBUG: DEFAULT

ath-ehci ath-ehci.0: submit_async 1.1 urb 839a2c00 ep3in len 128, qtd a2e21120 [qh 83ae1bc0]

drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0x839a2c00, rcv 0x83a439ec, buf 0x83a43b2c

Help needed:

Please suggest some tips to debug this issue. May be some more terminal settings needed to make this working. Not able to understand why only RX is not happening but able to do TX from board to Device.

share|improve this question
add comment

migrated from stackoverflow.com Jul 1 '13 at 2:39

This question came from our site for professional and enthusiast programmers.

1 Answer

Solution:

After a long debugging able to solve this problem on my own. The root cause for above behavior is not clearing the tt buffer on unlink . So added below line in Ehci host controller driver structure (ath_usb_ehci_driver) in ehci-ath.c file.

.clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,

Now able to receive data from the CAN device and able to read it from application.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.