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

SD/MMC clock control

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



Joined: 22 May 2006
Posts: 9

View user's profile Send private message

SD/MMC clock control
PostPosted: Wed May 31, 2006 9:24 pm     Reply with quote

I am using a PIC18F2550 to interface with a SD/MMC card. My system needs to be able to use high capacity cards (1GB+) and must also allow them to be interfaced with a Windows system.
The FAT16 file system can reference a maximum of 32MB if 512byte block sizes are used, however if larger block sizes are used then this increases. Is it possible to use 16kB block sizes (to allow for 1GB cards) but only transfer this from the PIC 512bytes at a time?

According to the Simplified Physical Layer Specification:

Quote:
...The host is allowed to lower the clock frequency or shut it down. For example, in a case that a host with 512Bytes of data buffer would like to transfer data to a card with 1KByte write blocks. So, in order to reserve a continuous data transfer, from the cards point of view, the clock to the card shall be stopped after the first 512Bytes. Then the host will fill it internal buffer with another 512Bytes. After the second half of the write block is ready in the host, it will continue the data transfer to the card by re-starting the clock supply. In such a way the card does not recognize any interruptions in the data transfer.
There are a few restrictions the host must follow:
• The bus frequency can be changed at any time (under the restrictions of maximum data transfer frequency and the identification frequency defined by the specification document).
• An exemption to the above is ACMD41(SD_APP_OP_COND). After issuing command ACMD41 the following 1) or 2) procedures shall be done by the host until the card becomes ready.
1) Issue continues clock in frequency range of 100KHz-400KHz.
2) If the host wants to stop the clock, poll busy bit by ACMD41 command at less than 50ms intervals.
(p.38)

This indicates to me that if a discontinuous clock is used, then the block size limit is not restricted by the size of the buffer in the PIC. What i could not work out is if this applied in both SD Card mode and SPI mode.

Any comments would be appreciated.

Regards

Matt
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Thu Jun 01, 2006 11:54 am     Reply with quote

Most of this you will know already.
The MMC/SD is the physical layer and has restrictions as to commands and things like blocksize (Ex 512 bytes). The physical MMC layer hasn't any knowledge whatsoever of how it is logicaly formated. The logic layer can be any organization you want that is consistant with the physical layer constraints. Microsoft fully owns the FAT design in any of its forms and on any platform ( Ex PIC micro). Until recently it was felt that FAT16 could be used on a PIC platform without Microsofts consent. This was convenient since a PC could be used to do the heavy lift work of formating the cards and the PIC would work within this formatted file structure. A FAT design employs a table of file names and pointers into a cluster table that in turn references physical storage in cluster size increments. You are right the cluster size can be a large multiple of the smallest physically writable block (EX 512bytes). In practice Microsoft formatting software is the main constriant..it will choose FAT12 below a certain disc capacity FAT16 for the next size and FAT32 for larger sizes. Now if you are writing your own format routine it might be wise to create your own file system design and avoid the legal and other constraints that come with a Microsoft patented design.
As to the physical block size it has relevance to performace of the card but is only marginally relevant to the logical format you choose. A cluster size of 32k is still a multiple of 512 bytes ( the least amount of data you can write to a MMC) so 64 consecutive reads will fully access the logical cluster..the issue arises as to temporary storage... larger clusters often need larger temporary storage to keep the code simple.
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