ALIENTEK 战舰STM32开发板
STM32 开发指南
V1.1
−ALIENTEK 战舰 STM32 开发板库½数教程
官方店铺 1:http://shop62057469.taobao.com
官方店铺 2:http://
shop62103354.taobao.com
技术论坛:www.openedv.com
www.openedv.com
I
ALIENTEK 战舰STM32开发板
内容简介
........................................................................................................................ I
前言
................................................................................................................................2
第一篇 硬件篇
..............................................................................................................4
第一章 实验平台简介
..................................................................................................5
1.1 ALIENTEK
战舰
STM32
开发板资源初探
........................................................ 5
1.2 ALIENTEK
战舰
STM32
开发板资源说明
........................................................ 7
1.2.1
硬件资源说明
.................................................................................................... 7
1.2.2
½件资源说明
.................................................................................................. 12
第二章 实验平台硬件资源详解
................................................................................14
2.1
开发板原理图详解
............................................................................................ 14
2.1.1 MCU ................................................................................................................. 14
2.1.2
引出
IO
口
....................................................................................................... 16
2.1.3 USB
串口/串口
1
选择接口
............................................................................ 16
2.1.4 JTAG/SWD ....................................................................................................... 17
2.1.5 SRAM ............................................................................................................... 17
2.1.6 LCD/OLED
模块接口
..................................................................................... 18
2.1.7
复½电路
......................................................................................................... 19
2.1.8
启动模式设½接口
......................................................................................... 19
2.1.9 RS232
串口
...................................................................................................... 20
2.1.10 RS485
接口
.................................................................................................... 20
2.1.11 CAN/USB
接口
.............................................................................................. 21
2.1.12 EEPROM ........................................................................................................ 21
2.1.13
游戏手柄接口
............................................................................................... 22
2.1.14 SPI FLASH ..................................................................................................... 22
2.1.15 3D
加速度传感器
.......................................................................................... 23
2.1.16
温湿度传感器接口
....................................................................................... 23
2.1.17
红外接收头
................................................................................................... 23
2.1.18
无线模块接口
............................................................................................... 24
2.1.19 LED ................................................................................................................ 24
2.1.20
按键
............................................................................................................... 25
2.1.21 TPAD
电容触摸按键
..................................................................................... 25
2.1.22 PS/2
接口
........................................................................................................ 26
www.openedv.com
II
ALIENTEK 战舰STM32开发板
2.1.23 OLED/摄像头模块接口 ................................................................................ 26
2.1.24
有源蜂鸣器
................................................................................................... 27
2.1.25 SD
卡/以太½模块接口
................................................................................. 28
2.1.26
多功½端口
................................................................................................... 29
2.1.27
音频选择
....................................................................................................... 30
2.1.28 FM
收发
......................................................................................................... 31
2.1.29
音频输出
....................................................................................................... 31
2.1.30
音频编解码
................................................................................................... 32
2.1.31
电源
............................................................................................................... 32
2.1.33 USB
串口
....................................................................................................... 34
2.2
开发板½用注意事项
......................................................................................... 34
第二篇 ½件篇
............................................................................................................36
第三章
RVMDK
½件入门
..........................................................................................37
3.1 STM32
官方固件库简介
.................................................................................... 37
3.1.1 库开发与寄存器开发的关系
........................................................................ 37
3.1.2
STM32
固件库与
CMSIS
标准讲解
............................................................. 38
3.1.3
STM32
官方库包介绍
................................................................................... 39
3.1.3.1
文件夹介绍:
.............................................................................................. 40
3.1.3.2
关键文件介绍:
.......................................................................................... 41
3.2 RVMDK3.80A
简介
............................................................................................ 42
3.3
新建基于固件库的
RVMDK
工程模板
............................................................. 43
3.3.1 MDK3.8a 安装步骤
........................................................................................ 43
3.3.2 添加 License Key
......................................................................................... 44
3.3.3 新建工程模板
................................................................................................ 46
3.4 MDK
下的程序下½½与调试
............................................................................... 65
3.4.1 STM32
½件仿真
............................................................................................. 65
3.4.2 STM32
程序下½½
............................................................................................. 70
3.4.3 STM32
硬件调试
............................................................................................. 75
3.5 RVMDK
½用技巧
.............................................................................................. 79
3.5.1
文本美化
......................................................................................................... 79
3.5.2
代码编辑技巧
................................................................................................. 83
3.5.3
其他小技巧
..................................................................................................... 88
3.5.4
调试技巧
......................................................................................................... 89
www.openedv.com
III
ALIENTEK 战舰STM32开发板
第四章
STM32
开发基础知识入门
............................................................................93
4.1 MDK
下
C
语言基础复习
.................................................................................. 93
4.1.1
½操½
............................................................................................................. 93
4.1.2 define
宏定义
................................................................................................... 94
4.1.3 ifdef
条件编译
.................................................................................................. 94
4.1.4 extern
变量申明
............................................................................................... 95
4.1.5 typedef
类型别名
............................................................................................. 96
4.1.6
结构½
............................................................................................................. 96
4.2 STM32
系统架构
................................................................................................ 98
4.3 STM32
时钟系统
................................................................................................ 99
4.4
端口复用和重映射
.......................................................................................... 103
4.4.1
端口复用功½
................................................................................................ 103
4.4.2
端口重映射
.................................................................................................... 104
4.5 STM32 NVIC
中断优先级管理
....................................................................... 105
4.6 MDK
中寄存器地址名称映射分析
................................................................. 108
4.7 MDK
固件库快速组织代码技巧
..................................................................... 110
第五章
SYSTEM
文件夹介绍
................................................................................. 116
5.1 delay
文件夹代码介绍
..................................................................................... 116
5.1.1 delay_init
½数
............................................................................................... 117
5.1.2 delay_us
½数
................................................................................................. 118
5.1.3 delay_ms
½数
................................................................................................ 120
5.2 sys
文件夹代码介绍
......................................................................................... 121
5.2.1
IO
口的½操½实现
.................................................................................... 121
5.2.2
中断分组设½½数
....................................................................................... 123
5.3 usart
文件夹介绍
.............................................................................................. 123
5.3.1 printf
½数支持
.............................................................................................. 124
5.3.2 uart_init
½数
.................................................................................................. 124
5.3.3 USART1_IRQHandler
½数...........................................................................
127
第三篇 实战篇
..........................................................................................................130
第六章 跑马灯实验
..................................................................................................131
6.1 STM32 IO
简介
................................................................................................. 132
6.2
硬件设计
.......................................................................................................... 139
www.openedv.com
IV
ALIENTEK 战舰STM32开发板
6.3
½件设计
.......................................................................................................... 139
6.4
仿真与下½½
...................................................................................................... 144
第七章 蜂鸣器实验
..................................................................................................147
7.1
蜂鸣器简介
...................................................................................................... 148
7.2
硬件设计
.......................................................................................................... 148
7.3
½件设计
.......................................................................................................... 149
7.4
仿真与下½½
...................................................................................................... 152
第八章 按键输入实验
..............................................................................................154
8.1 STM32 IO
口简介
............................................................................................. 155
8.2
硬件设计
.......................................................................................................... 155
8.3
½件设计
.......................................................................................................... 155
8.4
仿真与下½½
...................................................................................................... 158
第九章 串口实验
......................................................................................................163
9.1 STM32
串口简介
.............................................................................................. 164
9.2
硬件设计
.......................................................................................................... 166
9.3
½件设计
.......................................................................................................... 167
9.4
下½½验证
.......................................................................................................... 170
第十章 外部中断实验
..............................................................................................173
10.1 STM32
外部中断简介
.................................................................................... 174
10.2
硬件设计
........................................................................................................ 177
10.3
½件设计
........................................................................................................ 177
10.4
下½½验证
........................................................................................................ 179
第十一章 独立看门狗(IWDG)实验
...................................................................179
11.1 STM32
独立看门狗简介
................................................................................ 181
11.2
硬件设计
........................................................................................................ 182
11.3
½件设计
........................................................................................................ 183
11.4
下½½验证
........................................................................................................ 184
第十二章 窗口门狗(WWDG)实验
.....................................................................185
12.1 STM32
窗口看门狗简介
................................................................................ 186
12.2
硬件设计
........................................................................................................ 188
12.3
½件设计
........................................................................................................ 189
12.4
下½½验证
........................................................................................................ 190
www.openedv.com
V
评论