nader
Joined: 29 Aug 2004 Posts: 12
|
write sector problem on 128m mmc(it work on 32m) |
Posted: Thu Mar 31, 2005 1:29 am |
|
|
hi,
i use a function for write a sector to a mmc card.
on 32mb Nokia card it work but in the 128mb Nokia card it didn't.
it never free from busy flag.
could some one please guide me?
here is the code:
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;
}
i recieve on both card first 0xe5 that mean accept the data & when i must recieve 0xff mean free from busy
but on 128mb card always stay 0x00.
why? |
|