[Pay tribute to the future Siege Lion Project] The second issue of targeted book "RT-Thread Device Driver Development Guide" + "GD32 MCU Principle and Firmware Library Development Guide"

Start the growth journey of the siege lion! This is a project I participated in jointly initiated by  CSDN blog expert architect Li Ken (hyperlink: http://yyds.recan-li.cn ) and  Renesas MCU  (hyperlink: Renesas Electronics Corporation) Pay tribute to the future siege lion project"   , click to view the details of the event plan  (hyperlink: https://bbs.csdn.net/topics/613916237 )!

First of all, I would like to thank Mr. Yin Wenmin from Machinery Industry Press for his strong support for this activity plan. On behalf of all the students, I would like to thank the teacher for his book sponsorship.

The following are two embedded books: "RT-Thread Device Driver Development Guide" + "GD32 MCU Principle and Firmware Library Development Guide" for detailed introduction.

Friends who are interested, welcome to find me to buy books, there are special discounts.


"RT-Thread Device Driver Development Guide"

With the rapid rise of the domestic chip industry and the Internet of Things industry in recent years, the development of the industry urgently needs more talents, especially those who master underlying technologies such as embedded operating systems. As RT-Thread is more widely used in the industry, developers have an increasingly strong demand for embedded driver development, and they are eager to have a guide that can guide them to develop drivers on RT-Thread.

In order to solve the urgent needs of developers, "RT-Thread Device Driver Development Guide" is here! Hope to help RT-Thread developers to master the knowledge points of driver development, so that developers can develop drivers more simply and conveniently, accelerate product launch, let RT-Thread empower more industries, and truly achieve "accumulating knowledge to become wise" , Huize Baichuan".

Readers

  • Those who are familiar with RT-Thread and want to develop device drivers on it

  • Embedded hardware and software engineer, electronic engineer, IoT development engineer

  • Teachers and students majoring in computer, electronics, automation, and communication in colleges and universities

  • Others interested in embedded operating systems

how to read this book

This book requires readers to have the basic knowledge of RT-Thread, so it is recommended that you study "Embedded Real-Time Operating System: RT-Thread Design and Implementation" first, and then learn the content of this book. Readers who have used the device framework on RT-Thread will have a better reading experience. Each chapter of this book has supporting sample codes. Most of these codes are only for understanding the context and reference, and cannot be actually run. It is recommended that readers compare the existing drivers in the specific bsp directory and learn in combination with this book.

The content of this book is divided into three parts: basic, advanced and advanced.

Fundamentals (Chapter 1~11)  Chapter 1 gives an overview of RT-Thread and device framework; Chapter 2~11 introduces some commonly used device driver frameworks, including PIN, I2C, SPI, etc., suitable for readers who are new to driver development.

Advanced chapters (Chapter 12-20)  introduce slightly more complex peripheral drivers, such as SDIO, touch, display, sensors, encryption and decryption devices, etc.

Advanced chapters (Chapter 21-27)  introduce some complex drivers, such as network, audio, USBD(H), CAN, etc. The development of such device drivers requires developers to be familiar with the corresponding peripheral protocols.

This book is more like a reference book. Readers don't need to read chapter by chapter from beginning to end. After reading the previous chapters and familiarizing themselves with the basic process of driver development, they can choose the corresponding chapters according to their own needs. study.

supporting software

This book is written based on RT-Thread 4.1.0. Readers also need to select the corresponding source code version when learning driver development following this book.

learn more 

  • Source of this article: IT reading list, image source: original

  • Responsible editor: Wang Ying, department leader: Lu Zhijian

  • Posted by: Yin Wenmin


"GD32 MCU Principle and Firmware Library Development Guide"


Today, MCU has been widely used in consumer, industrial, automotive, home appliances, Internet of Things and other fields, but its small size plays a huge role. According to IC Insights data, the global MCU market size is expected to exceed US$20 billion in 2022, and is expected to maintain a steady growth at a compound annual growth rate of more than 6% in the future. With the rapid development of AI, IoT, photovoltaics, new energy vehicles and other industries in the domestic MCU market, the demand and growth will lead the world. However, at present, foreign chips occupy a major position in the domestic market, and the localization of MCU needs to be further improved.

The function of the 32-bit MCU is more powerful than that of the 8-bit MCU, but the number of registers is greatly increased, and the development difficulty is greatly increased if the registers are continued to be used, which is especially unfriendly to beginners. Therefore, GD32 MCU launched a matching firmware library at the beginning of its launch. This firmware library encapsulates the operation of registers into API library functions written in C language, and the code readability is also very high. After long-term engineering practice, the author found that the firmware library of GD32 is of very high quality, and it is a set of beautifully designed API. On the one hand, more macro definitions are used, most of the API functions are short and concise, the generated code size is small, and the operation efficiency is high.

At present, there are few development materials and supporting teaching books about GD32 MCU on the Internet. Developers have to read chip user manuals, data manuals, and firmware library codes, and user manuals are described using registers, and there are no such books on the market. Books that specifically introduce the GD32 firmware library, which brings certain difficulties to the majority of beginners in learning. In order to comprehensively and systematically introduce the principle of GD32 MCU and the use of firmware library, and reduce the learning and use threshold of GD32 MCU developers, "GD32 MCU Principle and Firmware Library Development Guide" came into being.

Readers

  • Students who wish to learn MCU development.

  • Electronic engineers who want to switch to domestic MCU.

  • DIY maker using GD32 MCU.

  • Electronics hobbyist developing with MCU.

  • Companies and research institutes that hope to realize the localization of MCU.

  • People who develop products using GD32 MCU.

  • Teachers and students of colleges and universities offering relevant courses.

Features of this book

GigaDevice Senior Engineer participated in the writing, and was recommended by more than 10 experts from the industry, technology circles, and universities; interpreted the GD32 MCU from the perspectives of principle and practice, and contained a large number of codes that can be directly run; equipped with a dedicated low-cost development board, readers Free access to PCB design materials.

This book focuses on the basic principles of GD32 MCU and the firmware library. The focus is on the introduction of the firmware library API, and it does not introduce too much GD32 MCU registers. Readers who are interested in this kind of content can read the user manual of the relevant MCU.

In terms of writing, this book strives to be easy to understand, so as to lower the entry threshold for users, and make it an interesting book, a book that readers will not feel sleepy when reading.

This book provides a large number of example codes, which can be compiled and run directly, and many of them have been verified by actual projects. These codes are all open source on Github and Gitee websites, and readers can get them for free at any time.

In order to make it easier for readers to learn, the author also designed a low-cost development board, BluePill, as a supporting development board for this book, and all the example codes have been verified on this development board. The development board is provided in the form of open source. Readers can directly purchase the finished development board, or obtain PCB design materials, and then use the free proofing function of the Jialichuang website to make a development board by themselves.

Table of contents

Table of contents

sequence

praise

foreword

Chapter 1 GD32 MCU Overview 1

1.1 GigaDevice Company Overview 1

1.2 Development history and typical application of GD32 MCU 2

1.2.1 Development History of GD32 MCU 2

1.2.2 Typical applications of GD32 MCU 6

1.3 GD32 MCU Product Family Introduction 8

1.4 GD32 MCU application selection 9

1.4.1 GD32 MCU model decoding 9

1.4.2 Introduction to GD32 MCU Selection Method 11

1.5 Chapter Summary 14

Chapter 2 Quick Start and Development of GD32 MCU

Platform Construction 15

2.1 Development materials and software development platform 15

2.1.1 Introduction to Keil MDK development environment 16

2.1.2 Introduction to IAR development environment 28

2.2 Introduction of hardware development platform 34

2.2.1 BluePill development board hardware platform introduction 34

2.2.2 GD32 official development board introduction 40

2.3 Introduction to programming and debugging tools 41

2.3.1 GD-Link programming debugging 41

2.3.2 JLink programming debugging 48

2.4 GD32 MCU firmware library architecture and

Introduction to use 53

2.5 Chapter Summary 55

Chapter 3 GD32 MCU System Architecture, Core and Memory System 56

3.1 Introduction to GD32 MCU System Architecture 56

3.2 Introduction to GD32 MCU core 58

3.3 GD32 MCU NVIC and Interrupt System 61

3.3.1 Overview of NVIC 61

3.3.2 Interrupt Acknowledgment Sequence 62

3.3.3 Interrupt Configuration 62

3.4 GD32 MCU memory system 64

3.4.1 Memory Architecture 64

3.4.2 Flash Operation Instructions 69

3.5 Chapter Summary 73

Chapter 4 GD32 MCU power management system, reset and clock system 74

4.1 GD32 power management system 74

4.1.1 Introduction to PMU 74

4.1.2 PMU related in the firmware library

Main API78

4.1.3 Example: deep sleep entry and exit 79

4.1.4 Example: Standby mode entry and exit 82

4.1.5 Example: Use of low pressure detectors 83

4.2 GD32 reset and clock system 84

4.2.1 Introduction to reset and clock in GD32 85

4.2.2 RCU related in the firmware library

Main API87

4.2.3 Example: clock setting 88

4.2.4 Example: PA8 output clock 91

4.3 Chapter Summary 94

Chapter 5 GD32 MCU Basic Peripherals 95

5.1 General IO port 95

5.1.1 Introduction to GPIO of GD32 96

5.1.2 GPIO related in the firmware library

Main API97

5.1.3 Example: use GPIO to light up the water lamp 99

5.1.4 Example: Realized by query

key input 101

5.2 External interrupt105

5.2.1 Introduction to EXTI of GD32 105

5.2.2 EXTI related in the firmware library

Main API106

5.2.3 Example: Implementation by Interrupt

key input 107

5.3 Direct Memory Access 109

5.3.1 Introduction to DMA of GD32 110

5.3.2 DMA related in the firmware library

Main API110

5.3.3 Example: Using DMA in SRAM

Handling data 112

5.3.4 Example: Using DMA to move data from Flash to SRAM 116

5.3.5 Example: Using DMA operation

GPIO118

5.4 Timer 123

5.4.1 Classification and introduction of GD32 timers 124

5.4.2 Timer related in the firmware library

Main API127

5.4.3 Example: Delay using timer software

Measuring Runtime 128

5.4.4 Example: Using timer output

PWM131

5.4.5 Measurements using the timer capture function

External signal frequency 134

5.4.6 Timer cascade experiment 138

5.5 Real Time Clock 144

5.5.1 Introduction to RTC of GD32 144

5.5.2 RTC related in the firmware library

Main API145

5.5.3 Example: RTC Calendar 146

5.5.4 Example: RTC alarm clock wake-up

DeepSleep154

5.6 Watchdog Timer 158

5.6.1 Introduction to Watchdog Timer of GD32 158

5.6.2 Watchdog related in the firmware library

Main API161

5.6.3 Example: Standalone Watchdog Timer

set 162

5.6.4 Example: Windowed Watchdog Timer

set 164

5.7 Chapter Summary 167

Chapter 6 GD32 MCU Analog Peripherals 168

6.1 ADC168

6.1.1 Introduction to ADC of GD32 168

6.1.2 ADC related in the firmware library

Main API170

6.1.3 Realize ADC single-channel voltage acquisition 171

6.1.4 Example: usage of internal voltage reference 176

6.1.5 Realize ADC+DMA multi-channel

Voltage acquisition 180

6.1.6 Example: Synchronous triggering of dual ADCs 185

6.2 DAC191

6.2.1 Introduction to DAC of GD32 191

6.2.2 DAC related in the firmware library

Main API192

6.2.3 Using a DAC to output a fixed voltage 193

6.2.4 Using a DAC to implement a sine

Signal generator 194

6.3 Chapter Summary 198

Chapter 7 GD32 MCU Basic Communication

Peripherals 200

7.1 Universal Synchronous Asynchronous Transceiver 200

7.1.1 Introduction to asynchronous serial port 200

7.1.2 Introduction of USART module of GD32 202

7.1.3 USART-related in the firmware library

Main API202

7.1.4 Example: printf function redirection 204

7.1.5 Example: half-duplex serial port transceiver 206

7.1.6 Example: DMA serial port transceiver 210

7.1.7 Example: serial port receiving timeout 214

7.1.8 Example: serial port in interrupt mode

Send and receive 217

7.1.9 Example: synchronous mode of serial port 219

7.1.10 Using the serial port to implement a command

Interpreter 224

7.2 Inter-IC bus interface 230

7.2.1 Introduction to I2C interface 230

7.2.2 Main functions of GD32 I2C 231

7.2.3 Main API232 of I2C interface

7.2.4 Example: I2C master-slave communication 234

7.2.5 Example: I2C interface read and write

EEPROM247

7.3 Synchronous Serial Peripheral Interface 255

7.3.1 Introduction to SPI 255

7.3.2 Main functions of GD32 SPI 257

7.3.3 Main API257 of SPI

7.3.4 Example: SPI is performed in query mode

Full duplex communication 259

7.3.5 Example: SPI using DMA

Full duplex communication 265

7.3.6 Example: SPI half-duplex master-slave communication 273

7.3.7 Example: SPI read and write GD25 series

SPI Flash278

7.4 Chapter Summary 287

Chapter 8 GD32 MCU Advanced Communication

Peripherals 289

8.1 CAN bus 289

8.1.1 CAN bus basics 289

8.1.2 CAN interface of GD32

main function 294

8.1.3 Main API295 of CAN interface

8.1.4 Example: Sending and receiving in loopback mode 296

8.1.5 Send a data frame experiment with a specific ID 303

8.1.6 CAN data frame reception experiment 309

8.1.7 Using filters to receive specific

data frame 312

8.2 USBD317

8.2.1 Basic knowledge of USB communication 317

8.2.2 USBD device firmware library architecture 344

8.2.3 USBD device firmware library layered files and

Library function description 346

8.2.4 Example: USBD emulation keyboard

Application 351

8.2.5 Example: USBD virtual serial port

application 373

8.2.6 Example: USBD simulates U disk

Application 382

8.3 Chapter Summary 387

learn more 

  • Source of this article: IT reading list, image source: original

  • Responsible editor: Wang Ying, department leader: Lu Zhijian

  • Posted by: Yin Wenmin 

Guess you like

Origin blog.csdn.net/szullc/article/details/130501808