• AVR Freaks

Multipule serial ports?

Author
ttabbal
New Member
  • Total Posts : 19
  • Reward points : 0
  • Joined: 2008/03/29 14:54:39
  • Location: 0
  • Status: offline
2009/01/26 09:52:53 (permalink)
0

Multipule serial ports?

I'm working on an application that could really use 2 serial ports. However, the CDC code looks to only support one. I was wondering if it's even possible and if so, how one would do it? Is it enough to create another copy of the CDC file and create new variables for everything so they have their own memory space to work in?
#1

7 Replies Related Threads

    LemoX
    Super Member
    • Total Posts : 193
    • Reward points : 0
    • Joined: 2009/01/02 19:00:10
    • Status: offline
    RE: Multipule serial ports? 2009/01/26 10:45:02 (permalink)
    0
    Hi,

    It is not enoght just to take a copy of  files changing variables names (think that the 2nd serial port uses some different configuration and control registers).

    I think you must write a library from scratch.

    LemoX
    #2
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    RE: Multipule serial ports? 2009/01/26 12:53:59 (permalink)
    0
    Hmmm, I guess that you have to define 2 Interfaces (in whatever method) to achieve 2 Virtual Comm Ports.
    (Tsuneo or Xiaofan may help more Smile)

    GENOVA :D :D ! GODO
    #3
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: Multipule serial ports? 2009/01/26 19:29:03 (permalink)
    0
    One example here (dual CDC com ports with IAD and usbser.sys). Only works with Windows XP SP3 or Vista SP1 (or XP with hot fixes).
    http://forum.microchip.com/tm.aspx?m=336385

    More links here:
    http://forum.microchip.com/tm.aspx?m=189607&mpage=5

    But it may be easier to use FTDI FT2232 series of USB dual com ports.

      USB_Links and libusb
    #4
    ttabbal
    New Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2008/03/29 14:54:39
    • Location: 0
    • Status: offline
    RE: Multipule serial ports? 2009/02/02 22:40:59 (permalink)
    0
    Thanks xiaofan. I am attempting to make that example work in the latest USB framework without much success. I'm reasonably sure my descriptor is throwing things off, but I'm not sure where I'm wrong. Can anyone here give me some hints? Windows (XP-SP3) bluescreens. Linux can tell what I'm trying to do, going by the logs. It gets to the endpoint descriptors for the final CDC device and throws an error. It does enumerate the first CDC just fine.

    Feb  2 22:28:48 nas kernel: [5093623.097682] usb 1-9: new full speed USB device using ohci_hcd and address 83
    Feb 2 22:28:49 nas kernel: [5093623.325663] usb 1-9: config 1 has an invalid descriptor of length 7, skipping remainder of the config
    Feb 2 22:28:49 nas kernel: [5093623.325744] usb 1-9: config 1 interface 3 altsetting 0 has 0 endpoint descriptors, different from the interface descriptor's value: 2
    Feb 2 22:28:49 nas kernel: [5093623.334768] usb 1-9: configuration #1 chosen from 1 choice
    Feb 2 22:28:49 nas kernel: [5093623.337776] /build/buildd/linux-2.6.24/drivers/usb/class/cdc-acm.c: This device cannot do calls on its own. It is no modem.
    Feb 2 22:28:49 nas kernel: [5093623.337869] cdc_acm 1-9:1.0: ttyACM0: USB ACM device
    Feb 2 22:28:49 nas kernel: [5093623.343979] /build/buildd/linux-2.6.24/drivers/usb/class/cdc-acm.c: This device cannot do calls on its own. It is no modem.
    Feb 2 22:28:49 nas kernel: [5093623.344061] cdc_acm: probe of 1-9:1.2 failed with error -22


    lsusb is segfaulting, so I have little to go on here. But all that's left after interface 3 are the 2 endpoint descriptors for the data interface, and they are length 7. Attached is my usb_descriptors.c file. Any help would be appreciated. I think I'm close, but just have something a little off. My first version had a single IAD at the top saying it had 4 interfaces. The example xiaofan linked to had 2 IADs, one before each CDC device, each with 2 interfaces defined. So I switched to that model and I'm getting the same error.
    #5
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    RE: Multipule serial ports? 2009/02/03 15:06:17 (permalink)
    0
    Maybe the total length field on the config. descriptor is not 133, but 141.
    Count up the bytes again.

    Tsuneo
    #6
    ttabbal
    New Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2008/03/29 14:54:39
    • Location: 0
    • Status: offline
    RE: Multipule serial ports? 2009/02/03 21:16:28 (permalink)
    0
    Well, I feel a bit sheepish. I thought I checked that, but must have missed something. I recounted today and you were quite right. I now have 2 serial ports being assigned in Linux. Windows doesn't crash, but only one port shows up. I need to modify the .INF file to fix that I suppose. Now I need to make them work. I created the endpoints, but need to modify the CDC code to accept parameters so I can specify which port I'm dealing with. Thanks for the sanity check.
    #7
    ttabbal
    New Member
    • Total Posts : 19
    • Reward points : 0
    • Joined: 2008/03/29 14:54:39
    • Location: 0
    • Status: offline
    RE: Multipule serial ports? 2009/02/25 13:54:25 (permalink)
    0
    Here's some demo code. It's set up for a PIC18F2550, but has been ported to a PIC32. It's based on the basic CDC demo from the Microchip 2.3 suite. INF files are included for Windows. Hope it helps someone out. 
    #8
    Jump to:
    © 2020 APG vNext Commercial Version 4.5