Saludos,
La inicializacion y el reseteo de la trajeta MMC esta bien pero la rutina de lectura no se que pasa q no me funciona, la rutina de lectura es la siguiente:
unsigned char readBlock(unsigned long addr, unsigned char *p){
//LBA sector
//pointer to buffer
unsigned char r = 0;
unsigned char temp;
int i;
CMD17_READ_SINGLE_BLOCK[1] = ((addr & 0xFF000000) >> 24);
CMD17_READ_SINGLE_BLOCK[2] = ((addr & 0x00FF0000) >> 16);
CMD17_READ_SINGLE_BLOCK[3] = ((addr & 0x0000FF00) >>

;
CMD17_READ_SINGLE_BLOCK[4] = ((addr & 0x000000FF));
// 1. send read command
r = sendSDCmd(CMD17_READ_SINGLE_BLOCK);
//check if command was accepted
if (r == 1){
// abort invalid response
PORTCbits.RC2 = 1;
return 1; //r
}
// 2. wait a response
for(i=0;i < 100; i++){
r = readSPI();
if (r == MMC_STARTBLOCK_READ)
break;
}
PORTCbits.RC1 = 1;
// 3. read 512 block
if(i != 100){
for(i = 0; i < 512; i++){
temp = readSPI();
*p = temp;
p++;
}
}
// 4. ignore 16-bit CRC
readSPI();
readSPI();
// data arrived
// command accepted
// 5. remember disable card
SD_Disable();
return 0;
}
// end readBlock