STM32 SD卡_没有加文件系统
SD_MMC_SPI_SELECT();
SD_MMC_ReadWrite_Byte(0xff);
SD_MMC_ReadWrite_Byte(0xff);
SD_MMC_ReadWrite_Byte(0xff);
//发开始符 start byte 0xfe
SD_MMC_ReadWrite_Byte(0xfe);
//送512字节数据 send 512 bytes data
for(i=0; i<512; i++)
{
SD_MMC_ReadWrite_Byte(*buffer++);
}
SD_MMC_ReadWrite_Byte(0xff); //dummy crc
SD_MMC_ReadWrite_Byte(0xff); //dummy crc
Response = SD_MMC_ReadWrite_Byte(0xff);
//等待是否成功 judge if it successful
if( (Response&0x1f) != 0x05)
{
SD_MMC_SPI_DESELECT();
return Response;
}
//等待操作完 wait no busy
while(SD_MMC_ReadWrite_Byte(0xff) != 0x00)
{
if(retry++ > 0xfffe)
{
SD_MMC_SPI_DESELECT();
return 1;
}
}
SD_MMC_SPI_DESELECT();
SD_MMC_ReadWrite_Byte(0xff);// extra 8 CLK
return 0;
}
if( SD_MMC_SPI_Init() ==1)
printf(" _SD_MMC Initialization ERROR\r\n");
else
{
printf(" _SD_MMC Initialization OK\r\n");
//memset(buffer,0,512);
//读取一个扇区的内容 这里读的是0扇区
SD_MMC_Read_Single_Block( 0 , buffer );
Uart1_PutString( buffer , 512 );
}
STM32SD卡文件系 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)