View previous topic :: View next topic |
Author |
Message |
confini
Joined: 29 May 2006 Posts: 6 Location: Italy
|
USB mass storage with PIC18F4550 |
Posted: Thu Jul 27, 2006 4:29 am |
|
|
Hi everybody!
I would like to know if someone had success in implementing the USB mass storage application with a USB PIC (I am using the 18F4550) as described in the microchip AN1003 "USB mass storage using PIC MCUs", where is used the microchip C compiler.
thanks since now for your support,
Nicola |
|
|
JohnLeung
Joined: 18 May 2004 Posts: 15
|
Implementation of a Mass USB Storage (Microchip AN1003) |
Posted: Thu Jul 27, 2006 11:49 am |
|
|
Yes, I did on a home-grown PCB with 18LF4550, 3.3V Vdd. SD card is a 64MB SD card. Complier is C18 version 2.40. That SD card has some jpeg for my digital camera. With that home-grown PCB with SD socket, I was able to view those pictures on PC.
John Leung |
|
|
confini
Joined: 29 May 2006 Posts: 6 Location: Italy
|
|
Posted: Fri Jul 28, 2006 1:31 am |
|
|
Hi,
sorry for my bad post, but what I was searching for is an implementation of USB mass storage made with CCS compiler.
When you write "Complier is C18 version 2.40", I think that isn't CCS C, right?
anyway thanks for your answer, all the best
Nicola |
|
|
JohnLeung
Joined: 18 May 2004 Posts: 15
|
USB Mass Storage |
Posted: Fri Jul 28, 2006 2:43 am |
|
|
No, I didn't mean CCS.
I meant C18 complier.
John |
|
|
Bart
Joined: 12 Jul 2005 Posts: 49
|
no change |
Posted: Mon Aug 14, 2006 3:08 pm |
|
|
Hello confini,
I don't think you will find the implementation for the usb mass storage in CCS. It is very complex. Less complex are the MMC and SD cards. But even for those you won't find a FAT code (with example) able to write on it (reading should be no problem)
Best greetings. |
|
|
Picmouse
Joined: 20 Mar 2007 Posts: 7
|
|
Posted: Tue Mar 20, 2007 6:39 pm |
|
|
Hello, I have the same necessity. I already proved the AN1003, but it doesn't work, I believe that my problem this in the circuit. do you know which the circuit that should be used is? |
|
|
esbrasil 2 Guest
|
|
Posted: Fri Jun 08, 2007 8:21 am |
|
|
Getting AN1003 to work wasn't so hard, i even have some small FAT16 implementation working. i compile with Microchip's c18 compiler.
I have some other project were i use the ccs compiler, i would like to be able to compile the AN1003 software with the PCWH (is for pic 18 isn't it?) compiler.
Has anyone a kind of steps to do plan how to proceed? I tried the search on this forum but it didn't bring up anything very useful.
Thanks... |
|
|
guy
Joined: 21 Oct 2005 Posts: 297
|
Any news regarding emulating a USB mass storage device ? |
Posted: Tue Jun 19, 2012 1:05 am |
|
|
Has anyone done this with CCS and can post the code please?
I am not talking about accessing a usb stick but rather to emulate it when connected to a PC.
Thanks. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Tue Jun 19, 2012 5:02 am |
|
|
Well I'm confused...
I'm reading that you want the PIC to emulate a USB flash memory device.If so, why? Over 1/3 of the codespace will be just the USB driver.There isn't any real room left for a 'file' for data let alone the code to access it.Well you might get a file of about 1k of data, maybe..
What exactly do you want the PIC to do ? A better description will help all of us. |
|
|
guy
Joined: 21 Oct 2005 Posts: 297
|
|
Posted: Tue Jun 19, 2012 5:14 am |
|
|
I didn't describe the whole application. Basically I need to transfer large files between a PC and an external flash chip, but the PIC has other tasks too. What I'm missing is the USB MSD routines. I would like to avoid C18 at all costs :-) |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Tue Jun 19, 2012 6:20 am |
|
|
Well the EASIEST way is to buy an FDTI Vinculum based USB flash drive module for <$30!
In less than a day you should have your project COMPLETED!
I've got a couple solar energy dataloggers 'up and running' in a couple of days( as I'm NOT a C programmer) once I decided that storing the data in dotCSV format was the best choice(allows PC pgm like Excel to auto load !)
ALL the hardwork of interfacing,FAT tables,etc. is already done. Simply 'talk' to the Vinculum using serial commands to create files,read data,directories, subdirectories,etc.Everything is DONE, and it works.
I've burned my units to run at 115K200 without handshaking and they work flawlessly, NO loss of data.
It's up to you to decide what your time is worth,what level of frustration you 'enjoy', and when the deadline is.
$30 for an 'off the shelf', 'plug and go' solution was the choice for me.
I now have the 2 USB port version here which allows my PIC to be configured as both HOST and SLAVE at the same time.Yet another 'project' to play with,when time allows.
I have nothing to do with FDTI(wish I had stock though !), just love their solution. |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Tue Jun 19, 2012 8:43 am |
|
|
If the goal is to transfer large amounts of data from and to a PC via usb the CCS usb code is just fine. Microchip has PC API's that have a bulk transfer function. Each connected PIC ex 18F2455 with usb enabled will show up as a Microchip Custom USB device. The API gives you handles to each device and if you embed a serial number in every PIC you can poll them and associate a specific PC handle to each PIC. You have to use Microchips vid pid options but approved vid pid's are a usb requirement anyway,
Depending on the purchased software licenses the PC app reads whatever file in whatever format and gets say 512 bytes at a time. This 512 bytes of data is transferred to the PIC RAM. The issue is passing it forward to the external storage since it may require a file system that the PIC must manage. Here the PIC is limited to some extent.....external storage often has page writes /erase issues which demand lots of RAM...even simple MMC needs 512 for a minimal block update. Further many file formats are copywrited EX FAT so there are US legal reasons not to publish code. As to time involved it comes together almost as fast as you can compile ...minutes... takes up a few pins of the 18F2455 D+ D- and Vusb..moderately restricts your PIC oscillator choices due to rigid usb bus speed dictates.
I don't see the issues others are having ...I include the CCS usb files wire up D+ D- 5v and ground hook Vusb via a .22uf cap to ground wire up ICSP compile download and the PC app is talking to the PIC via usb. Now the Microchip usb drivers have to be installed once per PC so there is some advantage to the external USB interface chips if they go via drivers that come with the PC OS and thus are effectively pre-installed. The Microchip driver approach has the advantage of controlling the transfer at both the PC and the PIC end..the plus of talking to multiple connected PIC's from the one PC app etc. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19545
|
|
Posted: Tue Jun 19, 2012 8:57 am |
|
|
Ex_scope.c implements a bulk transfer USB setup (but not a mass storage application).
Best Wishes |
|
|
|