void FlashReadID(void) { Select_Flash(); SPI_Flash_SendByte(0x90); SPI_Flash_SendByte(0x00); SPI_Flash_SendByte(0x00); SPI_Flash_SendByte(0x00); fac_id = SPI_Flash_ReadByte(); // BFH: 工程码SST dev_id = SPI_Flash_ReadByte(); // 41H: 器件型号SST25VF016B NotSelect_Flash(); }
void FlashReadID(u8 *Data) { u8 i; Select_Flash(); SPI_Flash_SendByte(0x9F); for(i = 0; i < 4; i++) { Data[i] = SPI_Flash_ReadByte(); } NotSelect_Flash(); }
u8 Read_CMD(void) { u8 busy; Select_Flash(); SPI_Flash_SendByte(0x05); busy = SPI_Flash_ReadByte(); NotSelect_Flash(); return (busy); }
void FlashPageRead(u16 page,u8 *Data) { u16 i; FlashWaitBusy(); Select_Flash(); SPI_Flash_SendByte(PAGE_READ); SPI_Flash_SendByte((u8)(page >> 6)); SPI_Flash_SendByte((u8)(page << 2)); SPI_Flash_SendByte(0x00);//3个字节 SPI_Flash_SendByte(0x00); SPI_Flash_SendByte(0x00); SPI_Flash_SendByte(0x00); SPI_Flash_SendByte(0x00); for (i = 0;i < 528; i++) { Data[i] = SPI_Flash_ReadByte(); } NotSelect_Flash(); }
void SST25_ReadFlash(u32 addr, u8 *readbuff, u16 length) { u32 i = 0; Select_Flash(); SPI_Flash_SendByte(0x0b); SPI_Flash_SendByte((addr&0xffffff)>>16); SPI_Flash_SendByte((addr&0xffff)>>8); SPI_Flash_SendByte(addr&0xff); SPI_Flash_SendByte(0); while (i < length) { readbuff[i] = SPI_Flash_ReadByte(); i++; } NotSelect_Flash(); }