Sensorian  1.0
C API Reference Guide Library
S25FL204K.h File Reference

S25FL204K driver header. More...

#include "bcm2835.h"

Go to the source code of this file.

Macros

#define CMD_RDSR1   (unsigned char) 0x05
 
#define CMD_RDSR2   (unsigned char) 0x35
 
#define CMD_RDSR3   (unsigned char) 0x33
 
#define CMD_WREN   (unsigned char) 0x06
 
#define CMD_EWSR   (unsigned char) 0x50
 
#define CMD_WRDI   (unsigned char) 0x04
 
#define CMD_SETBURST   (unsigned char) 0x77
 
#define PAGE_PROGRAM   (unsigned char) 0x02
 
#define CMD_READ_DATA   (unsigned char) 0x03
 
#define CMD_READ_HS   (unsigned char) 0x0B
 
#define ERASE_SECTOR   (unsigned char) 0x20
 
#define ERASE_BLOCK32   (unsigned char) 0x52
 
#define ERASE_BLOCK64   (unsigned char) 0xD8
 
#define ERASE_CHIP   (unsigned char) 0x60
 
#define CMD_DEEPSLP   (unsigned char) 0xB9
 
#define CMD_RESDPD   (unsigned char) 0xAB
 
#define CMD_RDID   (unsigned char) 0x90
 
#define JEDEC   (unsigned char) 0x9F
 
#define CMD_RDSFDP   (unsigned char) 0x5A
 
#define CMD_RDSECREG   (unsigned char) 0x48
 
#define CMD_ERSECREG   (unsigned char) 0x44
 
#define CMD_EHLD   (unsigned char) 0xAA
 
#define S64MANID   (unsigned char) 0x01
 
#define S64DEVID   (unsigned char) 0x16
 
#define CMD_RSID   (unsigned char) 0x88
 
#define CMD_PSID   (unsigned char) 0xA5
 
#define CMD_LSID   (unsigned char) 0x85
 
#define CMD_WRSR   (unsigned char) 0x01
 
#define STAT_REG1   (unsigned char) 0x05
 
#define STAT_REG2   (unsigned char) 0x35
 
#define STAT_REG3   (unsigned char) 0x33
 
#define SECTOR_SIZE   4096
 
#define SECTOR_COUNT   128
 
#define PAGE_NUM   2048
 
#define PAGE_INCR   0x100
 
#define CE_OUTPUT()   bcm2835_gpio_fsel(RPI_V2_GPIO_P1_26,BCM2835_GPIO_FSEL_OUTP);
 
#define CE_DESELECT()   bcm2835_gpio_write(RPI_V2_GPIO_P1_26, HIGH);
 
#define CE_SELECT()   bcm2835_gpio_write(RPI_V2_GPIO_P1_26, LOW);
 

Functions

void S25FL_Setup (void)
 Setup SPI and IOs connected to Serial FLASH. More...
 
void S25FL_WriteByte (unsigned char data, unsigned long address)
 Write a byte to the address specified (24 bit address) More...
 
unsigned char S25FL_ReadByte (unsigned long address)
 Read a byte from the specified 24 bit address. More...
 
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 address should be provided. This function is not safe so the user has to check the arguments. More...
 
void S25FL_ReadArray (unsigned long address, unsigned char *pData, unsigned int arrayLength)
 Read an array of data from the given address. More...
 
void S25FL_ReadPage (unsigned long page, unsigned char buffer[])
 
unsigned long S25FL_Jedec_ID_Read ()
 This procedure Reads the manufacturer's ID (BFh), memory type (25h) and device ID (4Bh). It will use 9Fh as the JEDEC ID command. More...
 
unsigned int S25FL_ReadID ()
 This function reads the Manufacturer ID code This procedure Reads the manufacturer's ID and device ID. More...
 
void S25FL_ChipErase (void)
 Erase all chip contents. Erase is slow on flash chips. More...
 
void S25FL_SectorErase (unsigned long address)
 This function erases a 4Kb sector (it erase a page actually) More...
 
void S25FL_BlockErase (unsigned long address)
 This function erases a 64Kb block. More...
 
void S25FL_SetBlockProtection (unsigned char prot)
 Sets the block protection of the chip. More...
 
void S25FL_WriteEnable ()
 
unsigned char S25FL_IsWriteBusy ()
 This function reads status register and checks BUSY bit for a write in progress operation.It waits until the device is no longer busy. More...
 
unsigned char S25FL_SReg_Read (unsigned char statReg)
 Read specific Status Register depending on value of statReg. More...
 
void S25FL_SReg_Write (unsigned char statReg)
 This procedure writes a byte to the Status Register. More...
 
void S25FL_DeepSleep (void)
 Puts the flash chip into deep sleep mode. More...
 
