mt25tl01g.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /**
  2. ******************************************************************************
  3. * @file MT25TL01G.h
  4. * @author MCD Application Team
  5. * @version V1.0.0
  6. * @date 08-August-2016
  7. * @brief This file contains all the description of the MT25TL01G QSPI memory.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __MT25TL01G_H
  39. #define __MT25TL01G_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. /** @addtogroup BSP
  45. * @{
  46. */
  47. /** @addtogroup Components
  48. * @{
  49. */
  50. /** @addtogroup MT25TL01G
  51. * @{
  52. */
  53. /** @defgroup MT25TL01G_Exported_Types
  54. * @{
  55. */
  56. /**
  57. * @}
  58. */
  59. /** @defgroup MT25TL01G_Exported_Constants
  60. * @{
  61. */
  62. /**
  63. * @brief MT25TL01G Configuration
  64. */
  65. #define MT25TL01G_FLASH_SIZE 0x8000000 /* 2 * 512 MBits => 2 * 64MBytes => 128MBytes*/
  66. #define MT25TL01G_SECTOR_SIZE 0x10000 /* 2 * 1024 sectors of 64KBytes */
  67. #define MT25TL01G_SUBSECTOR_SIZE 0x1000 /* 2 * 16384 subsectors of 4kBytes */
  68. #define MT25TL01G_PAGE_SIZE 0x100 /* 2 * 262144 pages of 256 bytes */
  69. #define MT25TL01G_DUMMY_CYCLES_READ_QUAD 8
  70. #define MT25TL01G_DUMMY_CYCLES_READ 8
  71. #define MT25TL01G_DUMMY_CYCLES_READ_DTR 6
  72. #define MT25TL01G_DUMMY_CYCLES_READ_QUAD_DTR 6
  73. #define MT25TL01G_DIE_ERASE_MAX_TIME 460000
  74. #define MT25TL01G_SECTOR_ERASE_MAX_TIME 1000
  75. #define MT25TL01G_SUBSECTOR_ERASE_MAX_TIME 400
  76. /**
  77. * @brief MT25TL01G Commands
  78. */
  79. /* Reset Operations */
  80. #define RESET_ENABLE_CMD 0x66
  81. #define RESET_MEMORY_CMD 0x99
  82. /* Identification Operations */
  83. #define READ_ID_CMD 0x9E
  84. #define READ_ID_CMD2 0x9F
  85. #define MULTIPLE_IO_READ_ID_CMD 0xAF
  86. #define READ_SERIAL_FLASH_DISCO_PARAM_CMD 0x5A
  87. /* Read Operations */
  88. #define READ_CMD 0x03
  89. #define READ_4_BYTE_ADDR_CMD 0x13
  90. #define FAST_READ_CMD 0x0B
  91. #define FAST_READ_DTR_CMD 0x0D
  92. #define FAST_READ_4_BYTE_ADDR_CMD 0x0C
  93. #define DUAL_OUT_FAST_READ_CMD 0x3B
  94. #define DUAL_OUT_FAST_READ_DTR_CMD 0x3D
  95. #define DUAL_OUT_FAST_READ_4_BYTE_ADDR_CMD 0x3C
  96. #define DUAL_INOUT_FAST_READ_CMD 0xBB
  97. #define DUAL_INOUT_FAST_READ_DTR_CMD 0xBD
  98. #define DUAL_INOUT_FAST_READ_4_BYTE_ADDR_CMD 0xBC
  99. #define QUAD_OUT_FAST_READ_CMD 0x6B
  100. #define QUAD_OUT_FAST_READ_DTR_CMD 0x6D
  101. #define QUAD_OUT_FAST_READ_4_BYTE_ADDR_CMD 0x6C
  102. #define QUAD_INOUT_FAST_READ_CMD 0xEB
  103. #define QUAD_INOUT_FAST_READ_DTR_CMD 0xED
  104. #define QUAD_INOUT_FAST_READ_4_BYTE_ADDR_CMD 0xEC
  105. /* Write Operations */
  106. #define WRITE_ENABLE_CMD 0x06
  107. #define WRITE_DISABLE_CMD 0x04
  108. /* Register Operations */
  109. #define READ_STATUS_REG_CMD 0x05
  110. #define WRITE_STATUS_REG_CMD 0x01
  111. #define READ_LOCK_REG_CMD 0xE8
  112. #define WRITE_LOCK_REG_CMD 0xE5
  113. #define READ_FLAG_STATUS_REG_CMD 0x70
  114. #define CLEAR_FLAG_STATUS_REG_CMD 0x50
  115. #define READ_NONVOL_CFG_REG_CMD 0xB5
  116. #define WRITE_NONVOL_CFG_REG_CMD 0xB1
  117. #define READ_VOL_CFG_REG_CMD 0x85
  118. #define WRITE_VOL_CFG_REG_CMD 0x81
  119. #define READ_ENHANCED_VOL_CFG_REG_CMD 0x65
  120. #define WRITE_ENHANCED_VOL_CFG_REG_CMD 0x61
  121. #define READ_EXT_ADDR_REG_CMD 0xC8
  122. #define WRITE_EXT_ADDR_REG_CMD 0xC5
  123. /* Program Operations */
  124. #define PAGE_PROG_CMD 0x02
  125. #define PAGE_PROG_4_BYTE_ADDR_CMD 0x12
  126. #define DUAL_IN_FAST_PROG_CMD 0xA2
  127. #define EXT_DUAL_IN_FAST_PROG_CMD 0xD2
  128. #define QUAD_IN_FAST_PROG_CMD 0x32
  129. #define EXT_QUAD_IN_FAST_PROG_CMD 0x38
  130. #define QUAD_IN_FAST_PROG_4_BYTE_ADDR_CMD 0x34
  131. /* Erase Operations */
  132. #define SUBSECTOR_ERASE_CMD 0x20
  133. #define SUBSECTOR_ERASE_4_BYTE_ADDR_CMD 0x21
  134. #define SECTOR_ERASE_CMD 0xD8
  135. #define SECTOR_ERASE_4_BYTE_ADDR_CMD 0xDC
  136. #define DIE_ERASE_CMD 0xC4
  137. #define PROG_ERASE_RESUME_CMD 0x7A
  138. #define PROG_ERASE_SUSPEND_CMD 0x75
  139. /* One-Time Programmable Operations */
  140. #define READ_OTP_ARRAY_CMD 0x4B
  141. #define PROG_OTP_ARRAY_CMD 0x42
  142. /* 4-byte Address Mode Operations */
  143. #define ENTER_4_BYTE_ADDR_MODE_CMD 0xB7
  144. #define EXIT_4_BYTE_ADDR_MODE_CMD 0xE9
  145. /* Quad Operations */
  146. #define ENTER_QUAD_CMD 0x35
  147. #define EXIT_QUAD_CMD 0xF5
  148. /**
  149. * @brief MT25TL01G Registers
  150. */
  151. /* Status Register */
  152. #define MT25TL01G_SR_WIP ((uint8_t)0x01) /*!< Write in progress */
  153. #define MT25TL01G_SR_WREN ((uint8_t)0x02) /*!< Write enable latch */
  154. #define MT25TL01G_SR_BLOCKPR ((uint8_t)0x5C) /*!< Block protected against program and erase operations */
  155. #define MT25TL01G_SR_PRBOTTOM ((uint8_t)0x20) /*!< Protected memory area defined by BLOCKPR starts from top or bottom */
  156. #define MT25TL01G_SR_SRWREN ((uint8_t)0x80) /*!< Status register write enable/disable */
  157. /* Non volatile Configuration Register */
  158. #define MT25TL01G_NVCR_NBADDR ((uint16_t)0x0001) /*!< 3-bytes or 4-bytes addressing */
  159. #define MT25TL01G_NVCR_SEGMENT ((uint16_t)0x0002) /*!< Upper or lower 128Mb segment selected by default */
  160. #define MT25TL01G_NVCR_DUAL ((uint16_t)0x0004) /*!< Dual I/O protocol */
  161. #define MT25TL01G_NVCR_QUAB ((uint16_t)0x0008) /*!< Quad I/O protocol */
  162. #define MT25TL01G_NVCR_RH ((uint16_t)0x0010) /*!< Reset/hold */
  163. #define MT25TL01G_NVCR_DTRP ((uint16_t)0x0020) /*!< Double transfer rate protocol */
  164. #define MT25TL01G_NVCR_ODS ((uint16_t)0x01C0) /*!< Output driver strength */
  165. #define MT25TL01G_NVCR_XIP ((uint16_t)0x0E00) /*!< XIP mode at power-on reset */
  166. #define MT25TL01G_NVCR_NB_DUMMY ((uint16_t)0xF000) /*!< Number of dummy clock cycles */
  167. /* Volatile Configuration Register */
  168. #define MT25TL01G_VCR_WRAP ((uint8_t)0x03) /*!< Wrap */
  169. #define MT25TL01G_VCR_XIP ((uint8_t)0x08) /*!< XIP */
  170. #define MT25TL01G_VCR_NB_DUMMY ((uint8_t)0xF0) /*!< Number of dummy clock cycles */
  171. /* Extended Address Register */
  172. #define MT25TL01G_EAR_HIGHEST_SE ((uint8_t)0x03) /*!< Select the Highest 128Mb segment */
  173. #define MT25TL01G_EAR_THIRD_SEG ((uint8_t)0x02) /*!< Select the Third 128Mb segment */
  174. #define MT25TL01G_EAR_SECOND_SEG ((uint8_t)0x01) /*!< Select the Second 128Mb segment */
  175. #define MT25TL01G_EAR_LOWEST_SEG ((uint8_t)0x00) /*!< Select the Lowest 128Mb segment (default) */
  176. /* Enhanced Volatile Configuration Register */
  177. #define MT25TL01G_EVCR_ODS ((uint8_t)0x07) /*!< Output driver strength */
  178. #define MT25TL01G_EVCR_RH ((uint8_t)0x10) /*!< Reset/hold */
  179. #define MT25TL01G_EVCR_DTRP ((uint8_t)0x20) /*!< Double transfer rate protocol */
  180. #define MT25TL01G_EVCR_DUAL ((uint8_t)0x40) /*!< Dual I/O protocol */
  181. #define MT25TL01G_EVCR_QUAD ((uint8_t)0x80) /*!< Quad I/O protocol */
  182. /* Flag Status Register */
  183. #define MT25TL01G_FSR_NBADDR ((uint8_t)0x01) /*!< 3-bytes or 4-bytes addressing */
  184. #define MT25TL01G_FSR_PRERR ((uint8_t)0x02) /*!< Protection error */
  185. #define MT25TL01G_FSR_PGSUS ((uint8_t)0x04) /*!< Program operation suspended */
  186. #define MT25TL01G_FSR_PGERR ((uint8_t)0x10) /*!< Program error */
  187. #define MT25TL01G_FSR_ERERR ((uint8_t)0x20) /*!< Erase error */
  188. #define MT25TL01G_FSR_ERSUS ((uint8_t)0x40) /*!< Erase operation suspended */
  189. #define MT25TL01G_FSR_READY ((uint8_t)0x80) /*!< Ready or command in progress */
  190. /**
  191. * @}
  192. */
  193. /** @defgroup MT25TL01G_Exported_Functions
  194. * @{
  195. */
  196. /**
  197. * @}
  198. */
  199. #ifdef __cplusplus
  200. }
  201. #endif
  202. #endif /* __MT25TL01G_H */
  203. /**
  204. * @}
  205. */
  206. /**
  207. * @}
  208. */
  209. /**
  210. * @}
  211. */
  212. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/