/***************flash读操作****************/
void W25X_ReadData(uint32_t address, uint8_t *pbuf, uint16_t len)
{
uint16_t i = 0;
W25X_WriteEnable();
FLASH_CS_RESET();//CS拉低使能芯片
W25X_SPIRWByte(Read_Data);//写入指令
W25X_SPIRWByte((address >> 16) & 0xff);//从高位开始写入24位地址
W25X_SPIRWByte((address >> 8) & 0xff);//从高位开始写入24位地址
W25X_SPIRWByte((address >> 0) & 0xff);//从高位开始写入24位地址
for(i = 0; i<len; i++)
{
pbuf[i] = W25X_SPIRWByte(0xff); //传输任意数
}
FLASH_CS_SET();
W25X_WaitBusy();
}
|