- M25P40 4Mbit = 512k Bytes
- spi 串行接口(max 75MHz clock rate);
Sector Erase (512 Kbit) in 0.6 s (typical)
Bulk Erase (4 Mbit) in 4.5 s (typical)
-
Hardware Write Protection: protected area
size defined by three non-volatile bits (BP0,
BP1 and BP2) 默认000,每个sector均未保护。
- 可一次性写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.
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]);
- 写之前必须擦除,因为擦除是将设有的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).)
- 每次可写256个字节,
- Write In Progress (WIP) bit 监控写或擦除是否已经完成。
写的流程: 擦除sector,等待擦除完成,写数据,等待写完成。