//========================================================================
//TITLE:
// SD卡无法格式化的原因分析
//AUTHOR:
// chenyujing
//DATE:
// Saturday 28-02-2012
//Environment:WCE6.0+AU1380
// NONE
//========================================================================
硬件的大哥把BGA封闭的4G SD存储焊上后,启动NK到explorer,总是看不到盘符,后来在控制面板中发现了它
但点Format时,总是提示无法格式,
后来在SD卡的驱动中(PDD层E:\WINCE600\PLATFORM\EAuto657t\Src\Drivers\sdmemory2) 发现:
extern "C" BOOL WINAPI SMC_IOControl(函数中的
case IOCTL_DISK_FORMAT_MEDIA:
case DISK_IOCTL_FORMAT_MEDIA:
RETAILMSG(1, (TEXT("IOCTL_DISK_FORMAT_MEDIA\r\n")));
DEBUGMSG(SDCARD_ZONE_INFO, (TEXT("IOCTL_DISK_FORMAT_MEDIA\r\n")));
break;
===============================
经网上高手指点格式化的是在MDD层做的.
既然是共有的代码,为什么别人可以,我不能呢。
于是思路转到MDD层
终于在E:\WINCE600\PLATFORM\EAuto657t\Src\Drivers\SDIO\SDIO.cpp里的SD卡波特率设置太大了
于是修改
#define SDIO_MAX_CLOCK_RATE (30000000) ->
#define SDIO_MAX_CLOCK_RATE (25000000)
问题解决了.
VOID SDIOSetRate(PSDIO_SLOT pSlot, PDWORD pRate)
{
ULONG pbus;
ULONG div;
ULONG regValue;
ULONG RateAttempted;
if (*pRate > SDIO_MAX_CLOCK_RATE) *pRate = SDIO_MAX_CLOCK_RATE;
if (*pRate < 1) *pRate = 1; // Just to make sure we don't have a div/0
// Keep track of the rate we are trying
// to set.
RateAttempted = *pRate;