CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Multiple USB CDC interfaces in one PIC24

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Moe24



Joined: 04 Nov 2024
Posts: 2

View user's profile Send private message

Multiple USB CDC interfaces in one PIC24
PostPosted: Mon Nov 04, 2024 9:13 am     Reply with quote

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: 19539

View user's profile Send private message

PostPosted: Tue Nov 05, 2024 7:52 am     Reply with quote

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.... Sad
Devices offering multiple com ports use their own replacement for
usbser.sys
Moe24



Joined: 04 Nov 2024
Posts: 2

View user's profile Send private message

PostPosted: Fri Nov 08, 2024 3:06 am     Reply with quote

Thanks for your answer. I will give it another try, when I have time at work.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Nov 08, 2024 9:04 am     Reply with quote

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: 19539

View user's profile Send private message

PostPosted: Fri Nov 08, 2024 10:25 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Nov 09, 2024 2:30 am     Reply with quote

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.... Sad
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: 19539

View user's profile Send private message

PostPosted: Sat Nov 09, 2024 3:46 am     Reply with quote

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: 19539

View user's profile Send private message

PostPosted: Sat Nov 09, 2024 12:01 pm     Reply with quote

Done a look back at my notes, and I had to set the device up as
'Miscellaneous', not as a standard COM port. Device class 0xEF.

This is how I had to do it:
[url]
https://stackoverflow.com/questions/5508304/usb-communications-device-with-multiple-serial-ports-working-on-all-platforms
[/url]
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Nov 09, 2024 2:21 pm     Reply with quote

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: 19539

View user's profile Send private message

PostPosted: Sun Nov 10, 2024 12:28 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Nov 13, 2024 2:52 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Nov 22, 2024 2:19 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group