Clone
Dependents: SignalProcessLab DigitalSignalAlgorithm_Lab DigitalSignal_Lab
Drivers/BSP/Components/n25q128a/n25q128a.h@0:fc80425b677a, 2019-08-26 (annotated)
- Committer:
- ngtkien
- Date:
- Mon Aug 26 16:33:09 2019 +0000
- Revision:
- 0:fc80425b677a
Library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ngtkien | 0:fc80425b677a | 1 | /** |
ngtkien | 0:fc80425b677a | 2 | ****************************************************************************** |
ngtkien | 0:fc80425b677a | 3 | * @file n25q128a.h |
ngtkien | 0:fc80425b677a | 4 | * @author MCD Application Team |
ngtkien | 0:fc80425b677a | 5 | * @version V1.0.0 |
ngtkien | 0:fc80425b677a | 6 | * @date 29-May-2015 |
ngtkien | 0:fc80425b677a | 7 | * @brief This file contains all the description of the N25Q128A QSPI memory. |
ngtkien | 0:fc80425b677a | 8 | ****************************************************************************** |
ngtkien | 0:fc80425b677a | 9 | * @attention |
ngtkien | 0:fc80425b677a | 10 | * |
ngtkien | 0:fc80425b677a | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
ngtkien | 0:fc80425b677a | 12 | * |
ngtkien | 0:fc80425b677a | 13 | * Redistribution and use in source and binary forms, with or without modification, |
ngtkien | 0:fc80425b677a | 14 | * are permitted provided that the following conditions are met: |
ngtkien | 0:fc80425b677a | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
ngtkien | 0:fc80425b677a | 16 | * this list of conditions and the following disclaimer. |
ngtkien | 0:fc80425b677a | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
ngtkien | 0:fc80425b677a | 18 | * this list of conditions and the following disclaimer in the documentation |
ngtkien | 0:fc80425b677a | 19 | * and/or other materials provided with the distribution. |
ngtkien | 0:fc80425b677a | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
ngtkien | 0:fc80425b677a | 21 | * may be used to endorse or promote products derived from this software |
ngtkien | 0:fc80425b677a | 22 | * without specific prior written permission. |
ngtkien | 0:fc80425b677a | 23 | * |
ngtkien | 0:fc80425b677a | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
ngtkien | 0:fc80425b677a | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
ngtkien | 0:fc80425b677a | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
ngtkien | 0:fc80425b677a | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
ngtkien | 0:fc80425b677a | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
ngtkien | 0:fc80425b677a | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
ngtkien | 0:fc80425b677a | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
ngtkien | 0:fc80425b677a | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
ngtkien | 0:fc80425b677a | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
ngtkien | 0:fc80425b677a | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
ngtkien | 0:fc80425b677a | 34 | * |
ngtkien | 0:fc80425b677a | 35 | ****************************************************************************** |
ngtkien | 0:fc80425b677a | 36 | */ |
ngtkien | 0:fc80425b677a | 37 | |
ngtkien | 0:fc80425b677a | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
ngtkien | 0:fc80425b677a | 39 | #ifndef __N25Q128A_H |
ngtkien | 0:fc80425b677a | 40 | #define __N25Q128A_H |
ngtkien | 0:fc80425b677a | 41 | |
ngtkien | 0:fc80425b677a | 42 | #ifdef __cplusplus |
ngtkien | 0:fc80425b677a | 43 | extern "C" { |
ngtkien | 0:fc80425b677a | 44 | #endif |
ngtkien | 0:fc80425b677a | 45 | |
ngtkien | 0:fc80425b677a | 46 | /* Includes ------------------------------------------------------------------*/ |
ngtkien | 0:fc80425b677a | 47 | |
ngtkien | 0:fc80425b677a | 48 | /** @addtogroup BSP |
ngtkien | 0:fc80425b677a | 49 | * @{ |
ngtkien | 0:fc80425b677a | 50 | */ |
ngtkien | 0:fc80425b677a | 51 | |
ngtkien | 0:fc80425b677a | 52 | /** @addtogroup Components |
ngtkien | 0:fc80425b677a | 53 | * @{ |
ngtkien | 0:fc80425b677a | 54 | */ |
ngtkien | 0:fc80425b677a | 55 | |
ngtkien | 0:fc80425b677a | 56 | /** @addtogroup n25q128a |
ngtkien | 0:fc80425b677a | 57 | * @{ |
ngtkien | 0:fc80425b677a | 58 | */ |
ngtkien | 0:fc80425b677a | 59 | |
ngtkien | 0:fc80425b677a | 60 | /** @defgroup N25Q128A_Exported_Types |
ngtkien | 0:fc80425b677a | 61 | * @{ |
ngtkien | 0:fc80425b677a | 62 | */ |
ngtkien | 0:fc80425b677a | 63 | |
ngtkien | 0:fc80425b677a | 64 | /** |
ngtkien | 0:fc80425b677a | 65 | * @} |
ngtkien | 0:fc80425b677a | 66 | */ |
ngtkien | 0:fc80425b677a | 67 | |
ngtkien | 0:fc80425b677a | 68 | /** @defgroup N25Q128A_Exported_Constants |
ngtkien | 0:fc80425b677a | 69 | * @{ |
ngtkien | 0:fc80425b677a | 70 | */ |
ngtkien | 0:fc80425b677a | 71 | |
ngtkien | 0:fc80425b677a | 72 | /** |
ngtkien | 0:fc80425b677a | 73 | * @brief N25Q128A Configuration |
ngtkien | 0:fc80425b677a | 74 | */ |
ngtkien | 0:fc80425b677a | 75 | #define N25Q128A_FLASH_SIZE 0x1000000 /* 128 MBits => 16MBytes */ |
ngtkien | 0:fc80425b677a | 76 | #define N25Q128A_SECTOR_SIZE 0x10000 /* 256 sectors of 64KBytes */ |
ngtkien | 0:fc80425b677a | 77 | #define N25Q128A_SUBSECTOR_SIZE 0x1000 /* 4096 subsectors of 4kBytes */ |
ngtkien | 0:fc80425b677a | 78 | #define N25Q128A_PAGE_SIZE 0x100 /* 65536 pages of 256 bytes */ |
ngtkien | 0:fc80425b677a | 79 | |
ngtkien | 0:fc80425b677a | 80 | #define N25Q128A_DUMMY_CYCLES_READ 8 |
ngtkien | 0:fc80425b677a | 81 | #define N25Q128A_DUMMY_CYCLES_READ_QUAD 10 |
ngtkien | 0:fc80425b677a | 82 | |
ngtkien | 0:fc80425b677a | 83 | #define N25Q128A_BULK_ERASE_MAX_TIME 250000 |
ngtkien | 0:fc80425b677a | 84 | #define N25Q128A_SECTOR_ERASE_MAX_TIME 3000 |
ngtkien | 0:fc80425b677a | 85 | #define N25Q128A_SUBSECTOR_ERASE_MAX_TIME 800 |
ngtkien | 0:fc80425b677a | 86 | |
ngtkien | 0:fc80425b677a | 87 | /** |
ngtkien | 0:fc80425b677a | 88 | * @brief N25Q128A Commands |
ngtkien | 0:fc80425b677a | 89 | */ |
ngtkien | 0:fc80425b677a | 90 | /* Reset Operations */ |
ngtkien | 0:fc80425b677a | 91 | #define RESET_ENABLE_CMD 0x66 |
ngtkien | 0:fc80425b677a | 92 | #define RESET_MEMORY_CMD 0x99 |
ngtkien | 0:fc80425b677a | 93 | |
ngtkien | 0:fc80425b677a | 94 | /* Identification Operations */ |
ngtkien | 0:fc80425b677a | 95 | #define READ_ID_CMD 0x9E |
ngtkien | 0:fc80425b677a | 96 | #define READ_ID_CMD2 0x9F |
ngtkien | 0:fc80425b677a | 97 | #define MULTIPLE_IO_READ_ID_CMD 0xAF |
ngtkien | 0:fc80425b677a | 98 | #define READ_SERIAL_FLASH_DISCO_PARAM_CMD 0x5A |
ngtkien | 0:fc80425b677a | 99 | |
ngtkien | 0:fc80425b677a | 100 | /* Read Operations */ |
ngtkien | 0:fc80425b677a | 101 | #define READ_CMD 0x03 |
ngtkien | 0:fc80425b677a | 102 | #define FAST_READ_CMD 0x0B |
ngtkien | 0:fc80425b677a | 103 | #define DUAL_OUT_FAST_READ_CMD 0x3B |
ngtkien | 0:fc80425b677a | 104 | #define DUAL_INOUT_FAST_READ_CMD 0xBB |
ngtkien | 0:fc80425b677a | 105 | #define QUAD_OUT_FAST_READ_CMD 0x6B |
ngtkien | 0:fc80425b677a | 106 | #define QUAD_INOUT_FAST_READ_CMD 0xEB |
ngtkien | 0:fc80425b677a | 107 | |
ngtkien | 0:fc80425b677a | 108 | /* Write Operations */ |
ngtkien | 0:fc80425b677a | 109 | #define WRITE_ENABLE_CMD 0x06 |
ngtkien | 0:fc80425b677a | 110 | #define WRITE_DISABLE_CMD 0x04 |
ngtkien | 0:fc80425b677a | 111 | |
ngtkien | 0:fc80425b677a | 112 | /* Register Operations */ |
ngtkien | 0:fc80425b677a | 113 | #define READ_STATUS_REG_CMD 0x05 |
ngtkien | 0:fc80425b677a | 114 | #define WRITE_STATUS_REG_CMD 0x01 |
ngtkien | 0:fc80425b677a | 115 | |
ngtkien | 0:fc80425b677a | 116 | #define READ_LOCK_REG_CMD 0xE8 |
ngtkien | 0:fc80425b677a | 117 | #define WRITE_LOCK_REG_CMD 0xE5 |
ngtkien | 0:fc80425b677a | 118 | |
ngtkien | 0:fc80425b677a | 119 | #define READ_FLAG_STATUS_REG_CMD 0x70 |
ngtkien | 0:fc80425b677a | 120 | #define CLEAR_FLAG_STATUS_REG_CMD 0x50 |
ngtkien | 0:fc80425b677a | 121 | |
ngtkien | 0:fc80425b677a | 122 | #define READ_NONVOL_CFG_REG_CMD 0xB5 |
ngtkien | 0:fc80425b677a | 123 | #define WRITE_NONVOL_CFG_REG_CMD 0xB1 |
ngtkien | 0:fc80425b677a | 124 | |
ngtkien | 0:fc80425b677a | 125 | #define READ_VOL_CFG_REG_CMD 0x85 |
ngtkien | 0:fc80425b677a | 126 | #define WRITE_VOL_CFG_REG_CMD 0x81 |
ngtkien | 0:fc80425b677a | 127 | |
ngtkien | 0:fc80425b677a | 128 | #define READ_ENHANCED_VOL_CFG_REG_CMD 0x65 |
ngtkien | 0:fc80425b677a | 129 | #define WRITE_ENHANCED_VOL_CFG_REG_CMD 0x61 |
ngtkien | 0:fc80425b677a | 130 | |
ngtkien | 0:fc80425b677a | 131 | /* Program Operations */ |
ngtkien | 0:fc80425b677a | 132 | #define PAGE_PROG_CMD 0x02 |
ngtkien | 0:fc80425b677a | 133 | #define DUAL_IN_FAST_PROG_CMD 0xA2 |
ngtkien | 0:fc80425b677a | 134 | #define EXT_DUAL_IN_FAST_PROG_CMD 0xD2 |
ngtkien | 0:fc80425b677a | 135 | #define QUAD_IN_FAST_PROG_CMD 0x32 |
ngtkien | 0:fc80425b677a | 136 | #define EXT_QUAD_IN_FAST_PROG_CMD 0x12 |
ngtkien | 0:fc80425b677a | 137 | |
ngtkien | 0:fc80425b677a | 138 | /* Erase Operations */ |
ngtkien | 0:fc80425b677a | 139 | #define SUBSECTOR_ERASE_CMD 0x20 |
ngtkien | 0:fc80425b677a | 140 | #define SECTOR_ERASE_CMD 0xD8 |
ngtkien | 0:fc80425b677a | 141 | #define BULK_ERASE_CMD 0xC7 |
ngtkien | 0:fc80425b677a | 142 | |
ngtkien | 0:fc80425b677a | 143 | #define PROG_ERASE_RESUME_CMD 0x7A |
ngtkien | 0:fc80425b677a | 144 | #define PROG_ERASE_SUSPEND_CMD 0x75 |
ngtkien | 0:fc80425b677a | 145 | |
ngtkien | 0:fc80425b677a | 146 | /* One-Time Programmable Operations */ |
ngtkien | 0:fc80425b677a | 147 | #define READ_OTP_ARRAY_CMD 0x4B |
ngtkien | 0:fc80425b677a | 148 | #define PROG_OTP_ARRAY_CMD 0x42 |
ngtkien | 0:fc80425b677a | 149 | |
ngtkien | 0:fc80425b677a | 150 | /** |
ngtkien | 0:fc80425b677a | 151 | * @brief N25Q128A Registers |
ngtkien | 0:fc80425b677a | 152 | */ |
ngtkien | 0:fc80425b677a | 153 | /* Status Register */ |
ngtkien | 0:fc80425b677a | 154 | #define N25Q128A_SR_WIP ((uint8_t)0x01) /*!< Write in progress */ |
ngtkien | 0:fc80425b677a | 155 | #define N25Q128A_SR_WREN ((uint8_t)0x02) /*!< Write enable latch */ |
ngtkien | 0:fc80425b677a | 156 | #define N25Q128A_SR_BLOCKPR ((uint8_t)0x5C) /*!< Block protected against program and erase operations */ |
ngtkien | 0:fc80425b677a | 157 | #define N25Q128A_SR_PRBOTTOM ((uint8_t)0x20) /*!< Protected memory area defined by BLOCKPR starts from top or bottom */ |
ngtkien | 0:fc80425b677a | 158 | #define N25Q128A_SR_SRWREN ((uint8_t)0x80) /*!< Status register write enable/disable */ |
ngtkien | 0:fc80425b677a | 159 | |
ngtkien | 0:fc80425b677a | 160 | /* Nonvolatile Configuration Register */ |
ngtkien | 0:fc80425b677a | 161 | #define N25Q128A_NVCR_LOCK ((uint16_t)0x0001) /*!< Lock nonvolatile configuration register */ |
ngtkien | 0:fc80425b677a | 162 | #define N25Q128A_NVCR_DUAL ((uint16_t)0x0004) /*!< Dual I/O protocol */ |
ngtkien | 0:fc80425b677a | 163 | #define N25Q128A_NVCR_QUAB ((uint16_t)0x0008) /*!< Quad I/O protocol */ |
ngtkien | 0:fc80425b677a | 164 | #define N25Q128A_NVCR_RH ((uint16_t)0x0010) /*!< Reset/hold */ |
ngtkien | 0:fc80425b677a | 165 | #define N25Q128A_NVCR_ODS ((uint16_t)0x01C0) /*!< Output driver strength */ |
ngtkien | 0:fc80425b677a | 166 | #define N25Q128A_NVCR_XIP ((uint16_t)0x0E00) /*!< XIP mode at power-on reset */ |
ngtkien | 0:fc80425b677a | 167 | #define N25Q128A_NVCR_NB_DUMMY ((uint16_t)0xF000) /*!< Number of dummy clock cycles */ |
ngtkien | 0:fc80425b677a | 168 | |
ngtkien | 0:fc80425b677a | 169 | /* Volatile Configuration Register */ |
ngtkien | 0:fc80425b677a | 170 | #define N25Q128A_VCR_WRAP ((uint8_t)0x03) /*!< Wrap */ |
ngtkien | 0:fc80425b677a | 171 | #define N25Q128A_VCR_XIP ((uint8_t)0x08) /*!< XIP */ |
ngtkien | 0:fc80425b677a | 172 | #define N25Q128A_VCR_NB_DUMMY ((uint8_t)0xF0) /*!< Number of dummy clock cycles */ |
ngtkien | 0:fc80425b677a | 173 | |
ngtkien | 0:fc80425b677a | 174 | /* Enhanced Volatile Configuration Register */ |
ngtkien | 0:fc80425b677a | 175 | #define N25Q128A_EVCR_ODS ((uint8_t)0x07) /*!< Output driver strength */ |
ngtkien | 0:fc80425b677a | 176 | #define N25Q128A_EVCR_VPPA ((uint8_t)0x08) /*!< Vpp accelerator */ |
ngtkien | 0:fc80425b677a | 177 | #define N25Q128A_EVCR_RH ((uint8_t)0x10) /*!< Reset/hold */ |
ngtkien | 0:fc80425b677a | 178 | #define N25Q128A_EVCR_DUAL ((uint8_t)0x40) /*!< Dual I/O protocol */ |
ngtkien | 0:fc80425b677a | 179 | #define N25Q128A_EVCR_QUAD ((uint8_t)0x80) /*!< Quad I/O protocol */ |
ngtkien | 0:fc80425b677a | 180 | |
ngtkien | 0:fc80425b677a | 181 | /* Flag Status Register */ |
ngtkien | 0:fc80425b677a | 182 | #define N25Q128A_FSR_PRERR ((uint8_t)0x02) /*!< Protection error */ |
ngtkien | 0:fc80425b677a | 183 | #define N25Q128A_FSR_PGSUS ((uint8_t)0x04) /*!< Program operation suspended */ |
ngtkien | 0:fc80425b677a | 184 | #define N25Q128A_FSR_VPPERR ((uint8_t)0x08) /*!< Invalid voltage during program or erase */ |
ngtkien | 0:fc80425b677a | 185 | #define N25Q128A_FSR_PGERR ((uint8_t)0x10) /*!< Program error */ |
ngtkien | 0:fc80425b677a | 186 | #define N25Q128A_FSR_ERERR ((uint8_t)0x20) /*!< Erase error */ |
ngtkien | 0:fc80425b677a | 187 | #define N25Q128A_FSR_ERSUS ((uint8_t)0x40) /*!< Erase operation suspended */ |
ngtkien | 0:fc80425b677a | 188 | #define N25Q128A_FSR_READY ((uint8_t)0x80) /*!< Ready or command in progress */ |
ngtkien | 0:fc80425b677a | 189 | |
ngtkien | 0:fc80425b677a | 190 | /** |
ngtkien | 0:fc80425b677a | 191 | * @} |
ngtkien | 0:fc80425b677a | 192 | */ |
ngtkien | 0:fc80425b677a | 193 | |
ngtkien | 0:fc80425b677a | 194 | /** @defgroup N25Q128A_Exported_Functions |
ngtkien | 0:fc80425b677a | 195 | * @{ |
ngtkien | 0:fc80425b677a | 196 | */ |
ngtkien | 0:fc80425b677a | 197 | /** |
ngtkien | 0:fc80425b677a | 198 | * @} |
ngtkien | 0:fc80425b677a | 199 | */ |
ngtkien | 0:fc80425b677a | 200 | |
ngtkien | 0:fc80425b677a | 201 | /** |
ngtkien | 0:fc80425b677a | 202 | * @} |
ngtkien | 0:fc80425b677a | 203 | */ |
ngtkien | 0:fc80425b677a | 204 | |
ngtkien | 0:fc80425b677a | 205 | /** |
ngtkien | 0:fc80425b677a | 206 | * @} |
ngtkien | 0:fc80425b677a | 207 | */ |
ngtkien | 0:fc80425b677a | 208 | |
ngtkien | 0:fc80425b677a | 209 | /** |
ngtkien | 0:fc80425b677a | 210 | * @} |
ngtkien | 0:fc80425b677a | 211 | */ |
ngtkien | 0:fc80425b677a | 212 | |
ngtkien | 0:fc80425b677a | 213 | #ifdef __cplusplus |
ngtkien | 0:fc80425b677a | 214 | } |
ngtkien | 0:fc80425b677a | 215 | #endif |
ngtkien | 0:fc80425b677a | 216 | |
ngtkien | 0:fc80425b677a | 217 | #endif /* __N25Q128A_H */ |
ngtkien | 0:fc80425b677a | 218 | |
ngtkien | 0:fc80425b677a | 219 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |