|
|
View previous topic :: View next topic |
Author |
Message |
FORGET Philippe
Joined: 23 Oct 2013 Posts: 2 Location: 44 France
|
PIC24F USB Host |
Posted: Wed Oct 23, 2013 4:30 am |
|
|
Hello, I search for examples or to read or write to a memory stick from a PIC24F256GB106 or similar.
Thank you for your help. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19529
|
|
Posted: Thu Oct 24, 2013 12:15 am |
|
|
The only USB 'OTG' code that is commonly around, is the MicroChip, rather than CCS. You'd have to port this.
However it is not 'popular', because it is just so bulky. Implementing a USB master stack, is very complex, and in general, unless you have some months to spend doing software development, it is much quicker, and more reliable, to use an 'off the shelf' solution, like the FTDI Vinculum. This can interface to the PIC using SPI or serial, and saves a enormous amount of code development (a complete master stack is available for this, and leaves you with space in the PIC....).
If you are doing a project that is likely to involve thousands+ of units, then it is worth considering doing an OTG PIC solution, because of the savings per board. Below this sort of quantity, you will save more by using something like the Vinculum...
Best Wishes |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9232 Location: Greensville,Ontario
|
|
Posted: Thu Oct 24, 2013 5:30 am |
|
|
Have to agree with 'T' 100% here! I used the Vinculum solution couple of years ago for a remote datalogger project.Quick,simple,reliable.Yes, it is was more money for hardware but you need the USB connector,some PCB space,couple of LEDs,etc. anyway.The HUGE savings was in cutting code AND code space.You will spend a LOT of man-weeks if not man-months getting the your USB code to run right. The 'Vinculum module' was $30, so less than 1/2hour R&D time.Unless you're into the 10s of thousands of units, the savings in software and time more than justifies the additional hardware costs.
On a similar note, I use a $3 USB<>TTL module instead of any PIC with internal USB(ie: 4550).Again a quick, easy, reliable solution! NO code required,no memory for drivers( took 1/3 of the 4550 !) allows for FAST code cutting and project completion.Also ANY PIC can be used,even cheaper ones than the 4550 types!
As someone who grew up making UARTs from discrete 7400 series chips to save $25, I finally figured out , that if there's an 'off the shelf' solution that eliminates a LOT of 'quirky' or timing 'sensitive' code buy it! If you don't value your time now...you will in the future, when you look back and say, 'I should have.....'.
hth
jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19529
|
|
Posted: Thu Oct 24, 2013 9:17 am |
|
|
The basic 'single USB' Vinculum module, has come down a lot since then. About half the price for the VNC2 module now.
On a slave, I'm less decided. The basic CDC drivers on later PIC's take up less than 25% of the ROM, and are 100% reliable now. For the master though I'd go the Vinculum route every time.
You also need to consider that as 'host', you are supplying power, so 'super low power' solutions won't apply, while as a slave, you may want to absolutely minimise power if dealing with a 'bus driven' device, so the RS232 module may well be a problem.
Best Wishes |
|
|
FORGET Philippe
Joined: 23 Oct 2013 Posts: 2 Location: 44 France
|
PIC24F USB Host |
Posted: Sat Oct 26, 2013 1:22 am |
|
|
Merci pour vos précisions.
Nous recherchons seulement à écrire des données sur une clé USB.
A vous comprendre, il faut utiliser un ou des composants comme interface ou exploiter les solutions librairies MPLAB.
Philippe
++++++++++++++
Translation from Forum Moderator:
Thank you for your clarification.
We seek only to write data to a USB stick.
As we understand you, we must use one or more components as the interface or use libraries from Microchip.
++++++++++++++ |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Oct 26, 2013 2:45 am |
|
|
Firstly I feel tempted to remember that according to previous forum posts, CCS promised to customers
three years ago, that a PIC24 OTG stack would be soon available.
Secondly, if you are working with a Microchip tool chain (as I do for PIC32) you probably won't expect
"some months to spend doing software development" but simply start with the ready-made application
library examples. Depending on the application complexity and your software engineering skills, the
problem might still turn out to be over your head, but it's at least worth a try. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19529
|
|
Posted: Sat Oct 26, 2013 4:35 am |
|
|
Agreed the memory stick host example would probably do most of what is needed. It it much harder if a flexible USB stack is needed.
However size will be an issue. I'd expect that a 256 size chip is being used because of the size of the existing code?. If so, then the 'simple' write application to just write to a card, will fill about 1/4 of the ROM, even if he has paid and got the optimising compiler. The 'free' compiler will use noticeably more space. Switching to read/write, makes the result even larger.
I also found the Microchip OTG stack (OK a few versions ago, but not many), to be noticeably 'fragile', giving repeated errors accessing some devices. It was trying to fix these that took time. Given that in some cases these were simple devices like memory sticks, I'd say the Vinculum solution is a lot less work....
I just don't like the OTG peripheral on the PIC's I have tried.
Best Wishes |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Sat Oct 26, 2013 7:45 am |
|
|
If it is a work ( business) project the decision to use Viniculum is a good one. Some see PIC projects as a hobby and might enjoy a challenge of writing from scratch or porting a Microchip stack. If it is a hobby project then
"N'oubliez pas.... impossible n'est pas francais" |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9232 Location: Greensville,Ontario
|
|
Posted: Sat Oct 26, 2013 10:25 am |
|
|
Whether it be for business or pleasure..I can't afford to waste a man-month of time and energy when an 'off-the-shelf' solution is available.
I got a Viniculum board 'up and running', collecting CSV formatted data(instant anyPC compatible) in about 2 hours. Best $30 I ever spent. NO porting of code, no grey hairs after burning the midnight oil either.
Guess there is some 'wisdom in growing older' but I can think of a LOT of better things to do with my time than getting 'host USB to work on a PIC'.
If it's for business, then time is your enemy, buy a V chip, cut a small amount of simple serial code, and make a client happy..fast! If for 'pleasure', well, ok, go for it and please report back when it's 'up and running' with features that the V chip has and tell us how many man hours you put into it. It'd be interesting.
cheers
jay |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Tue Oct 29, 2013 10:06 am |
|
|
yeah... I've given up waiting for CCS to come through with a USB host stack. As much as I hate using the Vinculum device I see no other viable option. They are OK for simple jobs, but a little buggy (to say the least) if you're trying to do more than one thing, like talking to a USB keyboard and a host at the same time, or switching back and forth between a keyboard and a memory stick. It can be done, but... not pretty at all. |
|
|
|
|
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
|