EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Need help to start with USB

Started by aleksa May 2, 2009
I need to read/write sectors on
USB flash memory mass storage.
(I hope this is the correct title)

AFAIK, this has two requirements:

1. hardware: USB connection.
2. software: handshaking with USB devices.

I think/hope that (1) will be easily solved with AT89C5131.

That leaves me with number 2:
Is the protocol freely available?
What is the protocol's name, ie. what am I searching for?

Again, I want to read/write sectors.
aleksa wrote:
> I need to read/write sectors on > USB flash memory mass storage. > (I hope this is the correct title) > > AFAIK, this has two requirements: > > 1. hardware: USB connection. > 2. software: handshaking with USB devices. > > I think/hope that (1) will be easily solved with AT89C5131.
According to the data sheet here: http://www.atmel.com/dyn/resources/prod_documents/doc4136.pdf This device (like most) is a USB slave only. You need a USB Master to talk to a USB slave. This device can be programmed to be a slave only.
> > That leaves me with number 2: > Is the protocol freely available? > What is the protocol's name, ie. what am I searching for?
USB master code is much more complicated, and costs real money. Look for micro-controller with a USB master, then look for the cost of master code.
> > Again, I want to read/write sectors.
good luck don
On May 2, 7:26=A0pm, don <don> wrote:
> aleksa wrote: > > I need to read/write sectors on > > USB flash memory mass storage. > > (I hope this is the correct title) > > > AFAIK, this has two requirements: > > > 1. hardware: USB connection. > > 2. software: handshaking with USB devices. > > > I think/hope that (1) will be easily solved with AT89C5131. > > According to the data sheet here:http://www.atmel.com/dyn/resources/prod_=
documents/doc4136.pdf
> > This device (like most) is a USB slave only. > > You need a USB Master to talk to a USB slave. > This device can be programmed to be a slave only.
I didn't even know there are master/slave devices. Where did you, exactly, read in the doc4136.pdf that the device is slave only? Actually, I wanted to connect a USB memory stick to atmel's micro, then the micro to the PC to avoid learning how to work with PC's hardware. Maybe is easier to work with PC's hardware? No windows, only BIOS.
> > > > > That leaves me with number 2: > > Is the protocol freely available? > > What is the protocol's name, ie. what am I searching for? > > USB master code is much more complicated, and costs real money. > > Look for micro-controller with a USB master, then look for the cost of > master code. > > > > > Again, I want to read/write sectors. > > good luck > > don
aleksa wrote:
> On May 2, 7:26 pm, don <don> wrote: >> aleksa wrote: >>> I need to read/write sectors on >>> USB flash memory mass storage. >>> (I hope this is the correct title) >>> AFAIK, this has two requirements: >>> 1. hardware: USB connection. >>> 2. software: handshaking with USB devices. >>> I think/hope that (1) will be easily solved with AT89C5131. >> According to the data sheet here:http://www.atmel.com/dyn/resources/prod_documents/doc4136.pdf >> >> This device (like most) is a USB slave only. >> >> You need a USB Master to talk to a USB slave. >> This device can be programmed to be a slave only. > > I didn't even know there are master/slave devices. > Where did you, exactly, read in the doc4136.pdf that the device is > slave only? > > Actually, I wanted to connect a USB memory stick to atmel's micro, > then the micro to the PC to avoid learning how to work with PC's > hardware. > > Maybe is easier to work with PC's hardware? No windows, only BIOS. > >> >> >>> That leaves me with number 2: >>> Is the protocol freely available? >>> What is the protocol's name, ie. what am I searching for? >> USB master code is much more complicated, and costs real money. >> >> Look for micro-controller with a USB master, then look for the cost of >> master code. >> >> >> >>> Again, I want to read/write sectors. >> good luck >> >> don >
The data sheet does not say its a host device, so its not. You have some more homework to do before you can just drop in code and have it work. Start here: http://www.lvr.com/usb.htm If you just want to read/write USB sticks, use this and save a lot of headache. http://www.ghielectronics.com/product/1 don
>I didn't even know there are master/slave devices. >Where did you, exactly, read in the doc4136.pdf that the device is >slave only?
With respect - I think your understanding of USB needs to be improved before you tackle this project. I would recommend reading the following as a starting point: http://www.beyondlogic.org/usbnutshell/usb-in-a-nutshell.pdf -- Regards, Richard. + http://www.FreeRTOS.org Designed for Microcontrollers. More than 7000 downloads per month. + http://www.SafeRTOS.com Certified by T&#4294967295;V as meeting the requirements for safety related systems.
aleksa schrieb:
> I need to read/write sectors on > USB flash memory mass storage. > (I hope this is the correct title) > > AFAIK, this has two requirements: > > 1. hardware: USB connection. > 2. software: handshaking with USB devices. > > I think/hope that (1) will be easily solved with AT89C5131. > > That leaves me with number 2: > Is the protocol freely available? > What is the protocol's name, ie. what am I searching for?
Do you have a VERY GOOD reason for this? I'm asking because ... - USB itself is rather complex, the standard itself has some 1000 pages to read and to understand - USB hosts (and you want do make an USB host since the USB stick is a device) are a magnitude more complex especially in software than USB devices. Your AT89C5131 has only got an USB device interface. For USB host you need something bigger, eg. an ARM9. For writing a complete USB base and mass storage host from scratch you will need at least half a year, most probably more. My advice: 1. Try to redefine your problem. It is MUCH easier to read and write mmc/sd cards from the microcontroller, even for small ones. You can plug the sd cards into readers and use them as USB sticks then. If you choose micro sd cards the USB card readers even have the shape of an USB stick. 2. Get a microcontroller system with a capable os on it, eg. ARM7/ARM9 with Linux. Linux gives you a complete, tested USB host stack. -- Mit freundlichen Gr&#4294967295;&#4294967295;en Frank-Christian Kr&#4294967295;gel
aleksa wrote:
> I need to read/write sectors on > USB flash memory mass storage. > (I hope this is the correct title) > > AFAIK, this has two requirements: > > 1. hardware: USB connection. > 2. software: handshaking with USB devices. > > I think/hope that (1) will be easily solved with AT89C5131. > > That leaves me with number 2: > Is the protocol freely available? > What is the protocol's name, ie. what am I searching for? > > Again, I want to read/write sectors.
http://www.dontronics-shop.com/4d-udrive-usd-g1-tiny-disk-drive-data-storage-module.html is another way of doing it. Cheers Don... -- Don McKenzie Site Map: http://www.dontronics.com/sitemap E-Mail Contact Page: http://www.dontronics.com/email Web Camera Page: http://www.dontronics.com/webcam No More Damn Spam: http://www.wizard-of-oz.com http://www.dontronics-shop.com/super4-usb-relay-module.html
aleksa schreef:
> I need to read/write sectors on > USB flash memory mass storage. > (I hope this is the correct title) > > AFAIK, this has two requirements: > > 1. hardware: USB connection. > 2. software: handshaking with USB devices. > > I think/hope that (1) will be easily solved with AT89C5131. > > That leaves me with number 2: > Is the protocol freely available? > What is the protocol's name, ie. what am I searching for? > > Again, I want to read/write sectors.
Hi Aleksa, I think (like others) that You are underestimating what You want to achieve, USB is quite a PITA and Your replies show that Your knowledge is still very limited in this field. That is off course not a problem, You have to start on a subject at the beginning, just be prepared that it will not be a thing You will make on a rainy sunday afternoon. The controller You want to use is not capable of what You want to achieve. I would recommend You to get an Atmel USB-key, it's a very cheap demoboard with an AT90USB1287 controller that will allow You to talk to a slave (I am still working with it as a slave itself but with an adaptercable it can be used as a master, You can e.g. also connect a USB mouse to it). Link: http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3879. You might start reading the documentation and demoprograms that can be downloaded from Atmel to get an idea of what is involved. Another option might be, if it is possible for Your situation off course, writing to a CF-card that You can read back in a computer using a cheap cardreader. The interface to such a thing is much simpler. But maybe this is not possible at all and besides, with the stuff that comes with the USBkey it might just be not that difficult to implement Your own idea. Wishing You lot's of good luck and joy, Rene
First of all, thanks everyone for your replies.

