library

Dependents:   Aprendendo Final_v3

Committer:
bcostm
Date:
Fri Dec 18 07:32:01 2015 +0000
Revision:
0:0002c86c2220
Initial version

Who changed what in which revision?

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