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 CCS Technical Support

Write data/files to a medium (USB stick, MM CARD..) via PIC

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



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

Write data/files to a medium (USB stick, MM CARD..) via PIC
PostPosted: Tue Oct 03, 2006 12:48 am     Reply with quote

Hi,

I want to read a text/strings/data via a keyboard and then I want to save it on a medium. I was thinking about an USB stick.

How difficiult is it to implement that? Are there libraries available? I should be able to write data onto the stick and read data from the USB stick. Is it possible with a PIC, and which one? Do you have to write a driver?
Can it be done with the CCS development kit?

Are there any easier alternatives to implement with a PIC ? (I see SD cards come here frequently)
What is a good development kit for data logging on SD cards?

Some hints/tips on this one please, tks
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: Write data/files to a medium (USB stick, MM CARD..) via
PostPosted: Tue Oct 03, 2006 1:39 am     Reply with quote

Christophe wrote:
Hi,

I want to read a text/strings/data via a keyboard and then I want to save it on a medium. I was thinking about an USB stick.

How difficiult is it to implement that? Are there libraries available? I should be able to write data onto the stick and read data from the USB stick. Is it possible with a PIC, and which one? Do you have to write a driver?


To do this you require the PIC to implement a USB host interface. All USB interfaces on the PIC are non host ports. You can get a Maxim USB host controller to connect to the PIC via the SPI bus. But there are far easier ways of doing what you want

Quote:

Can it be done with the CCS development kit?


No because it is not a USB host.

Quote:

Are there any easier alternatives to implement with a PIC ? (I see SD cards come here frequently)


Yes. SD/MMC cards interface to the PIC via the SPI bus. Electrically they are simple to interface - there is a trick, the SD/MMC cards are (generally) 3.3 volt interfaces and most PICs are 5 volts. If you check out the projects page on my web site you will find a number of (working) reference hardware designs to download that demonstrate how to connect reliably to an SD card. Becareful of some of the other PIC interface circuits you will find on the web as often they correctly handle the 5-to-3.3 for output liines to the SD card but fail to handle the SDI to the PIC from the SPI card. If this is not handled correctly you can find yourself with the problem that the cards appears to fail in obscure conditions.

Quote:
What is a good development kit for data logging on SD cards?
Microchip have a SD/MMC PICTail card but I have no used it.

Quote:
Some hints/tips on this one please, tks


If you want the PC to be able to read the SD/MMC card using the standard fat file system then you will need both SD card drivers (available with CCS) and a Fat file system. There is a FAT file system in the CCS user download area however I spent a lot of time working with it but gave up on it.

Here is a link to another FAT filesystem implementation http://elm-chan.org/fsw/ff/00index_e.html

I have ported the ELM implementation the PIC and have modified it to reduce the memory footprint with the PIC and CCS, add some additional features I required, as well as dealing with compiler idiosyncrasies. I use my own SD drivers. I have been working with this implementation since July but have only recently got it to the stage where I can progress with my own data logger project. I plan to sell the source code for the port on my web site in the few couple of weeks once I have completed some performance and reliability testing.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Christophe



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

PostPosted: Tue Oct 03, 2006 1:50 am     Reply with quote

Thanks for your input; I thought that implementing an USB host would be hard.
This will be a project for students that come to make their thesis at our company.

What PIC do you advise for implementing MMC cards?

Are there any memory requirements? I've read that you have to write in 512 byte blocks; so having a lot of RAM would be welcome?
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Oct 03, 2006 2:01 am     Reply with quote

Quote:
Thanks for your input; I thought that implementing an USB host would be hard. This will be a project for students that come to make their thesis at our company.


Well this will certainly sort out the good from the not so good :-)

Quote:

What PIC do you advise for implementing MMC cards?

Are there any memory requirements? I've read that you have to write in 512 byte blocks; so having a lot of RAM would be welcome?


Your reseach has hit the mark. The more RAM the better. Personally I would (and do) use 18F 2620/4620/8722 and variants that have 3900 bytes RAM. It is a waste of time using anything under an 18F series processor for SD/MMC cards if you want to implement a FAT file system.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Christophe



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

PostPosted: Tue Oct 03, 2006 2:19 am     Reply with quote

Hi,

I also found this implementation:

http://chipdos.com/index.htm

Seems that this takes care of the fat file system overhead. What's the drawback with this one? Any experience?

Just exploring all the methods
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Oct 03, 2006 2:49 am     Reply with quote

Can't help with that one. I have not seen it before but it looks interesting.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Christophe



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

PostPosted: Thu Nov 02, 2006 4:38 am     Reply with quote

I have another question on the MMC interface.

What should be the supply voltage for the MMC cards? Is that 3,3V or can it be different, and how different? On what does that depend?

If the MMC supply is 3V3 and my PIC 's Vcc is 3V6; can I be able to communicate directly or is a voltage level converter required?

tks
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