Table of Contents
Chapter 1 Introduction 1
1.1 Embedded Systems 1
1.1.1 Overview of Embedded Systems 2
1.1.2 Comparison of Embedded Systems and General-Purpose Computer Systems 3
1.1.3 Characteristics of Embedded Systems 4
1.2 Composition of Embedded Systems 6
1.3 Real-Time Operating Systems 8
1.3.1 Concept of Real-Time Systems 8
1.3.2 Basic Features of Real-Time Operating Systems 9
1.3.3 Performance Metrics of Real-Time Operating Systems 10
1.3.4 Classification of Real-Time Operating Systems 10
1.3.5 POSIX Standards 11
1.3.6 Typical Applications of Real-Time Operating Systems 12
1.4 Software for Embedded Systems 12
1.4.1 Embedded Software without Operating Systems 12
1.4.2 Embedded Software with Operating Systems 12
1.4.3 Classification of Embedded Operating Systems 13
1.4.4 Functions of Embedded Real-Time Operating Systems 14
1.4.5 Typical Embedded Operating Systems 15
1.4.6 Software Architecture Selection Recommendations 22
1.5 Classification of Embedded Systems 22
1.5.1 Classification by Application Object 23
1.5.2 Classification by Function and Performance 23
1.5.3 Classification by Structural Complexity 23
1.6 Application Areas of Embedded Systems 24
1.7 Architecture of Embedded Systems 25
1.7.1 Hardware Architecture 26
1.7.2 Software Layers 26
1.8 Design Methods for Embedded Systems 29
1.8.1 Overall Structure of Embedded Systems 29
1.8.2 Design Process of Embedded Systems 30
1.8.3 Hardware/Software Co-design Techniques for Embedded Systems 32
Chapter 2 Embedded Microprocessors 34
2.1 Introduction to Arm Embedded Microprocessors 34
2.1.1 Features of Arm Processors 34
2.1.2 Versions and Series of Arm Architecture 35
2.1.3 RISC Structural Characteristics of Arm 38
2.1.4 Arm Processor Series 38
2.1.5 Arm Cortex-M Processors 41
2.2 Classification and Characteristics of Embedded Processors 42
2.3 Cortex-M3 Embedded Microprocessor 45
2.3.1 Overview of Arm 45
2.3.2 CISC and RISC 48
2.3.3 Evolution of Arm Architecture 50
2.3.4 Arm Architecture and Characteristics 52
2.3.5 Cortex-M Series Processors 54
2.3.6 Main Features of Cortex-M3 Processors 56
2.3.7 Structure of Cortex-M3 Processors 57
2.3.8 Memory Systems 59
Chapter 3 STM32 Series Microcontrollers 62
3.1 Overview of STM32 Microcontrollers 62
3.1.1 Introduction to STM32 Microcontroller Products 63
3.1.2 System Performance Analysis of STM32 67
3.1.3 Naming Rules of STM32 Microcontrollers 68
3.1.4 Selection of STM32 Microcontrollers 72
3.2 System Architecture of STM32F1 Series Products and Internal Architecture of STM32F103ZET6 73
3.2.1 System Architecture of STM32F1 Series Products 74
3.2.2 Internal Architecture of STM32F103ZET6 76
3.3 Memory Mapping of STM32F103ZET6 79
3.3.1 Address Range of Built-in Peripherals of STM32F103ZET6 81
3.3.2 Embedded SRAM 82
3.3.3 Embedded Flash 83
3.4 Clock Structure of STM32F103ZET6 84
3.5 Pins of STM32F103VET6 87
3.6 Minimum System Design of STM32F103VET6 92
Chapter 4 Setting Up the Embedded Development Environment 95
4.1 Installation and Configuration of Keil MDK5 95
4.1.1 Introduction to Keil MDK 95
4.1.2 Downloading Keil MDK 98
4.1.3 Installing Keil MDK 99
4.1.4 Installing Library Files 101
4.2 Creating New Projects in Keil MDK 102
4.2.1 Creating Folders 102
4.2.2 Opening Keil μVision 102
4.2.3 Creating New Projects 103
4.3 CMSIS Software Interface Standard for Cortex-M3 Microcontrollers 104
4.3.1 Introduction to CMSIS 105
4.3.2 Standard Peripheral Library for STM32F10x 106
4.4 Selection of STM32F103 Development Boards 110
4.5 Selection of STM32 Emulators 110
Chapter 5 STM32 Interrupts 113
5.1 Overview of Interrupts 113
5.1.1 Interrupts 114
5.1.2 Functions of Interrupts 114
5.1.3 Interrupt Sources and Interrupt Masking 115
5.1.4 Interrupt Handling Process 116
5.1.5 Interrupt Priority and Nested Interrupts 118
5.2 STM32F1 Interrupt System 119
5.2.1 Nested Vector Interrupt Controller of STM32F1 119
5.2.2 Interrupt Priority of STM32F1 120
5.2.3 Interrupt Vector Table of STM32F1 121
5.2.4 Interrupt Service Functions of STM32F1 124
5.3 External Interrupt/Event Controller EXTI of STM32F1 125
5.3.1 Internal Structure of EXTI of STM32F1 125
5.3.2 Working Principle of EXTI of STM32F1 128
5.3.3 Main Features of EXTI of STM32F1 129
5.4 Library Functions of STM32F1 Interrupt System 129
5.4.1 NVIC Related Library Functions of STM32F1 130
5.4.2 EXTI Related Library Functions of STM32F1 133
5.4.3 GPIO Pin Mapping Library Functions of EXTI Interrupt Lines of STM32F1 137
5.5 External Interrupt Design Process of STM32F1 137
5.5.1 NVIC Setup 137
5.5.2 Interrupt Port Configuration 138
5.5.3 Interrupt Handling 139
5.6 External Interrupt Design Examples of STM32F1 140
5.6.1 Hardware Design of External Interrupts of STM32F1 140
5.6.2 Software Design of External Interrupts of STM32F1 140
Chapter 6 STM32 GPIO 146
6.1 Overview of STM32 General-Purpose Input/Output Interfaces 146
6.1.1 Input Channels 148
6.1.2 Output Channels 149
6.2 GPIO Functions of STM32 150
6.2.1 General I/O Functions 150
6.2.2 Individual Bit Set or Clear 150
6.2.3 External Interrupt/Wakeup Line 150
6.2.4 Multiplexing Functions 151
6.2.5 Software Remapping I/O Multiplexing Functions 151
6.2.6 GPIO Lock Mechanism 151
6.2.7 Input Configuration 151
6.2.8 Output Configuration 152
6.2.9 Multiplexing Function Configuration 153
6.2.10 Analog Input Configuration 153
6.2.11 GPIO Operations of STM32 154
6.2.12 External Interrupt Mapping and Event Output 156
6.2.13 Main Features of GPIO 156
6.3 Common Library Functions of STM32 GPIO 157
6.4 GPIO Usage Process of STM32 165
6.4.1 General GPIO Configuration 165
6.4.2 I/O Multiplexing Function AFIO Configuration 165
6.5 GPIO Output Application Examples of STM32 165
6.5.1 Hardware Design of GPIO Output Applications of STM32 165
6.5.2 Software Design of GPIO Output Applications of STM32 166
6.6 GPIO Input Application Examples of STM32 172
6.6.1 Hardware Design of GPIO Input Applications of STM32 172
6.6.2 Software Design of GPIO Input Applications of STM32 172
Chapter 7 STM32 Timers 176
7.1 Overview of STM32 Timers 176
7.2 Basic Timers of STM32 179
7.2.1 Introduction to Basic Timers 179
7.2.2 Functions of Basic Timers 180
7.2.3 Registers of STM32 Basic Timers 182
7.3 General Timers of STM32 183
7.3.1 Introduction to General Timers 183
7.3.2 Functional Description of General Timers 183
7.3.3 Working Modes of General Timers 188
7.3.4 Registers of General Timers 192
7.4 Timer Library Functions of STM32 192
7.5 Timer Application Examples of STM32 205
7.5.1 Configuration Process of General Timers of STM32 205
7.5.2 Hardware Design of Timer Applications 207
7.5.3 Software Design of Timer Applications 207
7.6 SysTick System Tick Timer 211
7.6.1 Overview of SysTick Function 211
7.6.2 SysTick Configuration Example 213
Chapter 8 STM32 General Synchronous/Asynchronous Transceivers 215
8.1 Basics of Serial Communication 215
8.1.1 Data Format for Serial Asynchronous Communication 215
8.1.2 Data Format for Serial Synchronous Communication 216
8.2 Working Principle of USART of STM32 216
8.2.1 Introduction to USART 217
8.2.2 Main Features of USART 217
8.2.3 Functions of USART 218
8.2.4 Communication Timing of USART 221
8.2.5 Interrupts of USART 222
8.2.6 Related Registers of USART 222
8.3 Library Functions of USART of STM32 223
8.4 USART Serial Communication Application Examples of STM32 231
8.4.1 Basic Configuration Process of USART of STM32 231
8.4.2 Hardware Design of USART Serial Communication Applications 232
8.4.3 Software Design of USART Serial Communication Applications 233
Chapter 9 STM32 SPI Serial Bus 241
9.1 Working Principle of SPI Communication of STM32 241
9.1.1 Overview of SPI Serial Bus 242
9.1.2 Interconnection Methods of SPI Serial Bus 244
9.2 Working Principle of STM32F1 SPI Serial Bus 245
9.2.1 Characteristics of SPI Serial Bus 245
9.2.2 Internal Structure of SPI Serial Bus 246
9.2.3 Phase and Polarity of Clock Signal of SPI Serial Bus 248
9.2.4 Configuration of SPI of STM32 249
9.2.5 Data Sending and Receiving Process of SPI of STM32 251
9.3 Library Functions of SPI of STM32 253
9.4 Application Examples of SPI with Flash Memory Interface of STM32 256
9.4.1 Configuration Process of SPI of STM32 256
9.4.2 Hardware Design of SPI with Flash Memory Interface 257
9.4.3 Software Design of SPI with Flash Memory Interface 257
Chapter 10 STM32 I2C Serial Bus 265
10.1 Working Principle of STM32 I2C Serial Bus 265
10.1.1 Overview of STM32 I2C Serial Bus 265
10.1.2 Data Transmission of STM32 I2C Serial Bus 268
10.2 STM32 I2C Serial Bus Interface 270
10.2.1 Main Features of STM32 I2C Serial Bus 270
10.2.2 Internal Structure of STM32 I2C Serial Bus 271
10.2.3 Functional Description of STM32 I2C Serial Bus 272
10.3 Library Functions of I2C of STM32F103 273
10.4 Application Examples of I2C with EEPROM Interface of STM32 279
10.4.1 Configuration Process of I2C of STM32 279
10.4.2 Hardware Design of I2C with EEPROM Interface 280
10.4.3 Software Design of I2C with EEPROM Interface 280
Chapter 11 STM32 A/D Converters 287
11.1 Analog Input Channels 287
11.1.1 Composition of Analog Input Channels 287
11.1.2 Introduction to A/D Converters 287
11.2 Types of Analog Input Signals and Automatic Range Conversion 288
11.2.1 Types of Analog Input Signals 288
11.2.2 Automatic Range Conversion 288
11.3 ADC Module Integrated in STM32F103ZET6 289
11.3.1 Main Features of ADC of STM32 289
11.3.2 Structure of ADC Module of STM32 290
11.3.3 Functions of ADC of STM32 294
11.3.4 Application Features of ADC of STM32 298
11.4 Library Functions of ADC of STM32 302
11.5 Application Examples of ADC of STM32 311
11.5.1 Configuration Process of ADC of STM32 311
11.5.2 Hardware Design of ADC Applications 312
11.5.3 Software Design of ADC Applications 312
Chapter 12 STM32 DMA Controllers 319
12.1 Basic Concepts of STM32 DMA 319
12.1.1 Definition of DMA 319
12.1.2 Value of DMA in Embedded Real-Time Systems 320
12.1.3 Basic Elements of DMA Transfer 321
12.1.4 DMA Transfer Process 321
12.1.5 Advantages and Applications of DMA 321
12.2 Structure and Main Features of STM32 DMA 322
12.3 Functional Description of STM32 DMA 324
12.3.1 DMA Processing 324
12.3.2 Arbiter 324
12.3.3 DMA Channels 324
12.3.4 DMA Interrupts 326
12.4 Library Functions of STM32 DMA 326
12.5 Application Examples of STM32 DMA 333
12.5.1 Configuration Process of DMA of STM32 333
12.5.2 Hardware Design of DMA Applications 334
12.5.3 Software Design of DMA Applications 334
References 340
Exciting Sample Chapters
Purchase Link
Lucky Draw