View previous topic :: View next topic |
Author |
Message |
Moe24
Joined: 04 Nov 2024 Posts: 2
|
Multiple USB CDC interfaces in one PIC24 |
Posted: Mon Nov 04, 2024 9:13 am |
|
|
Hello everybody,
I'm working with a PIC24FJ512GB606 and CCS compiler V5.115.
I'm trying to implement two USB CDC interfaces in the microcontroller.
Unfortunately I just find examples of CCS multiple HID interfaces.
I already spent a morning for modifying the CDC descriptor without any luck.
I believe more and more that the CCS library cannot handle two CDC interfaces. Is there someone how got this working? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Tue Nov 05, 2024 7:52 am |
|
|
I have done this years ago, with the CCS library. It can be made to work.
However assuming you are using Windows, usbser.sys, is limited to
supporting a single serial device from a single USB interface. To get
multiple you have to use a replacement for this (I used a third party
interface, cannot remember where I got it), or it worked well from
Linux. I think the replacement driver I used was from FTDI.
So if you have your descriptors set up correctly, the issue is not the
CCS end, but Windows....
Devices offering multiple com ports use their own replacement for
usbser.sys |
|
|
Moe24
Joined: 04 Nov 2024 Posts: 2
|
|
Posted: Fri Nov 08, 2024 3:06 am |
|
|
Thanks for your answer. I will give it another try, when I have time at work. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Fri Nov 08, 2024 9:04 am |
|
|
I've always thought of USB as an interface between TWO devices( say PC and mouse) and wonder just how much code is required to have a PC correctly communicate with two mouses ( mice ) on the same USB wires.
Maybe this dinosaur is missing something in what the 'project' is ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Nov 08, 2024 10:25 am |
|
|
CDC (so normally serial), rather than Mice. Multiple serial ports are not a
lot of work especially on a PIC24. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sat Nov 09, 2024 2:30 am |
|
|
Ttelmah wrote: | I have done this years ago, with the CCS library. It can be made to work.
However assuming you are using Windows, usbser.sys, is limited to
supporting a single serial device from a single USB interface. To get
multiple you have to use a replacement for this (I used a third party
interface, cannot remember where I got it), or it worked well from
Linux. I think the replacement driver I used was from FTDI.
So if you have your descriptors set up correctly, the issue is not the
CCS end, but Windows....
Devices offering multiple com ports use their own replacement for
usbser.sys |
So are you saying you make the PIC look like a given FTDI device that has 4 serial ports? (I have one from FTDI here. I forget the chip number though.)
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Sat Nov 09, 2024 3:46 am |
|
|
Yes, _BUT_, it can't be done using the standard Windows ubser.sys CDC
driver. This is limited to one port per USB device.
This is why third party units giving multiple ports use their own drivers
for this. There are a couple built into the standard Windows driver 'set'.
I used an FTDI VID/PID pair (very much not allowed), and this then
allowed the use of the FTDI driver. OK for a one-off 'home' device, but
illegal if you wanted to sell the device, If you wanted to make such a device
for commercial use, you would either have to write your own driver, or
make an agreement to an existing driver supplier.
I had proved to myself that it was the Windows driver that was causing
the problem, by trying the device on Linus, where it worked fine. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Sat Nov 09, 2024 2:21 pm |
|
|
Ttelmah wrote: | Yes, _BUT_, it can't be done using the standard Windows ubser.sys CDC
driver. This is limited to one port per USB device.
This is why third party units giving multiple ports use their own drivers
for this. There are a couple built into the standard Windows driver 'set'.
I used an FTDI VID/PID pair (very much not allowed), and this then
allowed the use of the FTDI driver. OK for a one-off 'home' device, but
illegal if you wanted to sell the device, If you wanted to make such a device
for commercial use, you would either have to write your own driver, or
make an agreement to an existing driver supplier.
I had proved to myself that it was the Windows driver that was causing
the problem, by trying the device on Linus, where it worked fine. |
Interesting -- I was just wondering.
I don't do any Windows Dev. I hate Windows. If I'm doing any dev work, it's usually FPGAs with Linux.
Thanks for elaborating though. (two thumbs up)
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Sun Nov 10, 2024 12:28 am |
|
|
In Linux it is relatively easy. You don't make a composite device. You just
make it a communications class device, with two instances.
That worked straight away for me in Linux.
That is the bottom bit in the post I pointed to.
The example for this are the multihid ones. Except you generate two
communication devices. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Wed Nov 13, 2024 2:52 pm |
|
|
Ttelmah wrote: | In Linux it is relatively easy. You don't make a composite device. You just
make it a communications class device, with two instances.
That worked straight away for me in Linux.
That is the bottom bit in the post I pointed to.
The example for this are the multihid ones. Except you generate two
communication devices. |
Interesting.
Thanks for the info! _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
MJ
Joined: 25 Aug 2024 Posts: 5
|
|
Posted: Fri Nov 22, 2024 2:19 am |
|
|
I had the same issue in Windows and, in the end, opted for one USB and a CP2102 to the serial port, both running CDC. If cost is an issue, then you can use the cheaper WCH USB-Serial parts, but you can run into issues with older Win OS. Also, consider using a 16F145X running CDC, and you can then buffer and transfer using other methods. |
|
|
|