FLASH芯片偶尔一直在忙,

[复制链接]
1595|0
 楼主| mikenoodle 发表于 2013-6-27 19:08 | 显示全部楼层 |阅读模式
//读状态寄存器
unsigned char FlashRdSr()
{
        unsigned char ucRet;
       
        FLASH_nCS_L;
        SpiSend(RDSR);
        ucRet=SpiRecv();
        FLASH_nCS_H;
       
        return ucRet;
               
}

bit FlashIfBusy()
{
        unsigned char ucTmp=0;
          
        ucTmp=FlashRdSr();
        //Uart1SendByte(0xae);
        //Uart1SendByte(ucTmp);
        //Uart1SendByte(0xaf);

        return (( ucTmp& 0x01) == 0x01) ? 1 : 0;
}

void FlashWaitIfBusy()
{
        unsigned long i=0;

        while(FlashIfBusy())
        {
                i++;
                if(i>FLASH_TIMEOUT)
                {
                        Uart1SendByte(0xae);
                        break;//超时也要退出
                }
        }       
}

可能是什么原因呢,芯片是W25Q32FV
您需要登录后才可以回帖 登录 | 注册

本版积分规则

7

主题

33

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部