59 SPI_Write((
unsigned char)(address >> 16) & 0x000000FF);
60 SPI_Write((
unsigned char)(address >> 8) & 0x000000FF);
61 SPI_Write((
unsigned char)(address & 0x000000FF));
78 unsigned char mybyte = 0;
81 SPI_Write((
unsigned char)(address >> 16) & 0x000000FF);
82 SPI_Write((
unsigned char)(address >> 8) & 0x000000FF);
83 SPI_Write((
unsigned char)(address & 0x000000FF));
106 SPI_Write((
unsigned char)(address >> 16) & 0xFF);
107 SPI_Write((
unsigned char)(address >> 8) & 0xFF);
110 for (i=0;i<arrayLength;i++)
135 SPI_Write((
unsigned char)(address >> 16));
136 SPI_Write((
unsigned char)(address >> 8));
139 for (i = 0; i <arrayLength; i++)
158 unsigned int deviceID = 0;
159 unsigned char man, dev = 0;
167 deviceID = (man << 8) | dev;
179 unsigned long int jedid = 0;
180 unsigned char byte1, byte2, byte3 = 0;
186 jedid = ((
unsigned long)byte1 << 16)| (byte2 << 8) | byte3;
238 SPI_Write((
unsigned char)(address >> 16) & 0x000000FF);
239 SPI_Write((
unsigned char)(address >> 8) & 0x000000FF);
240 SPI_Write((
unsigned char)(address & 0x000000FF));
250 unsigned char temp = 0;
255 if (temp & 0x01)
return 1;
266 unsigned char byte = 0;
void S25FL_ChipErase(void)
Erase all chip contents. Erase is slow on flash chips.
void S25FL_Setup(void)
Setup SPI and IOs connected to Serial FLASH.
void S25FL_WakeUp(void)
Wakes the flash memory chip from deep sleep mode.
void S25FL_SectorErase(unsigned long address)
This function erases a 4Kb sector (it erase a page actually)
void S25FL_SetBlockProtection(unsigned char prot)
Sets the block protection of the chip.
void S25FL_WriteArray(unsigned long address, unsigned char *pData, unsigned int arrayLength)
Write data array at the specified address , this procedure does page programming. The destination add...
unsigned char SPI_Write(unsigned char data)
Writes a byte of data to the SPI bus.
unsigned int S25FL_ReadID(void)
This function reads the Manufacturer ID code This procedure Reads the manufacturer's ID and device ID...
unsigned char SPI_Read(void)
Reads a byte of data from the SPI bus.
void S25FL_WriteByte(unsigned char data, unsigned long address)
Write a byte to the address specified (24 bit address)
unsigned char S25FL_IsWriteBusy(void)
This function reads status register and checks BUSY bit for a write in progress operation.It waits until the device is no longer busy.
unsigned char S25FL_ReadByte(unsigned long address)
Read a byte from the specified 24 bit address.
void S25FL_SReg_Write(unsigned char statReg)
This procedure writes a byte to the Status Register.
unsigned char S25FL_SReg_Read(unsigned char statReg)
Read specific Status Register depending on value of statReg.
void S25FL_BlockErase(unsigned long address)
This function erases a 64Kb block.
unsigned long S25FL_Jedec_ID_Read(void)
This procedure Reads the manufacturer's ID (BFh), memory type (25h) and device ID (4Bh)...
void S25FL_ReadArray(unsigned long address, unsigned char *pData, unsigned int arrayLength)
Read an array of data from the given address.
void S25FL_DeepSleep(void)
Puts the flash chip into deep sleep mode.