How can I read USB flash drive with AVR ?

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys,

How can I read USB flash drive with AVR ?
Or PATA hard drive ?
I want to use my old storage for AVR

Any links or experiences ?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From reading many and various threads here, it would be easier to use SD cards. USB flash drive would need a USB host, or possibly USB OTG(on the go), which is probably beyond the scope of your AVeRage 8 bitter. You might be able to disassemble the USB stick, and remove the Flash chip, which may, or may not be a serial device.

Four legs good, two legs bad, three legs stable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What chip do I use for USB host ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:
Any links or experiences ?
You do know how to use Google, yes?

First hit when searching for "avr"+"ide hard drive":

But I agree with @John_A_Brown, you'd be better to just use and SD card. All the work has already been done, libraries written, etc.

JJ

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To read a USB memory stick (which is a USB MSD class "device") you need a USB "host". Only two chips in Atmel's 8bit AVR range have a limited form of USB "host" mode (salled USB On the Go or just OTG). These are the AT90USB647 and AT90USB1287. If you use those with Dean's "LUFA" software stack for USB you will find he has examples showing how they can host MSD devices.

As John says it's not an easy way to add memory to an AVR though - SD/MMC cards are about 100 times easier.

The same holds true for PATA. If you Google you will find projects where PATA has been interfaced to AVR but as it's a 40 pin parallel bus and almost every signal in that bus is used for the interface it involves a LOT of bit wiggling on the AVR side.

It would be easier to use an MCU with a PATA controller then give it a "simple" interface across to the AVR.

But when you think about it floppies and parallel HDDs have all but died out these days for the very reason that SD/MMC has surplanted their use for 99% of most applications. So just use the very simple to interface SD/MMC - you can add Gigabytes of storage that way which is probably more than the PATA capacity these days. (they also don't get hot, break down mechanically or gobble power!).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A PC + serial line might work...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So better use SDcard then...thanks folks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

So better use SDcard then...thanks folks

Yes but, if using AVR, that means MMC-SPI mode not the 4 bit wide interface (for which you either need to use silicon with an SD interface controller of pay the SD Card association a licence to use).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looks like the simplified specifications include the 4-bit interface:

https://www.sdcard.org/downloads...

But perhaps they're given out for free with a licensing that prohibits their use without payment or something.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

how about price consideration? PATA or SATA hard drive is a lot cheaper per gigabyte, and for experiment I have old PATA drive which I can use...it's already 40Gb...
even 160Gb drive is cheaper...

What do you guys reckon ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:
how about price consideration? PATA or SATA hard drive is a lot cheaper per gigabyte, and for experiment I have old PATA drive which I can use...it's already 40Gb...
even 160Gb drive is cheaper...

What do you guys reckon ?

What are you planning on using the storage for?

4GB SD cards can be had for under $5. Price/GB goes down from there. Are you going to fill 4GB? With an AVR?

Already mentioned, but what about power? Spinning rust takes a lot of juice. Forget about battery power.

JJ

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm going to use transformer not battery,
it's somekind a reader => viewer / player...

I think this one is a good start
[url]
http://www.opend.co.za/hardware/...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, suppose you have an USB-SPI adapter: your avr will have at most 10Mbites/second, ie., for an 40Gdisk (ther exist PATA/SATA<->USB adapters at 15E$) 10 hours : I doubt 10 hrs of music could be pleasant.
There is another issue with PATA disks : one can find them at zero $ per Gbit -I was given 3 of them, from old PCs-, one can plug them into newer PCs via an USB adapter, but they do not last (one lasted 2 weeks, others ones lasted 3 months). This makes a big contrast with electronic equipment, which can last for years, without worrying to (try to) repair....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

how about price consideration? PATA or SATA hard drive is a lot cheaper per gigabyte, and for experiment I have old PATA drive which I can use...it's already 40Gb...
even 160Gb drive is cheaper...

What do you guys reckon ?


If you were storing huge videos that were 10GB each or something I could see why you'd need the most GB/$. But surely an AVR cannot be accessing GBs (TBs? PBs?) of data can it? An AVR could spend its life filling 1GB!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dbrion0606 wrote:
There is another issue with PATA disks : one can find them at zero $ per Gbit -I was given 3 of them, from old PCs-, one can plug them into newer PCs via an USB adapter, but they do not last (one lasted 2 weeks, others ones lasted 3 months).

My experience is quite different. I still have a few disks in a box here that have been spinning uninterrupted for maybe 15 years ! without problems.
On the newer boxes (with huge sata drives) i've had to replace disks twice already in the past 5 years.

Though I admit, if i power down those PATA disks they'll probably never be able to spin up again.

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, I have two universal {P,S}ATA <-> USB adapters and when I am given disks -this is the only thing I can salvage from old PCs- I use them to test new releases of GNU-linuxen and have to power up and down these old disks very often -such tests are not always satisfying- . I would not trust them for {usual, regular} use...