没有合适的资源?快使用搜索试试~ 我知道了~
STM32F10xxx闪存编程手册_英文版.pdf
需积分: 14 2 下载量 64 浏览量
2012-07-03
18:26:10
上传
评论
收藏 280KB PDF 举报
温馨提示
试读
34页
STM32F10xxx闪存编程手册_英文版.pdf
资源详情
资源评论
资源推荐
February 2010 Doc ID 13259 Rev 8 1/34
PM0042
Programming manual
STM32F10xxx Flash programming
Introduction
This programming manual describes how to program the Flash memory of STM32F101xx,
STM32F102xx, STM32F103xx, STM32F105xx and STM32F107xx microcontrollers. For
convenience, these will be referred to as STM32F10xxx in the rest of this document unless
otherwise specified.
The STM32F10xxx embedded Flash memory can be programmed using in-circuit
programming or in-application programming.
The in-circuit programming (ICP) method is used to update the entire contents of the
Flash memory, using the JTAG, SWD protocol or the boot loader to load the user application
into the microcontroller. ICP offers quick and efficient design iterations and eliminates
unnecessary package handling or socketing of devices.
In contrast to the ICP method, in-application programming (IAP) can use any
communication interface supported by the microcontroller (I/Os, USB, CAN, UART, I
2
C, SPI,
etc.) to download programming data into memory. IAP allows the user to re-program the
Flash memory while the application is running. Nevertheless, part of the application has to
have been previously programmed in the Flash memory using ICP.
The Flash interface implements instruction access and data access based on the AHB
protocol. It implements a prefetch buffer that speeds up CPU code execution. It also
implements the logic necessary to carry out Flash memory operations (Program/Erase).
Program/Erase operations can be performed over the whole product voltage range.
Read/Write protections and option bytes are also implemented.
www.st.com
Contents PM0042
2/34 Doc ID 13259 Rev 8
Contents
1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Flash module organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Reading/programming the STM32F10xxx embedded Flash memory 12
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2 Read operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.1 Instruction fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.2 D-Code interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.3 Flash access controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3 Flash program and erase controller (FPEC) . . . . . . . . . . . . . . . . . . . . . . 13
2.3.1 Key values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.2 Unlocking the Flash memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.3 Main Flash memory programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.4 Flash memory erase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.5 Option byte programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4 Protections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.1 Read protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.2 Write protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.4.3 Option byte block write protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.5 Option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3 Register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.1 Flash access control register (FLASH_ACR) . . . . . . . . . . . . . . . . . . . . . . 24
3.2 FPEC key register (FLASH_KEYR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.3 Flash OPTKEY register (FLASH_OPTKEYR) . . . . . . . . . . . . . . . . . . . . . 25
3.4 Flash status register (FLASH_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.5 Flash control register (FLASH_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.6 Flash address register (FLASH_AR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.7 Option byte register (FLASH_OBR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.8 Write protection register (FLASH_WRPR) . . . . . . . . . . . . . . . . . . . . . . . . 29
3.9 Flash register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
List of tables PM0042
4/34 Doc ID 13259 Rev 8
List of tables
Table 1. Flash module organization (low-density devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Table 2. Flash module organization (medium-density devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Table 3. Flash module organization (high-density devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Table 4. Flash module organization (connectivity line devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Table 5. Flash memory protection status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Table 6. Option byte format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Table 7. Option byte organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Table 8. Description of the option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Table 9. Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Table 10. Flash interface - register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Table 11. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
PM0042 List of figures
Doc ID 13259 Rev 8 5/34
List of figures
Figure 1. Programming procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 2. Flash memory Page Erase procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 3. Flash memory Mass Erase procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
剩余33页未读,继续阅读
陪你去看南极光
- 粉丝: 16
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0