• AVR Freaks

Usb CDC-demo hangs with Linux (Unslung)

Author
jas39
New Member
  • Total Posts : 28
  • Reward points : 0
  • Joined: 2005/08/17 03:41:50
  • Status: offline
2009/04/09 18:04:21 (permalink)
0

Usb CDC-demo hangs with Linux (Unslung)

Hi
I'm trying to get the CDC demo from the 2.4 stack to work with my Unslung Linux without success. The Unslung hangs and reboots as soon as i pipe data to OR from the device.

It works flawless in Windows. And the unslung accepts other CDC devices.

Looking here i see several mails about SUSPEN/RESUME not working properly with Linux and recomendations to compile with CONFIG_USB_SUSPEND disabled, which
I beleive is the case.

Did anyone (Xiofan for exxample) figure out how to fix the SUSPEND code on the Pic-side?


I also get a comment on not having a BULK_OUT endpoint. Isn't the CDC demo configured to hava both an BULK_IN and BULK_OUT end point?

hub.c: new USB device 00:01.0-1, assigned address 2
Device descriptor:8 bytes received.
Device descriptor:18 bytes received.
usbserial.c: Generic converter detected
usbserial.c: Generic device with no bulk out, not allowed.
usbserial.c: Generic converter detected
usbserial.c: Generic converter now attached to ttyUSB0 (or usb/tts/0 for devfs)



Any and all help is greatly appreciated!

Rgds
/&&
#1

