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

Compiler support for pic24 and USB

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







Compiler support for pic24 and USB
PostPosted: Tue Sep 15, 2009 3:05 pm     Reply with quote

Hi,
i got one project where i have to use PIC24FJXXX for USB connection.

The part of the connection that i need is:
USB Stick <----> HW device.
HW Device <----> PC

Main functions should be used.
Something like, read / write data from and to USB stick and HW device.
Send receive data from PC to HW device.

I am CCS fan so i hope that there is some stable compiler version to support this kind of project ?

Any suggestion is welcome !
bkamen



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

View user's profile Send private message

PostPosted: Tue Sep 15, 2009 3:51 pm     Reply with quote

You need to look for a USB module on the PIC that supposed USB host mode.

I *think* that all PICs only support the USB end-point scenario.

I just looked on MAPS and considering the PIC24 series only comes with a maximum of 1 USB port, you'd be out of luck anyway for a design with 2 USB ports.

Now, you COULD make a PIC that behaves as a memory stick with the PIC communicating with a CompactFlash or SD card as the back end.

You might be re-inventing the wheel though.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Sep 16, 2009 12:10 am     Reply with quote

Quote:
I *think* that all PICs only support the USB end-point scenario.

Not only. PIC24FJxxxGB are supporting dual-role respectively OTG (on-the-go) USB operation, a kind of mini-host accessing one device, e.g. a memory stick. CCS hasn't yet provided any example code, but you can port the Microchip C30 examples, e.g. the project USB Host - Mass Storage - Thumb Drive Data Logger.

But as said, PIC24 has only a single USB port that can be configured either as device or host. At best, the processor could perform both USB roles serially.
bkamen



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

View user's profile Send private message

PostPosted: Wed Sep 16, 2009 12:23 am     Reply with quote

FvM wrote:

But as said, PIC24 has only a single USB port that can be configured either as device or host. At best, the processor could perform both USB roles serially.


I saw that going back and looking again...

last I remember reading about USB OTG, it doesn't quite support being a host to a normal USB end-point. OTG needs to have another OTG compatible port... (unless they changed that which I think I remember discussion concerning that)...

-ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Sep 16, 2009 1:45 am     Reply with quote

While OTG is a generic term and a marketing slogan, dual-role device and embedded host are the technical terms used in the respective USB specifications. Basically, a dual-role device has a Targeted Peripheral List clarifying which devices are recognized. The said Microchip project e.g. has a standard USB mass storage device in it's list. So apart from the meaning of terms, PIC24FJxxxGB is able to serve a memory stick respectively "being a host to (this specific) normal USB end-point".
Ginko
Guest







PostPosted: Wed Sep 16, 2009 12:12 pm     Reply with quote

I am planning to use dual role device.

USB Host - Mass Storage - Thumb Drive Data Logger is good example project. I don't know if it would be "easy" to rewrite it for use with CCS.
I am writing this because i tested the same project on the explorer16 demo board and C30. As far as i can tell, this is not simple or small library.

You have mention that CCS didn't provide example for such project.
Does this means that there are already done USB library's that we can use to rewrite this project to CCS code ?

Would it be hard to rewrite C30 demo code to use with CCS ?
What compiler version supports such library's ?
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Sep 16, 2009 2:48 pm     Reply with quote

Quote:
As far as i can tell, this is not simple or small library.
Yes, that has been also my impression when browsing the code.

Quote:
Would it be hard to rewrite C30 demo code to use with CCS ?
Yes, I fear so. But not impossible though. I would do, if needing dual-role capability. Fortunately I don't need it, up to now.

Generally, it seems to me, that there aren't too many professional PCD users out there. One indication is the number of still existing unrevealed bugs, another the level of PCD related discussions on CCS forum. As a conclusion, I don't expect that someone already did the work.
Guest








PostPosted: Wed Sep 16, 2009 3:34 pm     Reply with quote

But not impossible though. I would do, if needing dual-role capability. Fortunately I don't need it....
--Is there a way that you make something like this for the users of CCS, in very near future :-). As you can guess, i need this in very near future.
D.h. by the end of the month.

Is there some simpler example from CCS on how to use some of the libraries that are assocciated with USB communication. ?
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Sep 16, 2009 4:41 pm     Reply with quote

No, I surely won't in the near future.

CCS is providing a CDC (device) driver for PIC24. As far as I understand, it's basically working.
Ginko
Guest







PostPosted: Wed Sep 16, 2009 11:54 pm     Reply with quote

OK.
I dont know, i can e-mail to CCS to see if they have some new example ?.

CDC (device) driver for PIC24
- Any other info regarding this driver ?
Do you know if someone used it ....
Ginko
Guest







PostPosted: Thu Sep 17, 2009 12:27 am     Reply with quote

Forget to ask.
Is it possible to make my project with CDC device driver ?
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Sep 17, 2009 12:48 am     Reply with quote

All CCS USB examples (ex_usb_xxx), except for the USB bootloader, have an option to use the PIC24 hardware. I mentioned CDC (communication device class = USB serial), because it's the most versatile code, usable for a lot of real world applications.

A mass storage device driver would use the basic usb.c and usb.h part, the missing part must be coded from the scratch. An embedded host respectively dual-role driver could at best reuse part of usb.c, but is basically a new project.
Ginko
Guest







PostPosted: Thu Sep 17, 2009 11:57 pm     Reply with quote

the missing part must be coded from the scratch
- How much of it ?
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