Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 26th June 2007, 11:44 AM   #1
Question (*)How to access USB pendrive using PIC18f4550?(**)


Hi all.. i am involving with a final year project. It regards with a desighn of USB support mp3 player.
The concept of this design is to design a mp3 player where we can play mp3 files by taking them from a USB pendrive.

I am using PIC18f4550 as my microcontroller and currently i am having a problem of scanning ONLY MP3 files from the USB pendrive. I dont know how to select this specific file type and plz help me to get through this as soon as possible..

Thanx alot...

I'd like to show a similar project i got from internet to give u brief idea about what i am going to do.. The design is almost exactly the same instead the parts of getting mp3 files through RS232 in this project..

Plz refer if u can...

http://instruct1.cit.cornell.edu/cou...tm#pushbuttons

chamith20xx is offline  
Old 26th June 2007, 12:30 PM   #2
Default

Reading just the MP3 files is a simple file system operation, using wildcards like '*.MP3' - however, reading the pen drive is a different matter, as it needs to be plugged into a USB host, and the PIC is a USB slave. This is why it's more usual to use an SD memory card.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 26th June 2007, 03:53 PM   #3
Default

You're worrying about the wrong thing entirely, and have clearly overlooked an extremely important factor - why worry about reading MP3 files before you figure out how to actually access the drive?

With the current offerings from Microchip, a PIC CANNOT be used as a USB host, which means it CANNOT access a USB pen drive. If you don't believe me, go to the USB section of the Microchip forums:
http://forum.microchip.com/tt.aspx?forumid=102
and look through the information there - this kind of question gets asked almost on a daily basis, and there are plenty of knowledgeable posts on the matter.

You can do it by using a separate, external USB host controller IC, but they are expensive and usually quite complicated.

Nigel's right, you would be MUCH better off storing your files on a more easily readable memory format, such as an SD card - you'll probably notice that most homemade MP3 players use this type of memory card (or similar). Interfacing them with a PIC is quite easy, and they can still be accessed on your PC by sticking them in a card reader, if you decide to implement the FAT file system on the card.
__________________
EEgeek.net
evandude is offline  
Old 26th June 2007, 05:04 PM   #4
Default

The above two gentlemen offered really sound advice.

But if they still have failed to convince you otherwise and you want to boldly go ahead, then get yourself the latest(July 2007 issue) CircuitCellar Ink magazine. It has a featured article with actual circuit schematic and source coding on how to use an ASIC chip to read from a flesh drive, outputting data via SPI or serial interface.
__________________
L.Chung
eblc1388 is offline  
Old 26th June 2007, 07:12 PM   #5
Default

this does raise the question - what does it take to implement a host with out a custom chip? I've not seen the CCI article.
philba is offline  
Old 26th June 2007, 11:57 PM   #6
Default

Quote:
Originally Posted by philba
this does raise the question - what does it take to implement a host with out a custom chip? I've not seen the CCI article.
it takes a custom chip

usb is a proprietary software driven serial protocol, there's no common off the shelf way to do it with simple parts.
__________________
If you don't have a planet, what good are gold bars?

want to contact me directly? gmail gordonthree
check out my project website: http://projects.dimension-x.net
Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
justDIY is offline  
Old 27th June 2007, 12:38 AM   #7
Default

In short (very short), the USB host manages EVERYTHING that goes on on the bus - all communication with every device, in either direction, is done by the host, and there's a lot of protocol it has to take care of and a lot of timing constraints it has to meet, even when it's not dealing with much data. Unfortunately, even if there's only one device on the bus (like a pen drive) the host still has a lot of work to do. This is why USB On-The-Go (OTG) was developed, which allows for special situations where a much simpler USB host can be used to talk to a single compatible device, which makes it MUCH more feasible for a microcontroller to have the ability to talk to a USB device. Supposedly Microchip has PICs with USB OTG capability in the works, but who knows when they'll be available.

If you really want to appreciate the amount of work implementing a host can be, I suggest you check out a book such as "USB Complete" where the protocol is explained.
__________________
EEgeek.net
evandude is offline  
Old 27th June 2007, 11:26 AM   #8
Default

