微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

cx3 flash

  1. M25P40 4Mbit = 512k Bytes
  2. spi 串行接口(max 75MHz clock rate);
    Sector Erase (512 Kbit) in 0.6 s (typical)
    Bulk Erase (4 Mbit) in 4.5 s (typical)

  3. Hardware Write Protection: protected area
    size defined by three non-volatile bits (BP0,
    BP1 and BP2) 认000,每个sector均未保护。
  4. 可一次性写1-256 bytes;
    The memory is organized as 8 sectors,each containing 256 pages. Each page is 256 bytes
    wide. Thus,the whole memory can be viewed as consisting of 2048 pages,or 524,288
    bytes.
    内存组织分为 8个sector,每个sector包含256 pages,每个page 包含256 bytes。
    可以用bulk erase (BE)指令擦除整个芯片,或者用sector erase(SE) 按sector擦除。
  5. 5.
status = CyFxSpiEraseSector(CyTrue,Sector_Num,buf_temp);
             if(status != CY_U3P_SUCCESS){
                CyU3PDebugPrint (4,"Erase Error: %x\r\n",status);
             }
             do{//wait until wip is 0
                  CyU3PThreadSleep (50);
                  CyFxSpiEraseSector(CyFalse,buf_temp);
                  CyU3PDebugPrint (4,"111 RDSR: %x\r\n",buf_temp[0]);//3
              }while((buf_temp[0] & 0x01) == 1);

             buf[9] = i;
             status = CyFxSpiTransfer (Sector_Num*glSpiPageSize,len,buf,CyFalse);//write
             if(status != CY_U3P_SUCCESS){
                CyU3PDebugPrint (4,"Write Error: %x\r\n",status);
             }//*/
             do{//wait until wip is 0
                  CyU3PThreadSleep (50);
                  CyFxSpiEraseSector(CyFalse,buf_temp[0]);//3
              }while((buf_temp[0] & 0x01) == 1);

             status = CyFxSpiTransfer (Sector_Num*glSpiPageSize,buffer2,CyTrue);//read
             if(status != CY_U3P_SUCCESS){
                CyU3PDebugPrint (4,"\r\nRead Error: %x\r\n",status);
             }
             CyU3PDebugPrint (4,"\r\nReadPage:%d,data:%x %x %x %x %x %x %x %x %x %x\r\n",Sector_Num*glSpiPageSize,buffer2[len-4],buffer2[len-3],buffer2[len-2],buffer2[len-1],buffer2[4],buffer2[5],buffer2[6],buffer2[7],buffer2[8],buffer2[9]);
  1. 写之前必须擦除,因为擦除是将设有的bit变为1,而写只能讲1变为0,不能将0变为1.
    (The Page Program (PP) instruction allows bits to be reset from 1 to 0. Before this can be
    applied,the bytes of memory need to have been erased to all 1s (FFh).)
  2. 每次可写256个字节,
  3. Write In Progress (WIP) bit 监控写或擦除是否已经完成。
    写的流程: 擦除sector,等待擦除完成,写数据,等待写完成。

    这里写图片描述


    这里写图片描述

这里写图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