View previous topic :: View next topic |
Author |
Message |
nguyendang
Joined: 27 Jun 2018 Posts: 6
|
USB memory with PIC24, CCS |
Posted: Fri Dec 21, 2018 2:54 am |
|
|
Hi everyone.
I am going implement USB memory for my project.
I tried few days but i not yet know where should i start from.
Somebody said SDCard memory is more easy. But in my case i must use USB memory because hardware already made.
It will be great if somebody can help me some document or sample code.
Currently i am using PIC24FJ128GB204 and CCS 5.04.
Thank you for any one come to read this topic or help me.
P/s: sorry because my terrible English. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19569
|
|
Posted: Fri Dec 21, 2018 3:07 am |
|
|
Major work I'm afraid.
As far as I know, nobody here has gone through the bother of doing this.
CCS do not supply USB OTG code (which is what you need to do this), so
you would have to port this from the MicroChip USB stack.
No code available.
The MicroChip USB stack itself, gives lots of issues when this is used
(typical success rate is perhaps only 90%).
The 'easy' way is to instead use an FTDI Vinculum, which then means
just a serial connection to talk to the USB memory.
For an SD card, the work has been done already.
As a further comment though 5.04, was a very early beta of the V5
compilers. It is unlikely to be completely reliable even if you had got code
for this. There were issues with interrupts being disabled in Printf, and
quite a few driver oddities at this time.
Building the hardware before investigating what is really needed, is a
little silly I'm afraid...
Hopefully your PIC has got a crystal, since this is _required_ to implement
a USB master device... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9255 Location: Greensville,Ontario
|
|
Posted: Fri Dec 21, 2018 6:47 am |
|
|
As Mr T says MAJOR work !! Even I won't code OTG for a PIC, used a Vinculum years ago.Been playing with PICs for 1/4 century...sigh
You'll need to do a LOT of reading, goto Microchip's site and find EVERY 'application note' about OTG USB, get on their 'forum' and see what's there, try googling.
As a 'first step', I'd cut code and get teh PIC to talk to a PC via USB, that should be kinda easy...... It will confirm the hardware is correct and working.
After that..more reading and testing.
USB is NOT simple or easy. I refer to it as the Useless Serial Bus. Way overly complicated and not interrupt driven unlike good old 'RS-232' comports.
Jay |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Fri Dec 21, 2018 7:27 am |
|
|
temtronic wrote: |
USB is NOT simple or easy. I refer to it as the Useless Serial Bus. Way overly complicated and not interrupt driven unlike good old 'RS-232' comports.
|
That's from a developer standpoint :p
Luckily, it's super easy from a consumer point of view. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9255 Location: Greensville,Ontario
|
|
Posted: Fri Dec 21, 2018 8:09 am |
|
|
yah, until some 'ap' changes the USB allowed current in the config !!
I never tracked down THAT gremlin.....
What gets me is the shear 'overhead' to transmit data, Top heavy, very top heavy. I use a com system that in 22 BITS, sends 20 BITS of data on a true single wire (plus Earth) that has been (and will be ) hackerproof for 30+ years.
1st PIC project used a 16C84 to replace 22 4000 series devices.
Jay |
|
|
|