This demo reads a bitmap from a FAT formatted SD-card, copies it to flash and displays it on the screen. The demo is based on the following project: https://os.mbed.com/users/DieterGraef/code/DISCO-F746NG_SDFileSystem/

Dependencies:   LCD_DISCO_F746NG TS_DISCO_F746NG mbed FATFileSystem

Fork of DISCO-F746NG_SDFileSystem by Dieter Graef

Committer:
Lightsource
Date:
Thu Apr 19 19:59:54 2018 +0000
Revision:
4:95e30a911d97
Demo that reads a bitmap from SD-card, copies it to flash and displays it on the screen.

Who changed what in which revision?

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