Welcome! Log In Create A New Profile

Advanced

Does anybody know the protocol...

Posted by Forrest Higgs 
Does anybody know the protocol...
February 16, 2008 10:31PM
...for reading data off of a memory stick? It occurred to me that since I've already committed to using USB 2.0 comms already I could as well set up the firmware on board the 18F4550 to download print data off of a memory stick as a PC. Memory sticks are dirt cheap and I could use my PC to load one up with print data, then insert it into Tommelise's USB port which would then receive it and proceed to print.

Anyway, does anybody know a reference for how to read off of a memory stick?

Thanks!
Re: Does anybody know the protocol...
February 17, 2008 03:04AM
I don't think the 18F4550 will act as a master only a slave and as such cannot read a USB stick it can be setup to read memory cards CF, SD etc, or you can use the FTDI chips which will give it full host & slave USB.


Ian
[www.bitsfrombytes.com]
Re: Does anybody know the protocol...
February 17, 2008 04:57AM
Yes you need a host port to talk to a USB stick and provide it with power. You then use the USB mass storage bulk protocol to read and write 512 byte blocks. The protocol actually borrows SCSI command blocks in same way that ATAPI does on IDE.

You then need a FAT file system implementation to make sense of the blocks you are reading.


[www.hydraraptor.blogspot.com]
Ru
Re: Does anybody know the protocol...
February 17, 2008 10:47AM
I suspect this is one of those problems which seems intially simple but ends up being rather complex. The easiest way to auto-detect the connection of a memory stick, pull off useful data from it and pass it to something else is to use a computer with a general purpose operating system.

Of course, I come from a PC background rather than an electronics one, so perhaps there are sensibly priced and easy to use tools or system-on-chip thingies that would do the job.

First thing that sprung to my mind was a gumstix pc (http://www.gumstix.com/) which is very small, very low power and yet runs a quite powerful linux distribution. This may be more complex that you'd be willing to work with, or pay for, of course. It has all sorts of fancy IO facilities and expansion boards, which would make interfacing with other tools moderately easy.

Anyway, I don't want to end up sounding like a salesman here, given that I don't get any comission or anything.
Re: Does anybody know the protocol...
February 17, 2008 11:23AM
I haven't seen anything for controlling a USB key directly from an MCU. The closest I've seen is this: [www.alfat.co.uk] Seems a bit of overkill, though.

You might be able to read some sort of non-USB memory card, though.

I once wrote routines to read a CompactFlash card using a 16f877. Info here: [degroof.home.mindspring.com] The CompactFlash interface was fairly easy but needed a lot of I/O pins.

I wonder how hard an SD card would be. Much simpler pinout.
Re: Does anybody know the protocol...
February 17, 2008 12:14PM
Yeah, I've thought of attaching flash memory to 40 pin PIC's before, but the number of I/O pins that it requires makes it a bit of a fool's errand in that you are left with too few to do anything very useful.

My prototype board can provide power to serial card, btw.
Re: Does anybody know the protocol...
February 17, 2008 12:28PM
An SD card operated in SPI mode is probably your best bet if you have a SPI port (three pins) to spare. They are 3.3V though so you will need some level translation with a 5V PIC.


[www.hydraraptor.blogspot.com]
Re: Does anybody know the protocol...
February 17, 2008 01:49PM
Does the SD Card use USB comms? If so the USB port on the 18F4550 can be made to run at 3.3 volts without a lot of drama. spinning smiley sticking its tongue out
Re: Does anybody know the protocol...
February 17, 2008 01:57PM
Re: Does anybody know the protocol...
February 17, 2008 03:38PM
Would this thing be of any use? [www.parallax.com]
Re: Does anybody know the protocol...
February 17, 2008 08:48PM
go with a SD card!

i dont know about your specific chip, but there its LOTS of information on reading/writing data to an SD card from a microprocessor on the net.

i dont have any handy, but the Arduino site might be a good jumping off point.
Sorry, only registered users may post in this forum.

Click here to login