7,7 → 7,7 |
#include "printf_P.h" |
#include "crc16.h" |
|
#define _SD_DEBUG |
//#define _SD_DEBUG |
|
#define CMD_GO_IDLE_STATE 0x00 /* CMD00: response R1 */ |
#define CMD_SEND_OP_COND 0x01 /* CMD01: response R1 */ |
140,9 → 140,9 |
SSC_Disable(); // disable chipselect. |
SSC_PutChar(0xFF); // dummy to sync |
SSC_Enable(); // enable chipselect. |
_delay_loop_2(200); |
//SDC_WaitForBusy(500); // wait 500ms until card is busy |
|
SDC_WaitForBusy(500); // wait 500ms until card is busy |
|
for (a = 0;a < 6; a++) // send the command sequence to the sdcard (6 bytes) |
{ |
SSC_PutChar(cmd[a]); |
152,7 → 152,7 |
do |
{ |
r1 = SSC_GetChar(); // get byte from sd-card |
if (timeout++ > 1000) break; |
if (timeout++ > 500) break; |
}while(r1 == 0xFF); // wait for the response byte from sd-card. |
#ifdef _SD_DEBUG |
printf("-->R1=%02X", r1); |
243,15 → 243,15 |
uint8_t pn[6]; |
uint16_t temp1, temp2; |
|
printf("\r\n Manufacturer ID: %i\r\n", pCID[0]); |
printf("\r\n Manufacturer ID: %i\r\n", pCID[0]); |
memcpy(pn, &pCID[1], 2); |
pn[2] = '\0'; // terminate string |
printf(" Application ID: %s\r\n",pn); |
printf(" Application ID: %s\r\n",pn); |
memcpy(pn, &pCID[3], 5); |
pn[5] = '\0'; // terminate string |
printf(" Product Name: %s\r\n",pn); |
printf(" Product Rev.: %i.%i\r\n",pCID[8]>>4, pCID[8]&0xF); |
printf(" Serial No.: "); |
printf(" Product Name: %s\r\n",pn); |
printf(" Product Rev.: %i.%i\r\n",pCID[8]>>4, pCID[8]&0xF); |
printf(" Serial No.: "); |
for(temp1 = 0; temp1<4; temp1++) |
{ |
printf("%02X", pCID[9+temp1]); |
259,7 → 259,7 |
printf("\r\n"); |
temp1 = pCID[14] & 0x0F; // month |
temp2 = ((pCID[14]>>4)|(pCID[13]<<4)) + 2000; // year |
printf(" Manufac. Date: %i/%i\r\n\r\n",temp1, temp2); |
printf(" Manufac. Date: %i/%i\r\n\r\n",temp1, temp2); |
} |
|
//________________________________________________________________________________________________________________________________________ |
312,7 → 312,7 |
SSC_Init(); |
printf("ok"); |
|
_delay_loop_2(1050); |
//_delay_loop_2(1050); |
|
printf("\r\n SDC init..."); |
SDCardInfo.Valid = 0; |
518,10 → 518,10 |
switch(SDCardInfo.Version) |
{ |
case VER_1X: |
printf(" SD-CARD V1.x"); |
printf("\r\n SD-CARD V1.x"); |
break; |
case VER_20: |
printf(" SD-CARD V2.0 or later"); |
printf("\r\n SD-CARD V2.0 or later"); |
default: |
break; |
} |