STM32 W25Qxx QuadSPI Driver
0.1a
https://github.com/Crazy-Geeks/STM32-W25Q-QSPI
|
W25Q QSPI Driver. More...
Modules | |
W25Q Chip's Parameters | |
User's chip parameters. | |
W25Q Chip's Commands | |
W25Q Chip commands from datasheet. | |
Exported types | |
External fields and data. | |
Private fields | |
Private variables and defines. | |
Private Methods | |
Internal lib's functions. | |
Public methods | |
Public Methods. | |
Data Structures | |
struct | W25Q_STATUS_REG |
W25Q Status Registers @TODO: Mem protected recognition. More... | |
Functions | |
W25Q_STATE | W25Q_Init (void) |
Initalize function. More... | |
W25Q_STATE | W25Q_EnableVolatileSR (void) |
Make Status Register Volatile. More... | |
W25Q_STATE | W25Q_ReadStatusReg (u8_t *reg_data, u8_t reg_num) |
Read status register to variable. More... | |
W25Q_STATE | W25Q_WriteStatusReg (u8_t reg_data, u8_t reg_num) |
Write status register from variable. More... | |
W25Q_STATE | W25Q_ReadStatusStruct (W25Q_STATUS_REG *status) |
Read all status registers to struct. More... | |
W25Q_STATE | W25Q_IsBusy (void) |
Check chip's busy status. More... | |
W25Q_STATE | W25Q_ReadSByte (i8_t *buf, u8_t pageShift, u32_t pageNum) |
Read signed 8-bit variable. More... | |
W25Q_STATE | W25Q_ReadByte (u8_t *buf, u8_t pageShift, u32_t pageNum) |
Read 8-bit variable. More... | |
W25Q_STATE | W25Q_ReadSWord (i16_t *buf, u8_t pageShift, u32_t pageNum) |
Read signed 16-bit variable. More... | |
W25Q_STATE | W25Q_ReadWord (u16_t *buf, u8_t pageShift, u32_t pageNum) |
Read 16-bit variable. More... | |
W25Q_STATE | W25Q_ReadSLong (i32_t *buf, u8_t pageShift, u32_t pageNum) |
Read signed 32-bit variable. More... | |
W25Q_STATE | W25Q_ReadLong (u32_t *buf, u8_t pageShift, u32_t pageNum) |
Read 32-bit variable. More... | |
W25Q_STATE | W25Q_ReadData (u8_t *buf, u16_t len, u8_t pageShift, u32_t pageNum) |
Read any 8-bit data. More... | |
W25Q_STATE | W25Q_ReadRaw (u8_t *buf, u16_t data_len, u32_t rawAddr) |
Read data from raw addr. More... | |
W25Q_STATE | W25Q_SingleRead (u8_t *buf, u32_t len, u32_t Addr) |
Read data from raw addr by single line. More... | |
W25Q_STATE | W25Q_EraseSector (u32_t SectAddr) |
Erase 4KB Sector. More... | |
W25Q_STATE | W25Q_EraseBlock (u32_t BlockAddr, u8_t size) |
Erase 32KB/64KB Sector. More... | |
W25Q_STATE | W25Q_EraseChip (void) |
Erase all chip. More... | |
W25Q_STATE | W25Q_ProgramSByte (i8_t buf, u8_t pageShift, u32_t pageNum) |
Program signed 8-bit variable. More... | |
W25Q_STATE | W25Q_ProgramByte (u8_t buf, u8_t pageShift, u32_t pageNum) |
Program 8-bit variable. More... | |
W25Q_STATE | W25Q_ProgramSWord (i16_t buf, u8_t pageShift, u32_t pageNum) |
Program signed 16-bit variable. More... | |
W25Q_STATE | W25Q_ProgramWord (u16_t buf, u8_t pageShift, u32_t pageNum) |
Program 16-bit variable. More... | |
W25Q_STATE | W25Q_ProgramSLong (i32_t buf, u8_t pageShift, u32_t pageNum) |
Program signed 32-bit variable. More... | |
W25Q_STATE | W25Q_ProgramLong (u32_t buf, u8_t pageShift, u32_t pageNum) |
Program 32-bit variable. More... | |
W25Q_STATE | W25Q_ProgramData (u8_t *buf, u16_t len, u8_t pageShift, u32_t pageNum) |
Program any 8-bit data. More... | |
W25Q_STATE | W25Q_ProgramRaw (u8_t *buf, u16_t data_len, u32_t rawAddr) |
Program data to raw addr. More... | |
W25Q_STATE | W25Q_SetBurstWrap (u8_t WrapSize) |
Set Burst with Wrap. More... | |
W25Q_STATE | W25Q_ProgSuspend (void) |
Pause Programm/Erase operation. More... | |
W25Q_STATE | W25Q_ProgResume (void) |
Resume Programm/Erase operation. More... | |
W25Q_STATE | W25Q_Sleep (void) |
Set low current consumption. More... | |
W25Q_STATE | W25Q_WakeUP (void) |
Wake the chip up from sleep mode. More... | |
W25Q_STATE | W25Q_ReadID (u8_t *buf) |
Read chip ID. More... | |
W25Q_STATE | W25Q_ReadFullID (u8_t *buf) |
Read full chip ID (Manufacturer ID + Device ID) More... | |
W25Q_STATE | W25Q_ReadUID (u8_t *buf) |
Read unique chip ID. More... | |
W25Q_STATE | W25Q_ReadJEDECID (u8_t *buf) |
Read ID by JEDEC Standards. More... | |
W25Q_STATE | W25Q_ReadSFDPRegister (u8_t *buf) |
Read device descriptor (SFDP Standard) More... | |
W25Q_STATE | W25Q_EraseSecurityRegisters (u8_t numReg) |
Erase security register. More... | |
W25Q_STATE | W25Q_ProgSecurityRegisters (u8_t *buf, u8_t numReg, u8_t byteAddr) |
Program security register. More... | |
W25Q_STATE | W25Q_ReadSecurityRegisters (u8_t *buf, u8_t numReg, u8_t byteAddr) |
Read security register. More... | |
W25Q_STATE | W25Q_BlockReadOnly (u32_t Addr, bool enable) |
Individual block/sector read-only lock. More... | |
W25Q_STATE | W25Q_BlockReadOnlyCheck (bool *state, u32_t Addr) |
Check block's/sector's read-only lock status. More... | |
W25Q_STATE | W25Q_GlobalReadOnly (bool enable) |
Set read-only param to all chip. More... | |
W25Q_STATE | W25Q_SwReset (bool force) |
Software reset. More... | |
W25Q_STATE | W25Q_WriteEnable (bool enable) |
Toggle WOL bit. More... | |
W25Q_STATE | W25Q_Enter4ByteMode (bool enable) |
Toggle ADS bit. More... | |
W25Q_STATE | W25Q_SetExtendedAddr (u8_t Addr) |
Set addr in 3-byte mode. More... | |
W25Q_STATE | W25Q_GetExtendedAddr (u8_t *outAddr) |
Get addr in 3-byte mode. More... | |
enum | W25Q_STATE { W25Q_OK = 0 , W25Q_BUSY = 1 , W25Q_PARAM_ERR = 2 , W25Q_CHIP_ERR = 3 , W25Q_SPI_ERR = 4 , W25Q_CHIP_IGNORE = 5 } |
W25Q Return State Lib's functions status returns. More... | |
W25Q QSPI Driver.
enum W25Q_STATE |
W25Q_STATE W25Q_BlockReadOnly | ( | u32_t | Addr, |
bool | enable | ||
) |
Individual block/sector read-only lock.
Individual block/sector read-only lock.
[in] | Addr | Block address |
[in] | enable | 1-Enable/0-Disable |
W25Q_STATE W25Q_BlockReadOnlyCheck | ( | bool * | state, |
u32_t | Addr | ||
) |
Check block's/sector's read-only lock status.
Check block's/sector's read-only lock status.
[out] | state | Block read-only status (1-locked/0-unlocked) |
[in] | Addr | Block address |
W25Q_STATE W25Q_EnableVolatileSR | ( | void | ) |
Make Status Register Volatile.
Make Status Register Volatile.
none |
W25Q_STATE W25Q_Enter4ByteMode | ( | bool | enable | ) |
Toggle ADS bit.
W25Q Toggle 4-byte mode.
[in] | enable | 1-enable/0-disable |
W25Q_STATE W25Q_EraseBlock | ( | u32_t | BlockAddr, |
u8_t | size | ||
) |
Erase 32KB/64KB Sector.
Erase 32KB/64KB Sector.
[in] | BlockAddr | Block start address |
[in] | size | Size of block: 32KB or 64KB |
W25Q_STATE W25Q_EraseChip | ( | void | ) |
Erase all chip.
Erase all chip.
none |
W25Q_STATE W25Q_EraseSector | ( | u32_t | SectAddr | ) |
Erase 4KB Sector.
Erase 4KB Sector.
[in] | SectAddr | Sector start address |
W25Q_STATE W25Q_EraseSecurityRegisters | ( | u8_t | numReg | ) |
Erase security register.
Erase security register.
[in] | numReg | Number of security register (1..3 / 0-all) |
W25Q_STATE W25Q_GetExtendedAddr | ( | u8_t * | outAddr | ) |
Get addr in 3-byte mode.
W25Q Get extended byte Read extended byte in 3-byte mode.
[out] | Addr | 4th byte of addr |
W25Q_STATE W25Q_GlobalReadOnly | ( | bool | enable | ) |
Set read-only param to all chip.
Set read-only param to all chip.
[in] | enable | 1-enable/0-disable |
W25Q_STATE W25Q_Init | ( | void | ) |
Initalize function.
Initalize function.
none |
W25Q_STATE W25Q_IsBusy | ( | void | ) |
Check chip's busy status.
Check chip's busy status.
none |
W25Q_STATE W25Q_ProgramByte | ( | u8_t | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Program 8-bit variable.
Program 8-bit variable.
[in] | buf | Data to be written (single) |
[in] | pageShift | Byte shift inside page (0..254) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ProgramData | ( | u8_t * | buf, |
u16_t | len, | ||
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Program any 8-bit data.
Program any 8-bit data.
[in] | buf | Pointer to data to be written (single or array) |
[in] | len | Length of data (1..256) |
[in] | pageShift | Byte shift inside page (0..255 - len) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ProgramLong | ( | u32_t | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Program 32-bit variable.
Program 32-bit variable.
[in] | buf | Data to be written (single) |
[in] | pageShift | Byte shift inside page (0..251) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ProgramRaw | ( | u8_t * | buf, |
u16_t | data_len, | ||
u32_t | rawAddr | ||
) |
Program data to raw addr.
Program data to raw addr.
[in] | buf | Pointer to data to be written (single or array) |
[in] | data_len | Length of data (1..256) |
[in] | rawAddr | Start address of chip's cell |
W25Q_STATE W25Q_ProgramSByte | ( | i8_t | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Program signed 8-bit variable.
Program signed 8-bit variable.
[in] | buf | Data to be written (single) |
[in] | pageShift | Byte shift inside page (0..254) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ProgramSLong | ( | i32_t | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Program signed 32-bit variable.
Program signed 32-bit variable.
[in] | buf | Data to be written (single) |
[in] | pageShift | Byte shift inside page (0..251) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ProgramSWord | ( | i16_t | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Program signed 16-bit variable.
Program signed 16-bit variable.
[in] | buf | Data to be written (single) |
[in] | pageShift | Byte shift inside page (0..253) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ProgramWord | ( | u16_t | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Program 16-bit variable.
Program 16-bit variable.
[in] | buf | Data to be written (single) |
[in] | pageShift | Byte shift inside page (0..253) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ProgResume | ( | void | ) |
Resume Programm/Erase operation.
Resume Programm/Erase operation.
none |
W25Q_STATE W25Q_ProgSecurityRegisters | ( | u8_t * | buf, |
u8_t | numReg, | ||
u8_t | byteAddr | ||
) |
Program security register.
Program security register.
[in] | buf | Pointer to 8-bit data bufer |
[in] | numReg | Number of security register (1..3) |
[in] | byteAddr | Byte addr in register (0..255) |
W25Q_STATE W25Q_ProgSuspend | ( | void | ) |
Pause Programm/Erase operation.
Pause Programm/Erase operation.
none |
W25Q_STATE W25Q_ReadByte | ( | u8_t * | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Read 8-bit variable.
Read 8-bit variable.
[out] | buf | Data to be read (single) |
[in] | pageShift | Byte shift inside page (0..254) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ReadData | ( | u8_t * | buf, |
u16_t | len, | ||
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Read any 8-bit data.
Read any 8-bit data.
[out] | buf | Pointer to data to be read (single or array) |
[in] | len | Length of data (1..256) |
[in] | pageShift | Byte shift inside page (0..255 - len) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ReadFullID | ( | u8_t * | buf | ) |
Read full chip ID (Manufacturer ID + Device ID)
Read full chip ID (Manufacturer ID + Device ID)
[out] | buf | Pointer to data from ID register |
W25Q_STATE W25Q_ReadID | ( | u8_t * | buf | ) |
Read chip ID.
Read chip ID.
[out] | buf | Pointer to output data (1 byte) |
W25Q_STATE W25Q_ReadJEDECID | ( | u8_t * | buf | ) |
Read ID by JEDEC Standards.
Read ID by JEDEC Standards.
[out] | buf | Pointer to data from ID register |
W25Q_STATE W25Q_ReadLong | ( | u32_t * | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Read 32-bit variable.
Read 32-bit variable.
[out] | buf | Data to be read (single) |
[in] | pageShift | Byte shift inside page (0..251) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ReadRaw | ( | u8_t * | buf, |
u16_t | data_len, | ||
u32_t | rawAddr | ||
) |
Read data from raw addr.
Read data from raw addr.
[out] | buf | Pointer to data to be written (single or array) |
[in] | data_len | Length of data (1..256) |
[in] | rawAddr | Start address of chip's cell |
W25Q_STATE W25Q_ReadSByte | ( | i8_t * | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Read signed 8-bit variable.
Read signed 8-bit variable.
[out] | buf | Data to be read (single) |
[in] | pageShift | Byte shift inside page (0..254) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ReadSecurityRegisters | ( | u8_t * | buf, |
u8_t | numReg, | ||
u8_t | byteAddr | ||
) |
Read security register.
Read security register.
[out] | buf | Pointer to 8-bit data bufer |
[in] | numReg | Number of security register (1..3) |
[in] | byteAddr | Byte addr in register (0..255) |
W25Q_STATE W25Q_ReadSFDPRegister | ( | u8_t * | buf | ) |
Read device descriptor (SFDP Standard)
Read device descriptor (SFDP Standard)
[out] | buf | Pointer to data from ID register |
W25Q_STATE W25Q_ReadSLong | ( | i32_t * | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Read signed 32-bit variable.
Read signed 32-bit variable.
[out] | buf | Data to be read (single) |
[in] | pageShift | Byte shift inside page (0..251) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ReadStatusReg | ( | u8_t * | reg_data, |
u8_t | reg_num | ||
) |
Read status register to variable.
Read status register to variable.
[out] | reg_data | 1 byte |
[in] | reg_num | Desired register 1..3 |
W25Q_STATE W25Q_ReadStatusStruct | ( | W25Q_STATUS_REG * | status | ) |
Read all status registers to struct.
Read all status registers to struct.
[out] | status | W25Q_STATUS_REG Pointer |
W25Q_STATE W25Q_ReadSWord | ( | i16_t * | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Read signed 16-bit variable.
Read signed 16-bit variable.
[out] | buf | Data to be read (single) |
[in] | pageShift | Byte shift inside page (0..253) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_ReadUID | ( | u8_t * | buf | ) |
Read unique chip ID.
Read unique chip ID.
[out] | buf | Pointer to data from ID register |
W25Q_STATE W25Q_ReadWord | ( | u16_t * | buf, |
u8_t | pageShift, | ||
u32_t | pageNum | ||
) |
Read 16-bit variable.
Read 16-bit variable.
[out] | buf | Data to be read (single) |
[in] | pageShift | Byte shift inside page (0..253) |
[in] | pageNum | Page number (0..PAGE_COUNT) |
W25Q_STATE W25Q_SetBurstWrap | ( | u8_t | WrapSize | ) |
Set Burst with Wrap.
Set Burst with Wrap.
[in] | WrapSize | Wrap size: 8/16/32/64 / 0 - disable |
W25Q_STATE W25Q_SetExtendedAddr | ( | u8_t | Addr | ) |
Set addr in 3-byte mode.
W25Q Set extended byte Extended byte in 3-byte mode.
[in] | Addr | 4th byte of addr |
W25Q_STATE W25Q_SingleRead | ( | u8_t * | buf, |
u32_t | len, | ||
u32_t | Addr | ||
) |
Read data from raw addr by single line.
Read data from raw addr by single line.
[out] | buf | Pointer to data array |
[in] | len | Length of array |
[in] | Addr | Address to data |
W25Q_STATE W25Q_Sleep | ( | void | ) |
Set low current consumption.
Set low current consumption.
none |
W25Q_STATE W25Q_SwReset | ( | bool | force | ) |
Software reset.
Software reset.
[in] | force | Enable/disable (0/1) force reset - wait for BUSY and SUSpend |
W25Q_STATE W25Q_WakeUP | ( | void | ) |
Wake the chip up from sleep mode.
Wake the chip up from sleep mode.
none |
W25Q_STATE W25Q_WriteEnable | ( | bool | enable | ) |
Toggle WOL bit.
W25Q Toggle WEL bit Toggle write enable latch.
[in] | enable | 1-enable write/0-disable write |
W25Q_STATE W25Q_WriteStatusReg | ( | u8_t | reg_data, |
u8_t | reg_num | ||
) |
Write status register from variable.
Write status register from variable.
[in] | reg_data | 1 byte |
[in] | reg_num | Desired register 1..3 |