8 Replies Related Threads

    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: Usb CDC-demo hangs with Linux (Unslung) 2009/04/09 20:23:47 (permalink)
    0

    ORIGINAL: jas39
    Looking here i see several mails about SUSPEN/RESUME not working properly with Linux and recomendations to compile with CONFIG_USB_SUSPEND disabled, which I beleive is the case.

    Did anyone (Xiaofan for exxample) figure out how to fix the SUSPEND code on the Pic-side?


    Could you build your kernel with CONFIG_USB_SUSPEND disabled? That would help.

    On the other hand, I am not 100% sure the bug is with Linux or with the PIC side when CONFIG_USB_SUSPEND is enabled. Supposedly 2.4 stack has it fixed.

      USB_Links and libusb
    #2
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: Usb CDC-demo hangs with Linux (Unslung) 2009/04/09 20:24:59 (permalink)
    0

    ORIGINAL: jas39
    I also get a comment on not having a BULK_OUT endpoint. Isn't the CDC demo configured to hava both an BULK_IN and BULK_OUT end point?

    That is right. CDC-ACM needs one interrupt endpoint, one bulk IN endpoint and one bulk OUT endpoint.

      USB_Links and libusb
    #3
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: Usb CDC-demo hangs with Linux (Unslung) 2009/04/09 20:31:10 (permalink)
    0

    ORIGINAL: xiaofan

    ORIGINAL: jas39
    Looking here i see several mails about SUSPEN/RESUME not working properly with Linux and recomendations to compile with CONFIG_USB_SUSPEND disabled, which I beleive is the case.

    Did anyone (Xiaofan for exxample) figure out how to fix the SUSPEND code on the Pic-side?


    Could you build your kernel with CONFIG_USB_SUSPEND disabled? That would help.

    On the other hand, I am not 100% sure the bug is with Linux or with the PIC side when CONFIG_USB_SUSPEND is enabled. Supposedly 2.4 stack has it fixed.



    Hmm, according to the following website, Unslug is using Linux 2.4.22+. I do not think it has the option of CONFIG_USB_SUSPEND. Maybe there are other bugs in Unslug (or PIC). You should check with the developers of Unslug and see if they can help.

    http://www.nslu2-linux.org/wiki/FAQ/FirmwareMatrix

      USB_Links and libusb
    #4
    jas39
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2005/08/17 03:41:50
    • Status: offline
    RE: Usb CDC-demo hangs with Linux (Unslung) 2009/04/10 16:56:02 (permalink)
    0
    I've now upgraded to a 2.6 Kernel (Debian) which finds the device, dmesg and lsusb reporting in the end of post.
    The NSLU no longer reboots wheen piping from/to /dev/ttyACM0 but there's no data comming either. Any more ideas?

    Btw, Why does it show up as a ACM device and not a general serial device?


    [42949399.620000] usb 2-1: configuration #1 chosen from 1 choice
    [42949399.650000] usb 2-1: New USB device found, idVendor=04d8, idProduct=0x0a
    [42949399.660000] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [42949399.670000] usb 2-1: Product: CDC RS-232 Emulation Demo
    [42949399.670000] usb 2-1: Manufacturer: Microchip Technology Inc.
    [42949402.850000] cdc_acm: This device cannot do calls on its own. It is no modem.
    [42949402.850000] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
    [42949402.910000] usbcore: registered new interface driver cdc_acm
    [42949402.920000] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters




    ~# lsusb -v

    Bus 002 Device 004: ID 04d8:0x0a Microchip Technology, Inc.
    Device Descriptor:
    bLength                18
    bDescriptorType         1
    bcdUSB               2.00
    bDeviceClass            2 Communications
    bDeviceSubClass         0
    bDeviceProtocol         0
    bMaxPacketSize0         8
    idVendor           0x04d8 Microchip Technology, Inc.
    idProduct          0xfdeb
    bcdDevice            0.01
    iManufacturer           1 Microchip Technology Inc.
    iProduct                2 CDC RS-232 Emulation Demo
    iSerial                 0
    bNumConfigurations      1
    Configuration Descriptor:
       bLength                 9
       bDescriptorType         2
       wTotalLength           67
       bNumInterfaces          2
       bConfigurationValue     1
       iConfiguration          0
       bmAttributes         0xc0
         Self Powered
       MaxPower              100mA
       Interface Descriptor:
         bLength                 9
         bDescriptorType         4
         bInterfaceNumber        0
         bAlternateSetting       0
         bNumEndpoints           1
         bInterfaceClass         2 Communications
         bInterfaceSubClass      2 Abstract (modem)
         bInterfaceProtocol      1 AT-commands (v.25ter)
         iInterface              0
         CDC Header:
           bcdCDC               1.10
         CDC ACM:
           bmCapabilities       0x02
             line coding and serial state
         CDC Union:
           bMasterInterface        0
           bSlaveInterface         1
         CDC Call Management:
           bmCapabilities       0x00
           bDataInterface          1
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x82  EP 2 IN
           bmAttributes            3
             Transfer Type            Interrupt
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0008  1x 8 bytes
           bInterval               2
       Interface Descriptor:
         bLength                 9
         bDescriptorType         4
         bInterfaceNumber        1
         bAlternateSetting       0
         bNumEndpoints           2
         bInterfaceClass        10 CDC Data
         bInterfaceSubClass      0 Unused
         bInterfaceProtocol      0
         iInterface              0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x03  EP 3 OUT
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0040  1x 64 bytes
           bInterval               0
         Endpoint Descriptor:
           bLength                 7
           bDescriptorType         5
           bEndpointAddress     0x83  EP 3 IN
           bmAttributes            2
             Transfer Type            Bulk
             Synch Type               None
             Usage Type               Data
           wMaxPacketSize     0x0040  1x 64 bytes
           bInterval               0
    Device Status:     0x0001
    Self Powered
    post edited by jas39 - 2009/04/10 16:58:01
    #5
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: Usb CDC-demo hangs with Linux (Unslung) 2009/04/11 23:12:44 (permalink)
    0
    ORIGINAL: jas39

    I've now upgraded to a 2.6 Kernel (Debian) which finds the device, dmesg and lsusb reporting in the end of post.
    The NSLU no longer reboots wheen piping from/to /dev/ttyACM0 but there's no data comming either. Any more ideas?

    Btw, Why does it show up as a ACM device and not a general serial device?


    It is normal to show up as CDC-ACM device. It is a CDC-ACM device. In order to be listed as a serial device, more things needs to be done. For example, FTDI device and Silabs do not follow the generic CDC-ACM spec but they are listed as serial device because drivers are written for them.

    As for serial communication, sorry I have no idea of how your kernel works (it is using ARM and may have a lot of customization). It is better that you check with the forum of NSLU.

    It may also help if you can get it to work with a PC with Linux installation. Then you might get better understanding of how Linux works. Then you can jump in NSLU.
    post edited by xiaofan - 2009/04/11 23:14:25

      USB_Links and libusb
    #6
    jas39
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2005/08/17 03:41:50
    • Status: offline
    RE: Usb CDC-demo hangs with Linux (Unslung) 2009/04/12 14:12:41 (permalink)
    0
    I've now gotten one step further, reverting back to unslung, I can now communicate with my 18f2550 device with a terminal emulator, picocom, through
    /dev/ttyUSB0. The unslung 2.4 linux is able to handle the Mchp2.4 cdc stack.

    BUT if a pipe to or from /dev/ttyUSB0 everything hangs, my guess is that not all things get properly initated in unslung and that the terminal-program fixes that, hence
    the problem is on the linux side.'ll continue to investgae tere....


    Thanks Xiofan for your help!
    /&&
    #7
    vpatron
    Junior Member
    • Total Posts : 104
    • Reward points : 0
    • Joined: 2009/02/27 13:01:26
    • Location: 0
    • Status: offline
    RE: Usb CDC-demo hangs with Linux (Unslung) 2009/04/13 08:17:04 (permalink)
    0
    Hi jas,

    I had a similar problem on my Windows application and thought you might be running into the same issue.

    My CDC application would work then I manually enter commands via a terminal program, but would fail if I send it using Visual Basic, or Labview or whatever. It would only recognize one character.

    I realized that the reason was when I was typing the commands using a terminal, each character was sent out in its own USB packet. But if I send it with an application, the entire command string was sent in one USB bulk packet. It was obvious to see when I used PortMon for Windows. I'm sure there's a similar utility for Linux.

    I basically wrote the PIC firmware wrong and assumed the read USBUART function keeps an internal stack of received data but it does not work this way. Let me know if your issue is similar and I can give you more detailed info.

    -Vince Patron

    #8
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: Usb CDC-demo hangs with Linux (Unslung) 2009/04/13 22:23:19 (permalink)
    0
    ORIGINAL: jas39
    I've now gotten one step further, reverting back to unslung, I can now communicate with my 18f2550 device with a terminal emulator, picocom, through
    /dev/ttyUSB0. The unslung 2.4 linux is able to handle the Mchp2.4 cdc stack.

    BUT if a pipe to or from /dev/ttyUSB0 everything hangs, my guess is that not all things get properly initated in unslung and that the terminal-program fixes that, hence
    the problem is on the linux side.'ll continue to investgae tere....


    Glad that you get it to work. I remember I used gtkterm/cutecom to get the CDC working. I've not tried to directly using the /dev file nodes to talk to the CDC-ACM example --> I am basically a non-programmer myself. So maybe there are some tricks to use /dev/ttyUSB* (can be different depending on the Linux distributions due to different udev implementations).

      USB_Links and libusb
    #9
    Jump to:
    © 2020 APG vNext Commercial Version 4.5