![]() |
Da Vinci Firmware 1
Firmware for the DaVinci-M rocket avionics board.
|
Driver for W25Qxxx series Quad-SPI NOR Flash memory. More...
#include "main.h"

Go to the source code of this file.
Macros | |
| #define | QFLASH_INSTRUCTION_MODE QSPI_INSTRUCTION_1_LINE |
| #define | QFLASH_ADDRESS_SIZE QSPI_ADDRESS_32_BITS |
| #define | QFLASH_ALTERNATE_BYTE_MODE QSPI_ALTERNATE_BYTES_NONE |
| #define | QFLASH_DDR_MODE QSPI_DDR_MODE_DISABLE |
| #define | QFLASH_DDR_HOLD_HALF_CYCLE QSPI_DDR_HHC_ANALOG_DELAY |
| #define | QFLASH_SIOO_MODE QSPI_SIOO_INST_EVERY_CMD |
| #define | QFLASH_DUMMY_CYCLES 0 |
| #define | QFLASH_DEF_TIMEOUT HAL_QSPI_TIMEOUT_DEFAULT_VALUE |
| #define | QFLASH_BSY_TIMEOUT 400000 |
| #define | QFLASH_ADDRESS_MODE QSPI_ADDRESS_4_LINES |
| #define | QFLASH_DATA_MODE QSPI_DATA_4_LINES |
| #define | QFLASH_READ_COMMAND W25_FREAD_QUAD |
| #define | QFLASH_READ_DUMMYC 4 |
| #define | QFLASH_ALT_BYTES 0xFF |
| #define | QFLASH_ALT_BYTES_S QSPI_ALTERNATE_BYTES_8_BITS |
| #define | QFLASH_ALT_BYTES_M QSPI_ALTERNATE_BYTES_4_LINES |
| #define | QFLASH_WRITE_COMMAND W25_FPAGE_P_QUAD_4B |
| #define | QFLASH_WDATA_MODE QSPI_DATA_4_LINES |
| #define | W25_RESET_EN 0x66 |
| #define | W25_RESET 0x99 |
| #define | W25_W_ENABLE 0x06 |
| #define | W25_READ 0x03 |
| #define | W25_FREAD 0x0B |
| #define | W25_FREAD_DUAL 0xBB |
| #define | W25_FREAD_QUAD 0xEB |
| #define | W25_PAGE_P 0x02 |
| #define | W25_FPAGE_P_QUAD 0x32 |
| #define | W25_FPAGE_P_QUAD_4B 0x34 |
| #define | W25_S_ERASE4K 0x20 |
| #define | W25_S_ERASE4K_4B 0x21 |
| #define | W25_B_ERASE32K 0x52 |
| #define | W25_B_ERASE64K 0xD8 |
| #define | W25_B_ERASE64K_4B 0xDC |
| #define | W25_CH_ERASE 0xC7 |
| #define | W25_POWERDOWN 0xB9 |
| #define | W25_POWERUP_ID 0xAB |
| #define | W25_JEDEC_ID 0x9F |
| #define | W25_R_SR1 0x05 |
| #define | W25_R_SFPD_REG 0x5A |
| #define | W25_W_DISABLE 0x04 |
| #define | W25_MAN_DEVICE_ID 0x90 |
| #define | W25_R_SR2 0x35 |
| #define | W25_W_SR2 0x31 |
| #define | W25_R_SR3 0x15 |
| #define | W25_W_SR3 0x11 |
| #define | W25_SR_W_ENABLE 0x50 |
| #define | W25_ENTER_4B_ADDR 0xB7 |
| #define | W25_DUMMY 0x00 |
| #define | SR1_BIT_BSY (01U) |
| #define | SR1_BIT_WEL (02U) |
| #define | SR2_BIT_QE (0x02U) |
HAL Handle Configuration | |
| #define | FLASH_QSPI_PORT hqspi |
| The HAL QSPI_HandleTypeDef defined in main.h. | |
QSPI Communication Mode | |
Selects between blocking (polling) and non-blocking (DMA) transfers. Uncomment ONE of the following options. | |
| #define | EXT_FLASH_QSPI_DMA_MODE |
Flash Bus Protocol | |
Selects the SPI protocol (Single, Dual, or Quad). This must match the hardware wiring. Uncomment ONE of the following options. | |
| #define | FLASH_QMODE_4 |
| Quad SPI (4-bit data lines). | |
Target Flash Memory Layout | |
Defines the geometry of the specific W25Qxxx chip being used.
| |
| #define | EXT_FLASH_PAGE_SIZE 0x0100 |
| 256 bytes per programmable page. | |
| #define | EXT_FLASH_SECTOR_SIZE 0x1000 |
| 4 KB per erasable sector. | |
| #define | EXT_FLASH_BLOCK_SIZE 0x00010000 |
| 64 KB per erasable block. | |
| #define | EXT_FLASH_SIZE 0x04000000 |
| 64 MB total capacity (W25Q512). | |
| #define | EXT_FLASH_PAGE_NUM (EXT_FLASH_SIZE / EXT_FLASH_PAGE_SIZE) |
| Total number of pages. | |
| #define | EXT_FLASH_SECTOR_NUM (EXT_FLASH_SIZE / EXT_FLASH_SECTOR_SIZE) |
| Total number of sectors. | |
| #define | EXT_FLASH_BLOCK_NUM (EXT_FLASH_SIZE / EXT_FLASH_BLOCK_SIZE) |
| Total number of blocks. | |
Enumerations | |
| enum | HAL_StatusTypeDef { HAL_OK = 0x00 , HAL_ERROR = 0x01 , HAL_BUSY = 0x02 , HAL_TIMEOUT = 0x03 } |
| HAL Status structures definition. More... | |
Driver for W25Qxxx series Quad-SPI NOR Flash memory.
This driver provides a complete set of functions to interface with a Winbond W25Qxxx series NOR Flash memory chip using the STM32's Quad-SPI peripheral. It serves as a hardware abstraction layer for all flash memory operations.
This driver is highly configurable. All user-tunable parameters are located in this header file under the "User Configuration" group. Key features to configure include:
Definition in file z_qflash_W25QXXX.h.
| enum HAL_StatusTypeDef |
HAL Status structures definition.
| Enumerator | |
|---|---|
| HAL_OK | |
| HAL_ERROR | |
| HAL_BUSY | |
| HAL_TIMEOUT | |
Definition at line 314 of file z_qflash_W25QXXX.h.