|
死活不成功,用的是micro SDHC 参考SD2.0标准,但循环接受ACMDD41就会一直不停的接受到0x01 不知怎么回事 希望高手解答呵呵
void SDCardInit( void )
{
u8 ret = 0 ;
SSPInit();
sdDisable();
ChangeSpeedToHigh( 0 ); /* set CPSR to 80 , enter low speed mode */
/*1: send command 0 retset sd card inter spi mode */
SendCMD0();
/*2: send cmmand 8 , get information from card , if the voltage support */
SendCMD8();
/*3: send CMD58 , get OCR register ,get supported voltage range of the card.*/
SendCMD58();
/*4: send ACMD41 loops (acturly ACMD41 = CMD55 + CMD41) ,until ACMD41 return 0 */
// do{
ret = SendACMD41();
ret = SendACMD41();
// }while ( ret == 0x01 ) ;
/*5: send CMD58 agine, get CCS */
SendCMD58();
/* send CMD1 , CMD1 = CMD55 + CMD41 */
/* ret = SendCMD1();
PrintHX( ret );
*/
ChangeSpeedToHigh( 1 );
}
下边是串口的输出数据
cmd0 : 0x01
cmd8 : 0x01 0x00 0x00 0x01 0xaa 0xff
cmd58 : 0x01 0x00 0xff 0x80 0x00 0xff
acmd41 : 0x01
acmd41 : 0x01
acmd41 : 0x01
acmd41 : 0x01
acmd41 : 0x01
acmd41 : 0x01
acmd41 : 0x01
acmd41 : 0x01
acmd41 : 0x01
acmd41 : 0x01
cmd58 : 0x01 0xff 0xff 0xff 0xff 0xff
|
|