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

compact flash memory support!!!!

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







compact flash memory support!!!!
PostPosted: Thu Oct 13, 2005 10:18 pm     Reply with quote

Hi everyone,

i was wondering if the ccs c compiler has drivers for compact flash memory (CF) cards.
if it doesnt than has any one written their own drivers for CF cards or not!

Best regards
JimB



Joined: 25 Aug 2005
Posts: 65
Location: Huntington Beach, CA

View user's profile Send private message

File transfer issue.
PostPosted: Thu Oct 13, 2005 11:18 pm     Reply with quote

I had a similar requirement i.e. to interface with some sort of portable memory media such as a flashcard. This issue came up when I realized that the CCS compiler had no fopen() type of function. Apparently to handle this easily one needs an operating system, so these functions are not normally required in an imbedded system.

I did run across a website that advertised a module that will allow the PIC to use a memory card. See the following link.

http://www.armanet.com/

But you never know. I just got wind of a Lunix based operating system for the iPod. It will allow one to play video files. At least there may be some hope that the iPod can become a usable device.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

Re: compact flash memory support!!!!
PostPosted: Fri Oct 14, 2005 2:23 am     Reply with quote

ambivalent wrote:
i was wondering if the ccs c compiler has drivers for compact flash memory (CF) cards.
if it doesnt than has any one written their own drivers for CF cards or not!

No, CCS does not supply drivers for CF cards. Drivers normally are supplied as integrated part of an operating system, not with the compiler.

Search this forum and you will find many similar discussions. First of all you have to ask yourself if an CF is the best solution for your problem. For data sizes up to 1MByte it's easier to use a serial EEPROM or similar chip, I like the FRAM chips from Ramtron. For larger data storage you can use flash cards like used in photo cameras, Compact Flash and MMC/SD are the most common types.

Compact Flash requires something like 14 I/O ports, do you have this many to spare? MMC and SD cards use the serial SPI port and require only 4 I/O pins.

For flash cards:
Do you need to write data in the Flash memory or are you only reading data? For writing data you need large enough RAM to read in an entire memory page, modify it and write back. MMC cards have memory pages of 512 bytes, so either use one of the larger PIC processor models with large enough RAM or add an external buffer memory. Data reading can be done bytewise so any PIC can handle this.

Example implementations can be found on the web easily.
MPIC3.com Great site! MP3 player, Compact Flash, FAT16. Code written in CCS. Preliminary MMC code available.
MMC project MMC on a 16F876 with external temporary buffer (I2C).
German MMC project Good MMC code starting point. Currently he uses the smaller PIC12/16 processors but has not found a solution for the 512 byte buffer yet.
MP3 player Compact Flash, FAT16 (read only).

Read the following thread for a commercial library with SD/MMC/CF support: http://www.ccsinfo.com/forum/viewtopic.php?t=24187
Guest








Re: compact flash memory support!!!!
PostPosted: Fri Oct 14, 2005 4:29 am     Reply with quote

ckielstra thankyou for your reply!!

Actually i need to both read and write data to external memory at run time. The capacity i am looking for is about 1MB as i just need to store and read data strings about 30 characters long.
Needless to say, this read and write will dynamically be controlled by the mcu (i was thinking of using 16f877a).
As you said that for capacities of 1MB, the CF card is not recommended. now in the case of FRAM, are the drivers available for PIC or not.


ckielstra wrote:
For flash cards:
For writing data you need large enough RAM to read in an entire memory page, modify it and write back. MMC cards have memory pages of 512 bytes, so either use one of the larger PIC processor models with large enough RAM or add an external buffer memory. Data reading can be done bytewise so any PIC can handle this.


howcome for writing data into the external memory you need to read in the whole memory page? Cant you just write to the flash/MMC 'word by word' rather than loading the whole of memory page into the RAM of your controller.

can you please establish the basic difference between MMC and CF cards from the point of view of interfacing them to the PIC microcontrollers

Best regards
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sat Oct 15, 2005 5:36 pm     Reply with quote

Quote:
As you said that for capacities of 1MB, the CF card is not recommended.

First of all I have to apologize for an error in my previous posting, the maximum memory size of external serial EEPROM and FRAM chips is not in the 1MByte but in the 1Mbit range.
It is possible to stack multiple chips to get higher capacites but economically there is a maximum where it is cheaper to move on to the high capacity Flash cards (MMC/SD/CF). If you are designing a low volume device I expect for your 1MByte storage requirement it will be cheaper to buy a 128MB MMC card than a set of 8 x 1Mbit memory chips.

Quote:
now in the case of FRAM, are the drivers available for PIC or not.
I don't know. I wrote the drivers myself, very easy.

Quote:
Needless to say, this read and write will dynamically be controlled by the mcu (i was thinking of using 16f877a).
The 16F877A doesn't have enough RAM to buffer the 512 bytes required for MMC/SD cards. Is there a special reason you want to use this chip instead of one of the newer PIC18's with more memory? Funny thing with Microchip is that many of the newer models with more features are cheaper than the older processors.

Quote:
howcome for writing data into the external memory you need to read in the whole memory page? Cant you just write to the flash/MMC 'word by word' rather than loading the whole of memory page into the RAM of your controller.
With many EEPROMS you can write 'word by word' but erasing data can only be done in whole pages. So in order to modify a single byte you have to read in the original page contents to RAM, modify your byte in RAM, erase the whole page, and write back the data. In the situation where you are only adding data to an (empty) chip i.s.o. modifying data you don't have to read in the page first but writing data will suffice.
MMC/SD cards are a bit different here in the way that you are only allowed to write whole pages.
I don't know if CF cards allow you to write single bytes.

Quote:
can you please establish the basic difference between MMC and CF cards from the point of view of interfacing them to the PIC microcontrollers
SD cards have an electrical and mechanical interface which is backwards compatible to MMC. SD cards have a few more pins which allow for a higher data rate by parallel data transport but both MMC and SD can also be accessed with a serial SPI bus using only 4 I/O pins. The Compact Flash (CF) card is based on the AT-bus used in the first PCs and requires something like 14 I/O pins. For me the number of used I/O pins was very important and I never looked further into the CF cards.

From a software point of view I suspect the CF cards to be easier to interface to than the MMC/SD cards which have some quirks. Example code for both types of cards has been discussed before on this forum, use the search function.


Just in case you are thinking on choosing MMC or SD; I prefer MMC over SD because:
- MMC is a little bit cheaper.
- Specifications for old MMC versions are available for free while SD specifications are expensive to buy.
- The 'secure' part of SD cards takes up some of the available memory.
- I access the cards in SPI mode, the faster parallel data bus of the SD is of no use to me.
- Initialisation of an MMC card is a little bit easier than SD.
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