Need help communicating PIC18F2550 with a USB flash drive

Thread Starter

Lee Sin

Joined Jun 3, 2015
First of all, I am a total newbie with the whole coding thing. I am trying to create a "talk box" which basically plays an audio file according to the buttons that are pressed.

The requirements are :
The system must have a sleep mode to conserve energy (watchdog timer seems like the best idea to me)
The system must wake up from the sleep mode as fast as buttons are pressed
The system must be able to read the audio file (.wav) off of the USB flash drive and plays the file

So basically, I am stuck at the USB part. I have no idea how to make the PIC chip reads the file from the flash drive and play it. I have tried researching extensively but since I am a total newbie at this, nothing seems understandable to me. Any help will be appreciate.

Thank you,

Thread Starter

Lee Sin

Joined Jun 3, 2015
I have read through those articles and was able to understood a bit of information. I know I might be asking for too much but if anyone could help me explain how the USB flash drive can communicate with the device step-by-step, I would be eternally grateful.
Anyways, Thanks for your reply Technetium :D


Joined May 26, 2015
Your welcome, as you can see I'm a new member too, I am in an engineering shop in my high school, is this a project that you are doing(not part of a class or job)?


Joined Apr 24, 2011
Sorry but the PIC is not up to this job. The USB module inside it is a slave device, and so is a flash drive.

The Data Sheet said:
The PIC18FX455/X550 device family contains a full-speed and low-speed compatible USB Serial Interface Engine (SIE) that allows fast communication between any USB host and the PIC® microcontroller.
So you need to pick a PIC that has hosting capabilities. I peeked at the Microchip Advanced Part Selector (search for MAPS) on the Microchip site) and came up with only PIC24, DS33, and PIC32 devices that can support a host.

If you want to stay with a PIC18 then you may want to change to an SD card (as opposed to a USB flash drive) and these are supported by most any device with an SPI module which most PICs have.

I'm also sorry I can no longer guide people thru the free code libraries and samples Microchip provides: they updated these things a couple of years back and I'm still sorting my way thru them (or using the previous version I used when I wrote the code I'm now using). But there is most probably good code to support you either way you go.

Do try the Microchip forums, they are full of smart guys who are current on this stuff.

Brian Griffin

Joined May 17, 2013
This is not a straight-forward solution as USB drivers for flash drives can take a very large amount of space in a USB-host capable microcontroller. It can be very difficult, and you need custom chips to do that for you.

You might need this: and connect this to your microcontroller.

Or, by using an SD-Card - there are many examples about playing wave files online using a microcontroller.

John P

Joined Oct 14, 2008
Could you possibly change this from a USB memory stick to an SD card? That would change the level of difficulty from "just about impossible" to "pretty challenging" though I'm afraid either of those is a poor choice for a "total newbie with the whole coding thing". The school that you're graduating from shouldn't be expecting a beginning programmer to do this kind of project alone.