TUKS MCU Introductory course / TUKS-COURSE-TIMER
Committer:
elmot
Date:
Fri Feb 24 21:13:56 2017 +0000
Revision:
1:d0dfbce63a89
Ready-to-copy

Who changed what in which revision?

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