I am currently looking into MAX3421E and hoping that the guy at
http://www.circuitsathome.com/mcu/programming/lightweight-usb-hostpart-1
knows what he is doing.

Don mentioned ghielectronics:
it's promising, cheap, 16$, but goes to 70$ with shipping..
plus a lot of people (as I read it quickly) has problems with it.

Richard, thanks for the usb-in-a-nutshell link! As it turns out,
I already had it in my favorites, but who can find it there..

As for the card readers... not sure, yet.

I got a headache just by looking into a list of links I have to visit.
aleksa wrote:
> First of all, thanks everyone for your replies. > > I am currently looking into MAX3421E and hoping that the guy at > http://www.circuitsathome.com/mcu/programming/lightweight-usb-hostpart-1 > knows what he is doing. > > Don mentioned ghielectronics: > it's promising, cheap, 16$, but goes to 70$ with shipping.. > plus a lot of people (as I read it quickly) has problems with it.
I too have used this part. It does work, if you have the time to debug it.
> > Richard, thanks for the usb-in-a-nutshell link! As it turns out, > I already had it in my favorites, but who can find it there.. > > As for the card readers... not sure, yet. > > I got a headache just by looking into a list of links I have to visit.
I hope you don't think you can just copy somebodies code, re-compile and have it work. I get the feeling you are a beginner with visions of being a hero. Good Luck, you're going to need it. don

The 2024 Embedded Online Conference