CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

eeprom usb flash

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sharris2013



Joined: 23 Feb 2014
Posts: 4

View user's profile Send private message

eeprom usb flash
PostPosted: Sun Feb 23, 2014 6:30 am     Reply with quote

Hello,

is it possible to use the usb driver on a pic to show the eeprom as a removable drive on a pc?
Basically what I want to do is to plug a pic into pc, get it to show as a removable drive, drag a config file to the memory, close usb connection then launch the configuration file on pic.
any ideas or existing code libraries would be very appreciated.
Regards
sh
temtronic



Joined: 01 Jul 2010
Posts: 9177
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Feb 23, 2014 8:36 am     Reply with quote

yes...anything is possible ....
if this 'configuration file' is just a set of 'parameters' then just use the CDC version of the USB driver and communicate that way,once the 'file' is downloaded and stored into eeprom, have a flag reset the PIC to use the new 'configuration file' data.

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19381

View user's profile Send private message

PostPosted: Sun Feb 23, 2014 10:40 am     Reply with quote

Problem is _size_.

Unfortunately, there are minimum sizes for most 'removable drives' on a PC. Even a floppy, has a directory structure that uses space.
As such, the simple answer for the internal EEPROM, is no.

There are 'ways' of doing this by writing your own PC drivers, but not using the standard removable media drivers....
sharris2013



Joined: 23 Feb 2014
Posts: 4

View user's profile Send private message

PostPosted: Sun Feb 23, 2014 9:43 pm     Reply with quote

Ok thanks.
what I want to do is not have any software required to install on pc. If size is the issue maybe an external eeprom chip could work. I have programmed sd card access before but that seems overkill for a few hundred bytes of data.
Would it be possible to interface to external eeprom via usb?
Has anyone done this?
temtronic



Joined: 01 Jul 2010
Posts: 9177
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Feb 23, 2014 10:14 pm     Reply with quote

I'm confused as to what you really want or need. Your first post said there was a 'configuration file' on a PC that needed to be transferred to a PIC.That means you must have some kind of program on the PC to transfer the data to the PIC.Now you say you could use an SD card to transfer the 'configuration' file.
We really need to more about the project. Will the PIC always be connected to the PC? If so, then the USB-CDC driver would work, as the PIC would look like a 'serial device' to the PC. CCS has an example in their 'examples' folder.
If you need 'portability'( no direct linkage) and you've got SD card interface 'up and running' , use it. Sure it's 'overkill' as far as memory size goes, but SD cards are cheap,just buy the smallest ones you can find.
Wireless options are many, though price may be a factor.IR is cheap to implement.
One system or hundreds to make? Cost per unit? Timeline?
Which PIC? You should choose one that can stor TWO 'configuration' files.Old and new, incase 'new' oe has bad data, 'old' can still be run.
Again, we need to see what the 'big picture' is to comment further.

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19381

View user's profile Send private message

PostPosted: Mon Feb 24, 2014 1:44 am     Reply with quote

An external EEPROM, can be handled via the PIC, to appear as a removable drive on the PC. However you are back to needing to handle a file-system, with all the overhead this imposes, and minimum sizes allowed for file-systems.
For FAT16, the minimum volume size allowed by Windows, is 4,299,161 bytes
However you can make it appear as a removable floppy, and this then uses FAT12, and the smallest supported for this is media descriptor 0xFC, with 184320 bytes.

There is just as much work (more....), involved in doing this, as in using the SD card. With a memory interfaced like this, as well as the file system, you are going to have to handle USB traffic, which is a lot more complex than the SPI interface to the SD....
Key thing to remember is that as soon as you talk to a 'drive', you have a file system involved. Applies with both USB, and SD.

As temtronic has said, SD cards are cheap.

The alternative, is to forget the 'being seen as a drive', and just implement CDC, with your own command language. About a half dozen line scripting program, could send a 'are you there' type message, followed by the contents of a configuration file, if the card is found. Smaller, quicker, and safer....

Best Wishes
sharris2013



Joined: 23 Feb 2014
Posts: 4

View user's profile Send private message

PostPosted: Mon Feb 24, 2014 5:13 am     Reply with quote

Ok so maybe I should clarify a little.
I need a way of getting a configuration file from a pc (could be any pc) the pic is not permanently connected and the pc should have no sw on our as it could be any different pc next time.

I have implemented an sd card implementation before but not in this project.

I would only like to store one file on the pic as this makes reading the configuration file easier (if there is only one then that is the one to use)

I saw mass storage device as the simpler way as the pic would appear on 'any' pc without needing any software on the pc

It looks like I will have to implement sd card architecture that detects when removed from pc and then read the file that has been stored?

Unless I can make the eeprom with file system and minimum size etc etc appear to the pc to only have xx kb free hence only 1 file can be stored at a time?

Regards
sharris2013



Joined: 23 Feb 2014
Posts: 4

View user's profile Send private message

PostPosted: Mon Feb 24, 2014 5:24 am     Reply with quote

I have seen this sort of problem elsewhere on the Internet. Other suggestions that have been made are the Chip Card Interface Device.
I am unsure how this may help but had anyone used this before?
Regards
temtronic



Joined: 01 Jul 2010
Posts: 9177
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 24, 2014 6:50 am     Reply with quote

Perhaps the simplest,easiest method would be to use a Vinculum based flashdrive module. Costs about $25. Dead simple to use. ANY PC with a USB port can be used.PIC can detect when fd/file is in place. Easy serial interface to PIC. NO drivers required. No 'overhead/codespace' for file access code. Fast, I run mine at 115k200 with zero transfer errors.
The only 'downside' is the $25 cost BUT it is an instant solution, you can be 'up and running' in a couple hours....project COMPLETED...
Some problems with SD cards are...1) not ALL PCs have SD interfaces, 2)PIC need SD drivers=big codespace, 3)SD 'holder'/module is small, 4) SD code(driver) issues as not ALL SD cards are the same.
I went the Vinculum/FD based solution for my dataloggers. The upfront cost was NOTHING compared to days/weeks of cutting reliable SD code AND getting solid hardware. Flashdrives are cheap,any size works and every PC understands them. Use a PIC with 2 hardware UARTS (like the 18F46K22), one port for the FD, the other for debugging.

The bottom line is, well, the bottom line. What can you afford? $25 for an 'off the shelf' 2 hour solution or spend 1/2 that on SD hardware and days of slogging through code that 'almost' works?

hth
jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group