FX3/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,Sector_Num,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,Sector_Num,buf_temp);
                  CyU3PDebugPrint (4, "111 RDSR: %x\r\n",buf_temp[0]);//3
              }while((buf_temp[0] & 0x01) == 1);

             status = CyFxSpiTransfer (Sector_Num*glSpiPageSize, len,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,等待擦除完成,写数据,等待写完成。
    这里写图片描述
    这里写图片描述

这里写图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值