The ASIC itself is actually a microcontroller with 64K of code memory running a software program, handling the data according to the USB Host Specification.

User can "upgrade" the software if new version is available from the manufacturer.
__________________
L.Chung
eblc1388 is offline  
Old 27th June 2007, 08:49 PM   #9
Default

hmmm, then shouldn't it be possible to write a hub program on a reasonably capable microcontroller? (yes, I hear the words "large amount of work".) I'll have to check out the book.
philba is offline  
Old 28th June 2007, 07:01 PM   #10
Cool


Dear friends ..thnx alot for the kindfull advices share regarding this matter...
i gave up to buildup my project to read USB pendrive and take mp3 files from it. as u all suggest i made up my mind to do this project by using SD memory card.
But still i have problem of reading it using PIC microcontroller..

well if u can please explain how should i do it and if there are any SD card reader sockets that we can buy as a part without from SD card reader to intigrate it to the project i am going to do...

The replies you will give are so appreciated and feel free to send them as soon as possible you can.

If there is a c code which can use to acccess SD card through pic18f4550 ( which is more reliable for the later part of my project) plz email me

chamith300x@gmail.com

or paste it as a reply for others use...

Thanx a lot for the kind help..



Last edited by chamith20xx; 28th June 2007 at 07:33 PM.
chamith20xx is offline  
Old 28th June 2007, 07:24 PM   #11
Default i am so confused now ..plz help..


Hi friends.. i would like to tell a word regarding this project...i am so confused when u say that we cant access USB pendrive from PIC18f4550....
I came accross the below link and it says we can do the USB access by using 18f4550 in the following way..
plz refer : http://www.create.ucsb.edu/~dano/CUI/


the other thing i went confused is that a book i downloaded about mass storage which is known as " USB Mass Storage Designing and Programming Devices and Embedded Hosts by Jan Axelson" says that we can use the pic18f4550 to access USB pendrive without USB hostcontroller because the PIC18f4550 has integrated with USB hostcontroller.I dont get the exact meaning what he suppose to convince but according to my knowledge he says about what i am trying to say... ( You can refer page 6 of the below book with a diagram even)

so pals actually i am totally confused with this two things and plz help me to solve this as soon as posible even i made up my mind to do the project using SD memory card...

Thanx alot.


the book is



U can download the above book from following link and be kind enogh to see page 6 of that book and please solve this dilemma.. u can even see the codings he has used here which used to access USB pendrive but it is in unstructured manner though.. plz help
http://rapidshare.com/files/39895533....2006.pdf.html




Last edited by chamith20xx; 28th June 2007 at 07:38 PM.
chamith20xx is offline  
Old 28th June 2007, 07:47 PM   #12
Default

Quote:
Originally Posted by chamith20xx

Hi friends.. i would like to tell a word regarding this project...i am so confused when u say that we cant access USB pendrive from PIC18f4550....
I came accross the below link and it says we can do the USB access by using 18f4550 in the following way..
plz refer : http://www.create.ucsb.edu/~dano/CUI/



On a quick read, it never even mentions 'pen drives'?, never mind suggesting it can use them.

Quote:

the other thing i went confused is that a book i downloaded about mass storage which is known as " USB Mass Storage Designing and Programming Devices and Embedded Hosts by Jan Axelson" says that we can use the pic18f4550 to access USB pendrive without USB hostcontroller because the PIC18f4550 has integrated with USB hostcontroller.I dont get the exact meaning what he suppose to convince but according to my knowledge he says about what i am trying to say... ( You can refer page 6 of the below book with a diagram even)

so pals actually i am totally confused with this two things and plz help me to solve this as soon as posible even i made up my mind to do the project using SD memory card...

Thanx alot.


the book is



U can download the above book from following link and be kind enogh to see page 6 of that book and please solve this dilemma.. u can even see the codings he has used here which used to access USB pendrive but it is in unstructured manner though.. plz help
http://rapidshare.com/files/39895533....2006.pdf.html


Again, page 6 of that book doesn't seem to say anything about using an 18F4550 to access a pen drive? - all it says is that you need a host controller, which an 18F4550 doesn't have.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 28th June 2007, 09:19 PM   #13
Default

