cornor
驱动牛犊
驱动牛犊
  • 注册日期2004-06-03
  • 最后登录2009-10-26
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1320回复:1

samsung flash驱动问题,多谢指教。

楼主#
更多 发布于:2004-06-03 16:52
K9f6408u0c
命令、地址、数据编为三个地址CMD_ADDR,ADD_ADDR,DATA_ADDR

我的测试程序为:
         //先擦除第0个块
CommandLatch(0x60,CMD_ADDR);//erase
         AddressLatch(0x00,ADD_ADDR);
         AddressLatch(0x00,ADD_ADDR);//set the block 0

CommandLatch(0xD0,CMD_ADDR);//erase    
Sleep(10);
CommandLatch(0x70,CMD_ADDR);
status=*(DATA_ADDR));//读状态
         //写第0个块第0页
CommandLatch(0x00,CMD_ADDR);
CommandLatch(0x80,CMD_ADDR);//set command
//set address
AddressLatch(0x00,ADD_ADDR);
AddressLatch(0x00,ADD_ADDR);
AddressLatch(0x00,ADD_ADDR);
//写数据
for(iCount=0;iCount<512;iCount++)
{
*(DATA_ADDR)=0X88;//write data to Data I/O
}
CommandLatch(0x10,pucMem);//set command
Sleep(10);
CommandLatch(0x70,pucMem);
status=(*(DATA_ADDR));//读状态
         //读数据
          CommandLatch(0x00,pucMem);//set command
//set address
AddressLatch(0x00,pucMem);
AddressLatch(0x00,pucMem);
AddressLatch(0x00,pucMem);
Sleep(2);
for(iCount=0;iCount<512;iCount++)//
{
buffer[iCount]=*(DATA_ADDR);//read data from  Data I/O
}
         读出的结果都是ff.
         结果我读写的结果不一样。我的擦除和写入后的状态字都为c0,应该是正确的.
         请指教我程序的毛病,或是有什么可能问题?
         再有,我读的设备号是对的。




最新喜欢:

clevorclevor
ken
ken
驱动牛犊
驱动牛犊
  • 注册日期2001-06-09
  • 最后登录2014-07-30
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2004-06-11 20:49
呵呵不知道你的cpu是多少M的
加延时吧
这个问题也把我搞过:(
好运

CommandLatch(0x60,CMD_ADDR);//erase
DELAY(50ns)
AddressLatch(0x00,ADD_ADDR);
DELAY(50ns)
AddressLatch(0x00,ADD_ADDR);//set the block 0


for(iCount=0;iCount<512;iCount++)
{
*(DATA_ADDR)=0X88;//write data to Data I/O
DELAY(50ns)

}
ken
游客

返回顶部