关于STM32中Bank、Sector、Page的理解

本文通过对比F1、F4、L4系列的手册数据,浅谈对Bank、Sector、Page相关概念的理解。
以我们常用的STM32F103C8T6为例:
在这里插入图片描述
它具有64K的闪存大小,属于中容量产品。
STM32中文参考手册_V10中,是这样描述嵌入式闪存的:
在这里插入图片描述
中容量产品主存储块最大为16x64位,每个存储块划分为128个1K字节的页,对应的表3如下:
在这里插入图片描述
在手册随后的擦除和编程相关的描述中:
在这里插入图片描述
我们就知道了,STM32F1系列最小擦除粒度为页面(1K),最小写入粒度为半字(2byte)。

再以STM32F4系列为例,这里就不看芯片手册,直接看中文参考手册了:
在这里插入图片描述
最小擦除粒度为扇区(最小的16K),最小写入粒度为字节(1byte)。

再看看STM32L4系列,这里只找到了英文的参考手册:
在这里插入图片描述
然后是它的分区结构:
在这里插入图片描述

它把存储器分成了2份,所以有页擦除、bank擦除和整体擦除三种擦除方式。
最小擦除粒度为页(2Kbyte),因为具有ECC纠错,所以最小写入粒度为64bit。

其实对于bank、sector和page的了解,我觉得需要知道针对我们所使用的MCU,最小写入粒度和最小擦除粒度是什么,具体大小是多少就行了。

系列最小擦除粒度最小写入粒度
STM32F0FLASH_TYPEERASE_PAGESFLASH_TYPEPROGRAM_WORD
STM32F1FLASH_TYPEERASE_PAGESFLASH_TYPEPROGRAM_WORD
STM32F2FLASH_TYPEERASE_SECTORSFLASH_TYPEPROGRAM_BYTE
STM32F4FLASH_TYPEERASE_SECTORSFLASH_TYPEPROGRAM_BYTE
STM32L4FLASH_TYPEERASE_PAGESFLASH_TYPEPROGRAM_DOUBLEWORD
STM32F7FLASH_TYPEERASE_SECTORSFLASH_TYPEPROGRAM_BYTE
  • 10
    点赞
  • 41
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Version: 2.5.0 (2020-10-21) Keil.STM32L4xx_DFP.2.5.0.pack Updated Pack to STM32Cube_FW_L4 Firmware Package version V1.16.0 using HAL Drivers V1.12.0 Package Description (pdsc): Added global define USE_HAL_DRIVER to the component ::Device:STM32Cube HAL:Common. Device support: Aligned devices with CubeMX DB. CMSIS Flash Algorithm: Removed targets (STM32L4xx_512, STM32L4xx_256) from STM32L4Rx Flash Algorithm project. Added source code for: STM32L476G-Disco QSPI, STM32L4P5G-DK OSPI, STM32L4P5G-DK PSRAM STM32L4R9I-DK PSRAM, STM32L4R9I-DK OSPI1 and STM32L4R9I-EVAL OSPI. Added PSRAM external Loader support for STM32L4R9I-Disco. Fixed STM32L4P5 1M internal flash Loader sector erase with DBANK mode. Fixed STM32L4xx 512K and 128K internal flash Loader sector erase. CMSIS-Driver: MCI: Replaced empty delay loops with _NOP(). Added handling for separate SD and MMC HAL layers. Added busy signal handling after CMDREND interrupt. SPI: Corrected PowerControl function (to return error if Initialize was not called, to abort active transfer if power off was requested). Updated GetDataCount function to give accurate count. Corrected Uninitialize function (to power off the peripheral if it is powered). USART: Added Driver_USART6 (uses LPUART1). Corrected GetTxCount/GetRxCount implementation. USBD: Removed include of stm32l4xx_hal_pcd.h header. Corrected documentation of STM32CubeMx configuration. Updated Boards Examples: Migrated CubeMX projects to V6.0.1. Changed variant selection to "MDK-Plus" where possible. Updated all USB Host/Device examples with user templates from MDK-Middleware v7.11.1.
Version: 2.5.0 (2020-10-21) Keil.STM32L4xx_DFP.2.5.0.pack Download Updated Pack to STM32Cube_FW_L4 Firmware Package version V1.16.0 using HAL Drivers V1.12.0 Package Description (pdsc): Added global define USE_HAL_DRIVER to the component ::Device:STM32Cube HAL:Common. Device support: Aligned devices with CubeMX DB. CMSIS Flash Algorithm: Removed targets (STM32L4xx_512, STM32L4xx_256) from STM32L4Rx Flash Algorithm project. Added source code for: STM32L476G-Disco QSPI, STM32L4P5G-DK OSPI, STM32L4P5G-DK PSRAM STM32L4R9I-DK PSRAM, STM32L4R9I-DK OSPI1 and STM32L4R9I-EVAL OSPI. Added PSRAM external Loader support for STM32L4R9I-Disco. Fixed STM32L4P5 1M internal flash Loader sector erase with DBANK mode. Fixed STM32L4xx 512K and 128K internal flash Loader sector erase. CMSIS-Driver: MCI: Replaced empty delay loops with _NOP(). Added handling for separate SD and MMC HAL layers. Added busy signal handling after CMDREND interrupt. SPI: Corrected PowerControl function (to return error if Initialize was not called, to abort active transfer if power off was requested). Updated GetDataCount function to give accurate count. Corrected Uninitialize function (to power off the peripheral if it is powered). USART: Added Driver_USART6 (uses LPUART1). Corrected GetTxCount/GetRxCount implementation. USBD: Removed include of stm32l4xx_hal_pcd.h header. Corrected documentation of STM32CubeMx configuration. Updated Boards Examples: Migrated CubeMX projects to V6.0.1. Changed variant selection to "MDK-Plus" where possible. Updated all USB Host/Device examples with user templates from MDK-Middleware v7.11.1.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值