Smallest USB drive with Pic.

Status
Not open for further replies.

Pommie

Well-Known Member
Most Helpful Member
I finally managed to get a Pic18F2550 to behave as a USB drive using Microchips USB files. I think it's probably the most useless drive going as it has a capacity of just 4K. Next I'll try and get a serial EEPROM connected up to increase it's capacity.

If anyone is interested I can probably work out what I had to change in order to get it working (it wasn't much). The biggest headache was getting the bootloader to fit in 2k with the student edition of the C18 compiler. Once the compiler times out the code jumps to around 2200 bytes.

Mike.
 

Attachments

  • USB Drive.png
    23.2 KB · Views: 360
Dude i would love to see the code to this. It seems Very interesting. Im actually reading on USB now. Mostly on the RS232 Emu but would be nice to jump straight into USB.

I want to make either a HID or CDC (mainly CDC) device.
 
Dude i would love to see the code to this. It seems Very interesting. Im actually reading on USB now. Mostly on the RS232 Emu but would be nice to jump straight into USB.

I want to make either a HID or CDC (mainly CDC) device.

I would like to see it too.

The RS232 emulation is useful but it is what it is.
 
If you download and install the Microchip USB framework then you have all the code required. However, it is spread over lots of files and so complex that it's really hard to follow. Probably better to start with the **broken link removed** as this code is slightly easier to follow and there is a good forum for it at Sparkfun. If you use the UBW bootloader then the MSD (Mass Storage Device) code will work with minor changes.

Mike.
 

I was under the impression C18 SE does not have a limitation on code size, just turns off extensions and optimizations.
 
I was under that impression as well, it's 100% functional for a limited time trial, then loses some optimization.

Pommie didn't say anything about a limitation on code size. He said that when the trial period ends, the code size increases - that seems perfectly consistent with some of the optimisation being turned off.
 
If you read Mike's post he says he had a problem getting the un optimized boot loader code to fit in 2K. The is no code size limitation.
 
Yes, the problem was that the code grew in size due to optimization being turned off. The bootloader downloads code to 0x800 and without optimization the code went to 0x89f and so it wrote over itself.

Over the next week I'm going to try and turn the huge amount of code that Microchip supply into something that is more manageable. Hopefully, so it is more like the C examples on **broken link removed**.

Mike.
 
Hey i just tried:
**broken link removed**

I got it to work on a 18F2550! I was so excited when it worked lol. Now im off to alter it to my needs.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…