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 support@ccsinfo.com

USB CDC support for PIC24FJ32GU205

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



Joined: 25 Mar 2009
Posts: 47

View user's profile Send private message

USB CDC support for PIC24FJ32GU205
PostPosted: Mon Nov 20, 2023 6:33 pm     Reply with quote

Hello Everyone,

I am starting a new project where I want to use the PIC24FJ32GU205 to implement a USB CDC so I can send serial data from another device to the computer through this MCU. Does CCS have drivers/code to implement USB CDC functionality?

Thanks for your feedback,

O.
Ttelmah



Joined: 11 Mar 2010
Posts: 19463

View user's profile Send private message

PostPosted: Tue Nov 21, 2023 3:02 am     Reply with quote

Yes.
Standard driver with the compiler. usb_cdc.h
Assuming you have a modern compiler, the usb_serial example has been
rewritten to support the DS PIC's. About 2010, then some issues fixed
in 2013!....
Look at the usb_serial examples.
robleso7473



Joined: 25 Mar 2009
Posts: 47

View user's profile Send private message

PostPosted: Tue Nov 21, 2023 9:23 am     Reply with quote

Hi Ttelmah,

I have the PCWHD version 5.116 (I have been compiling code for the PIC24FJ32GU205) so I think this is the modern version - correct?

Thanks for your response. I do see the driver and examples.

Has CCS tested the driver and examples on this newer device (PIC24FJ32GU205)? You mentioned some issues had been fixed in 2013 but I want to say the PIC24FJ32GU205 was released after that (correct me if I'm wrong).

Thank you again,
O.
Ttelmah



Joined: 11 Mar 2010
Posts: 19463

View user's profile Send private message

PostPosted: Tue Nov 21, 2023 12:06 pm     Reply with quote

The basic USB stack doesn't change with chips. The problems were issues
with moving from the older chips.
robleso7473



Joined: 25 Mar 2009
Posts: 47

View user's profile Send private message

PostPosted: Tue Nov 21, 2023 12:08 pm     Reply with quote

Sounds good!
As always, great support.
Thank you.
O.
Ttelmah



Joined: 11 Mar 2010
Posts: 19463

View user's profile Send private message

PostPosted: Wed Nov 22, 2023 6:47 am     Reply with quote

As a comment, some remarks about USB in general.

Keep your connections on the board short, each close to the same length,
and make sure the track spacing is correct for the characteristic impedance.
For USB2, the connection length should not exceed 25mm.
Make sure you add detection for the connection being made.
The drivers on your chip meet the impedance spec. So no termination
required.
robleso7473



Joined: 25 Mar 2009
Posts: 47

View user's profile Send private message

PostPosted: Wed Nov 22, 2023 8:18 am     Reply with quote

Hi Ttelmah,

I appreciate the additional recommendations. I am not totally familiar with the various USB connection standards but as I'm going to be bridging at most 1Mbaud serial data I would want to connect with Full Speed (12 Mb/s) USB. I suspect a signaling rate of 12 Mb/s should not require very strict differential pair (USB +D/-D) routing requirements. Maybe I'm wrong on that - what do you think?

I certainly do not plan on using USB2.0, as I read through the PIC24FJxxGU spec I don't see USB having USB2.0 capability. It does have what they call 'USB On-The-Go" but not sure that's higher than 12 Mb/s signaling rate.

thanks,
O.
robleso7473



Joined: 25 Mar 2009
Posts: 47

View user's profile Send private message

PostPosted: Wed Nov 22, 2023 8:24 am     Reply with quote

I forgot to add one question: You mentioned that I should add detection. Is that a SW thing or is that an actual pin on the PIC24FJ32GU205 that needs to be connected to something?

The pinout on this device, regarding USB related connections, only has USBOEN_, Vbus, Vusb3v3, and USBID (apart from D+/D-).[/img]
Ttelmah



Joined: 11 Mar 2010
Posts: 19463

View user's profile Send private message

PostPosted: Wed Nov 22, 2023 10:58 am     Reply with quote

Both.

It means there has to be a physical connection to the USB V+ line, and the
software has to be told what pin to use for this sensing. On the DsPIC's,
you normally do it with the Vbus pin, and the VBUSVD bit. You setup a
USB_CABLE_IS_ATTACHED macro, before loading the USB driver to test
this bit.

This is _required_ by the USB specs, unless the device is only powered
by the USB bus (so switches off when disconnected).
robleso7473



Joined: 25 Mar 2009
Posts: 47

View user's profile Send private message

PostPosted: Wed Nov 22, 2023 11:22 am     Reply with quote

Hi Ttelmah,

Yes, I've had USB V+ connected VUSB pin on MCU from the beginning. I do understand this is required or recommended.

Thanks,
O.
Ttelmah



Joined: 11 Mar 2010
Posts: 19463

View user's profile Send private message

PostPosted: Thu Nov 23, 2023 6:17 am     Reply with quote

Good. Very Happy
A lot of people don't realise this is required.
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