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

write sector on 128 mb card didn't work but on 32m it work

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








write sector on 128 mb card didn't work but on 32m it work
PostPosted: Wed Mar 30, 2005 9:44 am     Reply with quote

i use your function for write a sector to a mmc card.
on 32mb card it work but in the 128mb card it didn't.
it never free from busy flag.
could you please guide me?

unsigned char MMCWriteSector(unsigned long lba, char *s)
{
unsigned int i;
MMCCommand(24, (lba<<9));
if (MMCGet() == 0xff)
return 1;

for(i = 0 ; i < 100 ; i++)
SpiByte(0xff);

SpiByte(0xfe); // Send Start Byte

SpiByte(0xff);
SpiByte(0xff);
SpiByte(0xff); /* Read "data response byte" */

i = 0xffff;
while ((SpiByte(0xff) == 0x00) && (--i)); /* wait for write finish */
if (i == 0)
return 2; // Error
MMC_CS = 1;
return 0;
}
TSchultz



Joined: 08 Sep 2003
Posts: 66
Location: Toronto, Canada

View user's profile Send private message

PostPosted: Wed Mar 30, 2005 10:16 am     Reply with quote

Unless the 128MB card has multiple <=32MB partitions it will have a FAT32 format, the 32MB card will have a FAT16 format.
ckielstra



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

View user's profile Send private message

PostPosted: Thu Mar 31, 2005 5:16 am     Reply with quote

One error is that your time-out is shorter than expected.

change
Code:
 unsigned int i;

to
Code:
int16 i;
lucky



Joined: 12 Sep 2003
Posts: 46
Location: South Coast - England

View user's profile Send private message Visit poster's website

Code Libray Example
PostPosted: Thu Mar 31, 2005 10:05 am     Reply with quote

Have a look at Douglas Kennedy code in the CCS Code Libray:

http://www.ccsinfo.com/forum/viewtopic.php?t=21721
_________________
Lucky
www.mpic3.com - MPIC3 player project, Forum, Downloads, Online Shop
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