版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、AN2784Application noteUsing the high-density STM32F10xxx FSMC peripheral to drive external memoriesIntroductionThis application note describes how to use the High-density STM32F10xxx FSMC (flexible static memory controller) peripheral to drive a set of external memories. To that aim, it gives an ove
2、rview of the STM32F10xxx FSMC controller. Then it provides memory interfacing examples that include the typical FSMC configuration, the timing computation method and the hardware connection.This application note is based on memories mounted on the STM3210E-EVAL, which is the evaluation board for Hig
3、h-density STM32F10xxx devices. The used memories are a 16-bit asynchronous NOR Flash memory, an 8-bit NAND Flash memory and a 16-bit asynchronous SRAM.The STM32F10xxx firmware library, the different memory drivers and examples of use for each of the memory types used in this application note, are av
4、ailable for download from the STMicroelectronics website: /mcu.June 2010Doc ID 14779 Rev 41/31ContentsAN2784Contents1 Overview of the STM32F10xxx flexible static memory controller51.1 Interfacing asynchronous static memories (NOR Flash, SRAM)72 Interfacing with a nonmultiplexed,
5、asynchronous16-bit NOR Flash memory92.1 FSMC configuration92.1.1 Typical use of the FSMC to interface with a NOR Flash memory112.2 Timing computation112.3 Hardware connection132.4 Code execution from an external NOR Flash memory153 Interfacing with a nonmultiplexed, asynchronous 16-bit SRAM163.1 FSM
6、C configuration163.1.1 Typical use of the FSMC to interface with an SRAM173.2 Timing computation173.3 Hardware connection183.4 Using the external SRAM as a data memory194 Interfacing with an 8-bit NAND Flash memory204.1 FSMC configuration214.1.1 Typical use of the FSMC to interface with a NAND memor
7、y224.2 Timing computation234.3 Hardware connection254.4 Error correction code computation264.4.1 Error correction code (ECC) computation overview264.4.2 Error detection275 STM32F10xxx FSMC configuration in 100-pin packages285.1 Interfacing the FSMC with a NAND Flash memory285.2 Interfacing the FSMC
8、with a NOR Flash memory296 Revision history302/31Doc ID 14779 Rev 4AN2784List of tablesList of tablesTable 1.FSMC operating modes8Table 2.STM32F10xCDE FSMC asynchronous timings8Table 3.NOR Flash memory timings12Table 4.M29W128FL signal to FSMC pin correspondence13Table 5.IS61WV51216BL SRAM timings18
9、Table 6.IS61WV51216BLL signal to FSMC pin correspondence18Table 7.NAND512W3A2C Flash memory timings24Table 8.NAND512W3A signal to FSMC pin correspondence25Table 9.NAND Flash memory connection to the FSMC28Table 10.NOR Flash memory connection to the FSMC29Table 11.Document revision history30Doc ID 14
10、779 Rev 43/31List of figuresAN2784List of figuresFigure 1.FSMC block diagram6Figure 2.FSMC memory banks7Figure 3.Asynchronous NOR Flash read access timing10Figure 4.Asynchronous NOR Flash write access timing10Figure 5.16-bit NOR Flash: M29W128FL/GL connection to STM32F10xxx14Figure 6.SRAM asynchrono
11、us read access timing16Figure 7.SRAM asynchronous write access timing17Figure 8.16-bit SRAM: IS61WV51216BLL connection to STM32F10xxx19Figure 9.FSMC NAND bank sections20Figure 10.NAND memory access timing22Figure 11.8-bit NAND Flash: NAND512W3A2C/NAND512W3A2B connection toSTM32F10xxx26Figure 12.Erro
12、r detection flowchart274/31Doc ID 14779 Rev 4AN2784Overview of the STM32F10xxx flexible static memory controller1 Overview of the STM32F10xxx flexible static memory controllerThe FSMC has the following main features: Interfaces with static memory-mapped devices including: Static random access memory
13、 (SRAM) Read-only memory (ROM) NOR Flash memory PSRAM (4 memory banks) Two banks of NAND Flash with ECC hardware that checks up to 8 Kbytes of data 16-bit PC Card compatible devices Supports burst mode access to synchronous devices (NOR Flash and PSRAM) 8- or 16-bit wide databus Independent chip sel
14、ect control for each memory bank Independent configuration for each memory bank Programmable timings to support a wide range of devices, in particular: Programmable wait states (up to 15) Programmable bus turnaround cycles (up to 15) Programmable output enable and write enable delays (up to 15) Inde
15、pendent read and write timings and protocol, so as to support the widest variety of memories and timings Write enable and byte lane select outputs for use with PSRAM and SRAM devices Translation of 32-bit wide AHB transactions into consecutive 16-bit or 8-bit accesses to external 16-bit or 8-bit dev
16、ices A Write FIFO, 2 words long, each word is 32 bits wide, only stores data and not the address. Therefore, this FIFO only buffers AHB write burst transactions. This makes it possible to write to slow memories and free the AHB quickly for other operations. Only one burst at a time is buffered: if a
17、 new AHB burst or single transaction occurs while an operation is in progress, first the FIFO is drained ( The FSMC will insert wait states until the current memory access is complete). External asynchronous wait controlThe FSMC registers that define the external device type and associated character
18、istics are usually set at boot time and do not change until the next reset or power-up. However, it is possible to change the settings at any time.Figure 1 illustrates the FSMC block diagram.Doc ID 14779 Rev 45/31Overview of the STM32F10xxx flexible static memory controllerAN2784 From clock controll
19、er HCLKFSMC interrupt to NVICNAND/PC Card memory controllerConfiguration RegistersNORmemory controllerai14718cPC Card signalsFSMC_INTR FSMC_NCE4_1 FSMC_NCE4_2 FSMC_NIORD FSMC_NIOWR FSMC_NIOS16 FSMC_NREGFSMC_CDNANDsignalsFSMC_NCE3:2 FSMC_INT3:2Shared signalsFSMC_A25:0 FSMC_D15:0 FSMC_NOE FSMC_NWE FSM
20、C_NWAITNOR/PSRAMsignalsFSMC_NE4:1 FSMC_NL (or NADV) FSMC_NBL1:0 FSMC_CLKAHB busFigure 1.FSMC block diagramFrom the FSMC point of view, the external memory is divided into four fixed-size banks of 256 Mbytes each, as shown in Figure 2: Bank 1 used by the NOR Flash/SRAM controller to address up to 4 m
21、emory devices. This bank is split into 4 regions with 4 dedicated Chip Select signals. Banks 2 and 3 used by the NAND Flash/PC Card controller to address NANDFlash devices. Bank 4 used by the NAND Flash/PC Card controller to address a PC Card device.For each bank, the type of memory to be used is us
22、er-defined in the Configuration register.6/31Doc ID 14779 Rev 4AN2784Overview of the STM32F10xxx flexible static memory controllerai147199FFF FFF FhPC Card8FFF FFF Fh9000 0000h8000 0000hNAND Flash7FFF FFF Fh6FFF FFF Fh7000 0000hNOR / PSRAM6000 0000hSuppo rted memory typeBanksAddressBank 44 64 MBBank
23、 34 64 MBBank 24 64 MBBank 14 64 MBFigure 2.FSMC memory banks1.1 Interfacing asynchronous static memories (NOR Flash, SRAM)The interface signals are synchronized by the internal clock HCLK. This clock is not output to the memoryThe FSMC always samples the data before de-asserting the chip select sig
24、nal NE. This guarantees that the memory data-hold timing constraint is met (chip enable high to data transition, usually 0 ns min.). If extended mode is enabled (EXTMOD: bit is set in the FSMC_BCRx register), there are up to four extended modes (A, B, C and D) and it is possible to mix modes A, B, C
25、 and D in read and write access. If Extended mode is disabled, the FSMC operates in Mode1 or Mode2 as follows: Mode 1 is the default mode when SRAM/CRAM memory type is selected ( Bits 3:2 MTYP = 0x0 or 0x01 in the FSMC_BCRx register) Mode 2 is the default mode when NOR memory type is selected ( Bits
26、 3:2 MTYP = 0x10 in the FSMC_BCRx register) Doc ID 14779 Rev 47/31Overview of the STM32F10xxx flexible static memory controllerAN2784Table 1.FSMC operating modesAsynchronous modeMemory typeSRAM/CRAMNORExtended mode disabledMode 1Mode2Extended mode enabledMode AMode B, C, DTable 2.STM32F10xCDE FSMC a
27、synchronous timingsSymbolsParameterValueUnitHCLKInternal AHB clock frequency72MHztHCLKInternal AHB clock cycle13.88nstsu(Data_NE) + tv(A_NE)Data to FSMC_NEx high setup time + FSMC_NEx low to FSMC_A valid2tHCLK + 25nsNote:These timings extracted from STM32F103xCDE datasheet are needed for computing t
28、he NOR and SRAM asynchronous mode timings.8/31Doc ID 14779 Rev 4AN2784Interfacing with a nonmultiplexed, asynchronous 16-bit NOR Flash memory2 Interfacing with a nonmultiplexed, asynchronous 16-bit NOR Flash memory2.1 FSMC configurationTo control a NOR Flash memory, the FSMC provides the following p
29、ossible features: Select the bank to be used to map the NOR Flash memory: there are 4 independent banks which can be used to interface with NOR Flash/SRAM/PSRAM memories, each bank has a separate Chip Select pin. Enable or disable the address/data multiplexing feature Select the memory type to be us
30、ed: NOR Flash/SRAM/PSRAM Define the external memory databus width: 8/16 bits Enable or disable the burst access mode for synchronous NOR Flash memories Configure the use of the wait signal: enable/disable, polarity setting and timing configuration. Enable or disable the extended mode: this mode is u
31、sed to access the memory with a different timing configuration for read and write operations.As the NOR Flash/PSRAM controller can support asynchronous and synchronous memories, the user should select only the used parameters depending on the memory characteristics.The FSMC also provides the possibi
32、lity of programming several parameters to correctly interface with the external memory. Depending on the memory type, some parameters are not used.In the case where an external asynchronous nonmultiplexed memory is used, the user has to compute and set the following parameters depending on the infor
33、mation in the memory datasheet: ADDSET: address setup time DATAST: data setup time ACCMOD: access modeThis parameter gives the FSMC the flexibility to access a wide variety of asynchronous static memories. There are four extended access modes (A, B, C and D) that allow write access while reading the
34、 memory with different timings, if the memory supports this kind of feature.When the extended mode is enabled, the FSMC_BTR register is used for read operations and the FSMC_BWR register is used for write operations.In the case where a synchronous memory is used, the user has to compute and set the
35、following parameters: CLKDIV: clock divide ratio DATLAT: data latencyNote that NOR Flash memory read operations can be synchronous if the memory supports this mode, while write operations usually remain asynchronous.When programming a synchronous NOR Flash memory, the memory automatically switches b
36、etween the synchronous and the asynchronous mode, so in this case, all parameters have to be set correctly.Doc ID 14779 Rev 49/31Interfacing with a nonmultiplexed, asynchronous 16-bit NOR Flash memoryAN2784Figure 3 and Figure 4 show the different timings during a typical NOR Flash memory access.ai14
37、724cD15:0NWENOENExNADVA25:0(DATAST + 1) 2 HCLKHCLK cycles cyclesData sampled Data strobe(ADDSET +1)HCLK cyclesdata driven by memoryHighMemory transactionFigure 3.Asynchronous NOR Flash read access timingFigure 4.Asynchronous NOR Flash write access timingai14723bD15:0NWENOENExNADVA25:0(DATAST + 1)HCL
38、K cycles(ADDSET +1)HCLK cyclesdata driven by FSMC1HCLKMemory transaction10/31Doc ID 14779 Rev 4AN2784Interfacing with a nonmultiplexed, asynchronous 16-bit NOR Flash memory2.1.1 Typical use of the FSMC to interface with a NOR Flash memoryThe STM32F10xxx FSMC has four different banks of 64 Mbytes to
39、support NOR Flash memories/PSRAMs and similar external memories.The external memories share the address, data and control signals with the controller. Each external device is accessed by means of a unique Chip Select signal, but the FSMC performs only one access at a time to an external device.Each
40、bank is configured by means of dedicated registers. Configuration includes the different features and the timing parameters.In this application note, the M29W128FL memory is used as a reference. The M29W128FL memory is a 16-bit, asynchronous, nonmultiplexed NOR Flash memory. Based on these data, the
41、 FSMC is configured as follows:Bank 2 is selected to support the NOR Flash memory device: Bank 2 is enabled: BCR2_MBKEN bit set to 1 Memory type is NOR: BCR2_MTYP is set to 10 to select the NOR memory type Databus width is 16-bit: BCR2_MWID is set to 01 to select the 16-bit width It is a nonmultiple
42、xed memory: BCR2_MUXEN is reset. All remaining parameters must be kept cleared.2.2 Timing computationAs described above, for asynchronous NOR Flash-like memories, there are different possible access protocols. The first step is therefore to define the kind of protocol that should be used with the sp
43、ecific memory. The choice depends on the different control signals and the behavior of the memory during read and write transactions.In the case of an asynchronous NOR Flash memory, the Mode 2 protocol will be used. If the used memory can provide an NADV signal, the Extended ModeB protocol should be
44、 used.With the M29W129FL, we will use the Mode2 protocol. We will therefore not use any extended mode and the timings will be the same for read and write operations. In this case, the NOR memory controller needs two timing parameters: ADDSET and DATAST.These parameters are computed according to the
45、NOR Flash memory characteristics and according to the HCLK clock of the STM32F10xxx.Based on the NOR Flash memory access timings illustrated in Figure 3 and Figure 4, the following equations are found: The write or read access time is the time between the falling edge and the rising edge of the memo
46、ry Chip Select signal. This time is computed as a function of the FSMC timing parameter:(ADDSET + 1) + (DATAST + 1) tHCLK Write access time In write operations, the DATAST parameter is measured between the falling edge and the rising edge of the write signal as follows:tWP = DATAST tHCLK Write Enabl
47、e signal low to highDoc ID 14779 Rev 411/31Interfacing with a nonmultiplexed, asynchronous 16-bit NOR Flash memoryAN2784To have a correct configuration of the FSMC timings, the timings have to take into account: the maximum read/write access time the different internal FSMC delays the different inte
48、rnal memory delays Hence, we have:(ADDSET + 1) + (DATAST + 1) tHCLK = max (tWC)DATAST HCLK = tWPFor read access, DATAST must verify:DATAST (tAVQV + tsu(Data_NE) + tv(A_NE)/tHCLK ADDSET 4Table 3 gives the meanings and values of the NOR Flash memory parameters.Table 3.NOR Flash memory timingsSymbolsPa
49、rameterValueUnitM29W128xx70S29GL128P90tWCAddress valid to next address valid for write operation7090nstRCAddress valid to next address valid for read access7090nstWPWrite Enable low to Write Enable high4535nstAVQVAddress valid to output valid7090nsUsing the memory timings in Table 3 and the STM32F10
50、xCDE FSMC asynchronous timings in Table 2, we can compute the following values: For the M29W128 NOR Flash memory, the timings are: Address setup time: 0x0 Data setup time: 0x5 For the S29GL128P NOR Flash memory, the timings are: Address setup time: 0x2 Data setup time: 0x5Note:1The S29GL128P NOR Fla
51、sh memory timings are also valid for the M29W128 NOR Flash memory.12/31Doc ID 14779 Rev 4AN2784Interfacing with a nonmultiplexed, asynchronous 16-bit NOR Flash memory2.3 Hardware connectionTable 4 gives the correspondence between the NOR Flash memory pins and the FSMC pins and shows the GPIO configu
52、ration for each FSMC pin.In case of an 8-bit NOR Flash memory, the data/address bus is 8-bit wide and D8-D15 should not be connected to the FSMC. The unused FSMC pins can be used for general purpose I/O.In case of a synchronous memory, the FSMC_CLK pin should be connected to the memory clock pin.Tab
53、le 4.M29W128FL signal to FSMC pin correspondenceMemory signalsFSMCsignalsPin / Port assignmentPin / Port configurationSignal descriptionA0-A22A0-A22Port F/Port G/Port E/Port DAF push-pullAddress A0-A22DQ0-DQ7D0-D7Port D/Port EAF push-pullData D0-D7DQ8-DQ14D8-D14Port D/Port EAF push-pullData D8-D14DQ
54、15A-1D15PD10AF push-pullData D15ENE2PG9AF push-pullChip EnableGNOEPD4AF push-pullOutput EnableWNWEPD5AF push-pullWrite EnableFigure 5 shows a typical connection between an STM32F10xxx microcontroller and the M29W128FL NOR Flash memory. It is an abstract from the schematic of the STM3210E- EVAL (STM32F10xxx evaluation board).Doc ID 14779 Rev 413/31Interfacing with a nonmultiplexed, asynchronous 16-bit NOR Flash memoryAN2784ai15180Default setting: Op
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年山西高考(数学)考试试卷(真题)及答案
- 广西壮族自治区北海市2026年重点学校高一入学数学分班考试试题及答案
- 2026年贵州中考地生会考考试试卷及答案
- 2026年四川省重点学校初一入学数学分班考试试题及答案
- 2026年山东中考(数学)考试试卷真题(含答案)
- 2026年贵州省政府采购评审专家试题解析答案
- 冬奥模拟考试题及答案
- 河南省漯河市实验中学等校2025-2026学年下学期七年级期末地理学情素质调研试卷(文字版含答案)
- 2026云南卷物理解读
- 教学设计2026苏科版九年级数学·上册· 第1章·反比例函数1.2反比例函数的图象与性质(4)k的几何意义(有答案)
- (2026年)胸腔镜下交感神经切断术手术配合课件
- 2026校招:长安汇通公司面试题及答案
- 食用油厂生产管理制度
- 万邑通在线测评题库及答案
- 2025年园林绿化工程安全教育培训试题及答案
- 橡胶制品生产工岗前技术评优考核试卷含答案
- 医学实验室工作汇报
- 伤损钢轨管理办法
- 中外运2025校招在线笔试题目及答案
- 儿童弹性髓内钉课件
- DBJ-T45-180-2024 《电动自行车停放充电场所建设技术标准》
评论
0/150
提交评论