SD卡初始化初始化不成功,发送CMD55+ACMD41的应答是0x01。是2G金士顿SD卡,SD卡初始化应该注意什么,我是先发送CMD0,再发送CMD8,接着发送CMD55+ACMD41,CMD0和CMD8的应答都是正确的,就是在发送CMD55+ACMD41时应答不正确
while ( 0x00 != response )
{
SD_CS_0; //每次启动总线传输,片选引脚必须保持低电平
SdCommand( 0x37, 0x00000000, 0xFF ); //发送CMD55命令
response = SdResponse( ); //接收SD卡应答到response
SD_CS_1; //总线传输结束,片选引脚置高
SdWrite( 0xff ); //总线传输结束后,需要再给8个时钟
SD_CS_0; //每次启动总线传输,片选引脚必须保持低电平
SdCommand( 0x29, 0x40000000, 0xFF ); //发送ACMD41命令
response = SdResponse( ); //接收SD卡应答到response
SD_CS_1; / /总线传输结束,片选引脚置高
SdWrite( 0xff ); //总线传输结束后,需要再给8个时钟
i++;
if ( i>10000 )
{
printf( "ACMD41 response is 0x%x\r\n",response );
printf( "ACMD41 response error\r\n" );
return 0;
}
}
printf( "ACMD41 response is 0x%x\r\n",response );
return 1; //返回1,初始化成功 |