51 SD卡软件SPI读写 复位 初始化
请问 我的SD卡SPI模式读写 初始化 为什么总是超时而 失败/************ SD卡初始化 ************/
uchar sd_init(void)
{
uchar time, temp;
uchar pcmd ={0x41,0x00,0x00,0x00,0x00,0xff};//CMD1的字节序列
CS = 0; //打开片选
time = 0;
do
{
temp = write_cmd_low_speed(pcmd);// 慢速写入CMD1
time++;
if(time > 100)
{
time=0;
Send_(table); // CMD1 写入超时,用串口发到PC机,标志超时
}
}
while(temp != 0x00); // SD卡已经准备好接受读写操作
CS = 1; //关闭片选
spi_write_low_speed(0xff);
Send_(table);
return 0;
}/***********************************************************/
串口返回的标志表明一直在向SD卡写CMD1 一直超时 求大神解释 {:sad:} 既然没人看到 cs=1;
delay();
然后74clk
在cs=0; 贴源码上来呗~
页:
[1]