check out the Cypress SL811HST embedded USB Host/Slave controller. it's in a fairly friendly PLCC package.

Features

* First USB Host/Slave controller for embedded systems in the market with a standard microprocessor bus interface
* Supports both full speed (12 Mbps) and low speed (1.5 Mbps) USB transfer in both master and slave modes
* Conforms to USB Specification 1.1 for full- and low speed
* Operates as a single USB host or slave under software control
* Automatic detection of either low- or full speed devices
* 8-bit bidirectional data, port I/O (DMA supported in slave mode)
* On-chip SIE and USB transceivers
* On-chip single root HUB support
* 256-byte internal SRAM buffer
* Plus more ..
__________________
If you don't have a planet, what good are gold bars?

want to contact me directly? gmail gordonthree
check out my project website: http://projects.dimension-x.net
Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
justDIY is offline  
Old 29th June 2007, 03:52 AM   #14
Default

Quote:
Originally Posted by Nigel Goodwin
On a quick read, it never even mentions 'pen drives'?, never mind suggesting it can use them.



Again, page 6 of that book doesn't seem to say anything about using an 18F4550 to access a pen drive? - all it says is that you need a host controller, which an 18F4550 doesn't have.

Dear sir...

Page 6 of that book says :
• A USB host controller, which can be embedded in a microcontroller chip
or on a separate chip that interfaces to the CPU, microcontroller, or
other intelligent hardware.
• A generic hard drive, flash drive, or other media connected to a USB port
on the host.

and the diagram which stated just above is this





and the pasge 39 of that book says,

" Microchip Technology’s PICmicro® microcontrollers are popular because of
their low cost, wide availability, speed, capabilities, and low power consumption.
The PIC18F4550 is a PICmicro microcontroller with an embedded
USB device controller that can communicate at low and full speeds.
The chip doesn’t have specific support for mass storage but is suitable for
mass-storage applications that need to store and transfer moderate quantities
of data at moderate speeds. The example firmware in this book is written for
the PIC18F4550 and Microchip’s C18 C compiler."


At the later part of that book starting from page 40 onwards it says about USB mass storage devices and couple of examples were give there regarding on how to access and how to write a byte to flash memory.

page 64 says about " Preparing to Send Data to the USB Host" and a coding is given. The later part of the book describe about " bulk transfer " from USB storage. ( u can go through subhedding wise to get the things what i am saying without reading the whole document comencing on Page 64 onwards

PS: u cant find the real pages by typing page number at the bottom of page finder and please go through the page numbers in each page respectively)

So i came to a conclusion by reading those stuff that this is kind of way of accessing USB drive using pic18f4550 since the author says that this is coding reagrding on USB accessing using pic18f4550.

PLease solve this terrible confusion on me.. thanx alot..

chamith20xx is offline  
Old 29th June 2007, 03:58 AM   #15
Exclamation

Quote:
Originally Posted by Nigel Hi friends.. i would like to tell a word regarding this project...i am so confused when u say that we cant access USB pendrive from PIC18f4550....
I came accross the below link and it says we can do the USB access by using 18f4550 in the following way..
plz refer : [url
http://www.create.ucsb.edu/~dano/CUI/[/url]



regarding the above link , isnt the below block diagram shows any thing about how accessing USB ? am so confused..



Let me know this please.. thanx alot
chamith20xx is offline  
Reply

Tags
access, pendrive, pic, usb

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
What are the ports of usb? and how to control the remote control through the usb? u1988 Electronic Projects Design/Ideas/Reviews 0 13th June 2007 09:25 PM
basic usb experimentor? justDIY Electronic Projects Design/Ideas/Reviews 7 18th April 2007 10:30 PM
wireless USB????????? Badar General Electronics Chat 8 17th April 2007 12:52 PM
Website access, from which country? sram Chit-Chat 17 25th September 2006 07:45 PM
Access GSM mobile with AT commands - pics put up indranil Electronic Projects Design/Ideas/Reviews 2 12th February 2006 01:28 PM



All times are GMT. The time now is 04:25 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker