View previous topic :: View next topic |
Author |
Message |
Ginko Guest
|
Compiler support for pic24 and USB |
Posted: Tue Sep 15, 2009 3:05 pm |
|
|
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 ! |
|
![](templates/subSilver/images/spacer.gif) |
bkamen
Joined: 07 Jan 2004 Posts: 1611 Location: Central Illinois, USA
|
|
Posted: Tue Sep 15, 2009 3:51 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Sep 16, 2009 12:10 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
bkamen
Joined: 07 Jan 2004 Posts: 1611 Location: Central Illinois, USA
|
|
Posted: Wed Sep 16, 2009 12:23 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Sep 16, 2009 1:45 am |
|
|
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". |
|
![](templates/subSilver/images/spacer.gif) |
Ginko Guest
|
|
Posted: Wed Sep 16, 2009 12:12 pm |
|
|
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 ? |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Sep 16, 2009 2:48 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Wed Sep 16, 2009 3:34 pm |
|
|
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. ? |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Sep 16, 2009 4:41 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ginko Guest
|
|
Posted: Wed Sep 16, 2009 11:54 pm |
|
|
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 .... |
|
![](templates/subSilver/images/spacer.gif) |
Ginko Guest
|
|
Posted: Thu Sep 17, 2009 12:27 am |
|
|
Forget to ask.
Is it possible to make my project with CDC device driver ? |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Sep 17, 2009 12:48 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Ginko Guest
|
|
Posted: Thu Sep 17, 2009 11:57 pm |
|
|
the missing part must be coded from the scratch
- How much of it ? |
|
![](templates/subSilver/images/spacer.gif) |
|