void S25FL_WakeUp (void)
 Wakes the flash memory chip from deep sleep mode. More...
 

Detailed Description

S25FL204K driver header.

Author
D.Qendri
Date
30 May 2015

Definition in file S25FL204K.h.

Macro Definition Documentation

#define CE_DESELECT ( )    bcm2835_gpio_write(RPI_V2_GPIO_P1_26, HIGH);

Definition at line 87 of file S25FL204K.h.

#define CE_OUTPUT ( )    bcm2835_gpio_fsel(RPI_V2_GPIO_P1_26,BCM2835_GPIO_FSEL_OUTP);

Definition at line 86 of file S25FL204K.h.

#define CE_SELECT ( )    bcm2835_gpio_write(RPI_V2_GPIO_P1_26, LOW);

Definition at line 88 of file S25FL204K.h.

#define CMD_DEEPSLP   (unsigned char) 0xB9

Definition at line 51 of file S25FL204K.h.

#define CMD_EHLD   (unsigned char) 0xAA

Definition at line 58 of file S25FL204K.h.

#define CMD_ERSECREG   (unsigned char) 0x44

Definition at line 57 of file S25FL204K.h.

#define CMD_EWSR   (unsigned char) 0x50

Definition at line 38 of file S25FL204K.h.

#define CMD_LSID   (unsigned char) 0x85

Definition at line 65 of file S25FL204K.h.

#define CMD_PSID   (unsigned char) 0xA5

Definition at line 64 of file S25FL204K.h.

#define CMD_RDID   (unsigned char) 0x90

Definition at line 53 of file S25FL204K.h.

#define CMD_RDSECREG   (unsigned char) 0x48

Definition at line 56 of file S25FL204K.h.

#define CMD_RDSFDP   (unsigned char) 0x5A

Definition at line 55 of file S25FL204K.h.

#define CMD_RDSR1   (unsigned char) 0x05

Definition at line 34 of file S25FL204K.h.

#define CMD_RDSR2   (unsigned char) 0x35

Definition at line 35 of file S25FL204K.h.

#define CMD_RDSR3   (unsigned char) 0x33

Definition at line 36 of file S25FL204K.h.

#define CMD_READ_DATA   (unsigned char) 0x03

Definition at line 43 of file S25FL204K.h.

#define CMD_READ_HS   (unsigned char) 0x0B

Definition at line 44 of file S25FL204K.h.

#define CMD_RESDPD   (unsigned char) 0xAB

Definition at line 52 of file S25FL204K.h.

#define CMD_RSID   (unsigned char) 0x88

Definition at line 63 of file S25FL204K.h.

#define CMD_SETBURST   (unsigned char) 0x77

Definition at line 40 of file S25FL204K.h.

#define CMD_WRDI   (unsigned char) 0x04

Definition at line 39 of file S25FL204K.h.

#define CMD_WREN   (unsigned char) 0x06

Definition at line 37 of file S25FL204K.h.

#define CMD_WRSR   (unsigned char) 0x01

Definition at line 68 of file S25FL204K.h.

#define ERASE_BLOCK32   (unsigned char) 0x52

Definition at line 47 of file S25FL204K.h.

#define ERASE_BLOCK64   (unsigned char) 0xD8

Definition at line 48 of file S25FL204K.h.

#define ERASE_CHIP   (unsigned char) 0x60

Definition at line 49 of file S25FL204K.h.

#define ERASE_SECTOR   (unsigned char) 0x20

Definition at line 46 of file S25FL204K.h.

#define JEDEC   (unsigned char) 0x9F

Definition at line 54 of file S25FL204K.h.

#define PAGE_INCR   0x100

Definition at line 81 of file S25FL204K.h.

#define PAGE_NUM   2048

Definition at line 80 of file S25FL204K.h.

#define PAGE_PROGRAM   (unsigned char) 0x02

Definition at line 41 of file S25FL204K.h.

#define S64DEVID   (unsigned char) 0x16

Definition at line 61 of file S25FL204K.h.

#define S64MANID   (unsigned char) 0x01

Definition at line 60 of file S25FL204K.h.

#define SECTOR_COUNT   128

Definition at line 79 of file S25FL204K.h.

#define SECTOR_SIZE   4096

Definition at line 78 of file S25FL204K.h.

#define STAT_REG1   (unsigned char) 0x05

Definition at line 69 of file S25FL204K.h.

#define STAT_REG2   (unsigned char) 0x35

Definition at line 70 of file S25FL204K.h.

#define STAT_REG3   (unsigned char) 0x33

Definition at line 71 of file S25FL204K.h.

Function Documentation

void S25FL_ReadPage ( unsigned long  page,
unsigned char  buffer[] 
)
void S25FL_WriteEnable ( )