Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

(*)How to access USB pendrive using PIC18f4550?(**)

Status
Not open for further replies.

chamith20xx

New Member

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...

https://instruct1.cit.cornell.edu/c...ects/s2004/dtc24/report/index.htm#pushbuttons

 
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.
 
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:
**broken link removed**
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.
 
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.
 
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 said:
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.
 
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.
 
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.
 
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.
 

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..:confused: :confused:

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..:)

:D
 
Last edited:
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 : **broken link removed**


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...:(:rolleyes:

Thanx alot.


the book is
**broken link removed**


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
**broken link removed**



 
Last edited:
chamith20xx said:

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 : **broken link removed**



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

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...:(:rolleyes:

Thanx alot.


the book is
**broken link removed**


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
**broken link removed**

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.
 
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 ..
 
Nigel Goodwin said:
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

**broken link removed**



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..:)

 
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 : **broken link removed**[/QUOTE said:


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


Let me know this please.. :) thanx alot
 
What's to be confused about?, the diagram is a USB slave, and NOT a USB host - page 6 of the book also says you need a micro-controller with an internal USB HOST controller (or a seperate one) - the 18F4550 DOESN'T HAVE THIS!.
 
As far as I know, a pen drive is a "USB Slave" and a PIC18F4550 is ALSO a "USB Slave". You cant attach them together.

What you need on one of the sides is a "boss" known as a USB Host.
You are not getting the gender pairing right.

I am not aware of any PIC or AVR that has a USB Host inbuilt. Perhaps some ARM would have one.
 
And then there's the part about MP3 decoding, wait till that comes up. A dsPIc might have the horsepower to do it internally but you'd need a dedicated MP3 playback chip like the VS1001 for other PICs.
 
For my senior design project we used the AT90USBKEY kit. It can be configured to act as a USB host, but we used it only for data transfer to a PC.
 
Status
Not open for further replies.

Latest threads

Back
Top