Welcome FPGA engineers to join the official WeChat technical group
Clickthe blue textto follow us at FPGA Home – the best and largest pure FPGA engineer community in China
1. Getting Started Summary
1.1 Why spend time on hesitation?
Whenever we are about to start (ARM is the same, DSP too), we always have many questions and concerns. We want to know what the future of learning STM32 looks like? What basics are needed? Is it difficult? Is it suitable for me? But when can we start learning STM32 with excitement and urgency? Days are passing by! Have you started taking action? Without action, thinking will never lead to a start! Use this time to read books instead; the effect will be a thousand times better.
You may have come from the 51 microcontroller, think back to how we started learning microcontrollers? In fact, we always read books (theory) first, then play with boards (practice). Strictly speaking, it should be mimicking experiments. Only after familiarizing ourselves can we write program codes to achieve certain functions. Therefore, if you are consulting STM32; if you are excited about STM32; if you want to get started with STM32; then, from now on, do not hesitate, do not try to understand the future of STM32 in detail. Make a decision that may affect your life! No need for consulting, no need for excitement, start reading books (documents) now!! Everyone has walked this path.
1.2 Planning, Patience, and Speed in Reading Material
The so-called “material” here includes STM32 books and documents. Because STM32 has a characteristic that many datasheets are in Chinese, some students do not buy books and directly read the STM32 user manual, which is also okay. But whether reading books or documents, we need a plan. It’s not about reading 3 pages today and 5 pages tomorrow. If you take two months to read a book, you are still dragging your feet. Remember, you are not learning in solitude, you are learning STM32!
Reading books or documents is not for passing time. Fight for it, set a bottom line for yourself: roughly go through a certain amount in two weeks! Do not expect to understand everything; in fact, it is impossible to understand everything. But we must understand the basic knowledge and have an impression of difficult knowledge, so that when we encounter problems in the future, we will feel familiar and know where to find answers online with questions – efficiency is highest when we carry questions.
Have you gone through the knowledge of STM32 after two weeks? Haven’t finished reading? Then you should consider whether you have done your best during these days. Do you really want to learn STM32? Or are you just following the trend because STM32 is popular? Are you thinking of giving up when you encounter unsolvable problems? Now is the time for your second decision, please decide whether to continue studying STM32. If it was an impulsive decision to follow the trend, please give up immediately – you have already wasted two weeks, do you want to waste another 14 days? If you want to endure hardships to achieve greatness, OK, please continue to read 🙂
1.3 Essential Development Boards for Learning STM32
After understanding some theoretical knowledge, you now have two paths in front of you:
First, design your own PCB, solder, and debug.
Second, purchase a cost-effective development board.
The author has designed PCBs a few times before, and at that time, all expenses could be reimbursed in the lab, so I made a PCB myself. I recommend students who can get reimbursements to design a board for learning. After all, designing a 2-layer PCB is not very difficult. Students who cannot get reimbursements can choose to purchase a development board for learning.
In short, the development board you choose must be the most cost-effective and affordable, not the most expensive. In fact, most students purchase development boards for learning, not for project development. Therefore, being able to get started with STM32 has already achieved the goal.
1.4 Familiarize Yourself with the Development Board and Try to Write Programs
At this point, you can no longer stay in theory. Your current mood should be: seeing the development board immediately brings an indescribable excitement! However, haste makes waste! Please patiently browse through the manufacturer’s accompanying development board manual to familiarize yourself with the development board you purchased. Follow the manual to perform all relevant tests and operations on the development board, and you will find that developing STM32 is so simple! Now let’s start the journey of STM32 development!
For how to truly get started with STM32, please refer to the following “Discussion on Getting Started with STM32”.
2. Discussion on Getting Started with STM32
2.1 What should I do when I get the development board?
There is a common phenomenon among domestic users: users do not know how to start after getting the development board. Due to a lack of their own ideas, being a beginner, and having no good breakthrough point, after buying the development board, they turn it on, look at the touchscreen, marveling at the “beautiful” screen display, and then become confused. The development board will not tell you how to use it. The CD that comes with the development board? It contains a pile of materials – which one should I read first? Which one should I read later? In short, how do I start learning STM32?
From the moment you get the development board, you need to understand how to install J-Link, MDK (Keil) debugging software, and move onto UCOS porting on STM32. With dedicated tutorials, you will avoid many detours in the process of learning STM32 and improve learning efficiency.
2.2 How should I arrange my time?
Before doing anything, I am accustomed to writing a plan – perhaps it is a habit formed from writing daily, weekly, and monthly plans and summaries when I was in the company. Just as mentioned in the previous section: we want to get started with STM32 within a month! We begin to consider how to better utilize this month.
I recall the scene on my first day at the company. My work mentor asked me to first get a PC, install the necessary software, and then told me what tasks I had for the next month. At that time, I was very dismissive because I had just participated in the company training and thought I knew everything, but I failed. The reason: blindly proceeding with projects without a plan.
Days without a plan can be miserable. It’s like waking up every morning, opening your eyes, and not knowing what you have to do today. Without further ado, let’s talk about planning and time arrangement.
I believe that learning STM32 is essentially a project process. To carry out a project, we must have project progress documentation, at least we need to estimate the time required for the project. Although it may not be very formal, I suggest that everyone at least give themselves a timetable: tell yourself that from date x month y in 2012 to date m month n in 2012, you must be able to develop an independent project. For example, set it for 30 days, dividing this time into three phases:
Phase One: Find the Feel – When it comes to STM32, immediately think about how to debug.
Phase Two: Modify Examples – Modify examples according to your wishes to gain a sense of achievement.
Phase Three: Take Initiative – Find a small project for yourself and implement it.
After setting a goal for each phase, further refine that goal into daily tasks, writing out the tasks to be completed each day. Note that daily tasks should not be too many; otherwise, if the time is too tight and you cannot complete the tasks of the day, it will lead to a vicious cycle, causing subsequent tasks to also be uncompleted. Ultimately leading to the failure of the entire plan.
Daily tasks need to be defined according to your specific situation. If you have ample time, you can arrange more tasks. If you only have 2 hours each day, remember, it is better to arrange fewer tasks than to pursue speeding up the project progress. Of course, once you have things in mind, you will naturally become busy every day! Your learning life will become more fulfilling!
2.3 What to do when encountering problems?
Learning inevitably encounters problems. During company training, students were told: difficulties are opportunities.
So I hope everyone faces problems calmly and does not avoid them. A small number of students, when encountering problems, always think: can I avoid them and take another path? For example, if a certain program’s syntax is not well understood, they want to use another expression method to replace it, or simply comment it out. – This is very dangerous. Because if you let a problem go now, it may mean that you will never have the opportunity to encounter this problem again in your life. Thus, your skills cannot reach the highest level. We are here to learn, to put it bluntly, our current efforts are to seek better returns in the future.
In addition, when encountering problems, do not rush to seek help everywhere.
Reasons:
1. This problem may be your doubt, but it is not specific; you cannot express it in the best language for others to accept, understand, and answer it. Many netizens will not answer vague questions. For example, how to port Linux? This question, if explained in detail, would require half a book – no one is willing to spend two or three hours telling you how to port it. So at this time, what you should do is first check the information and try to solve it yourself. When you encounter a specific step that you really can’t figure out, such as the file mount print getting stuck during the Linux porting process. This phenomenon may be easily clarified by someone experienced with just a word. And because you have a prior research foundation, you will know where the problem lies as soon as you hear it. This way, learning efficiency is highest.
2. CPUs are interconnected; most students have learned about microcontrollers and have a certain foundation. If you encounter a problem, try to solve it yourself; you will feel a great sense of achievement!! Because this is the result of your independent thinking!! Of course, you should write a summary document and keep it in your PC for reference. You can also post the summary document on forums; such original documents have the highest response rate. Gradually, you will gain visibility in this field. – This is definitely a wealth.
Of course, I am not saying that everyone should not use other ways to discuss problems. On the contrary, I encourage everyone to speak up and discuss. Just now, I was talking about the matter; it is also a little experience of mine. After experiencing it, I found what is more efficient.
3. Steps to Learn STM32
In Chapter 2, we have discussed that learning requires planning. So in this chapter, we will elaborate on this plan – for reference only.
3.1 About Learning STM32 Documents
In this tutorial, we assume that everyone has a certain understanding of STM32 books or documents. If not, please read the STM32 documents immediately to obtain the most basic knowledge points.
Learning STM32 is very different from learning ARM9. Learning ARM9 generally requires purchasing books. For example, Samsung’s S3C2440, the official documents are all in English, and most engineers can only read domestically published books. Students with good English should not think they are great and can only read English documents. After all, you are Chinese; what you are most familiar with and understand best is still Chinese. The speed of reading English is still slower than reading Chinese; we want the shortest time, not to pursue memorizing all details in a short time. Of course, if it is a paper, it is advisable to read the original English version.
When STM32 processors entered the domestic market, ST’s official (or third-party) promotion work was very good. They translated a large number of English documents to cater to the thinking of many domestic engineers. Therefore, now most STM32F103xxx user datasheets have Chinese versions. Therefore, there is no need to purchase books; you can just read the electronic files. Of course, friends with strong economic conditions can purchase the books~
When learning, focus on two important documents: “STM32F103xxx Reference Manual” and “STM32 Firmware Library User Manual.” All official Chinese and English documents from ST can be downloaded from ST’s website in mainland China:
http://www.stmicroelectronics.com.cn/stonline/mcu/MCU_Pages.htm
This website is for students with ample time and energy; it is recommended to download the documents you need to refer to for more information. When reading the “STM32F103xxx Reference Manual,” be sure to note that you do not need to read everything – there is no time for that. It is recommended to read selectively, but the first few chapters must be read. Storage and bus architecture, power control, backup registers, reset and clock control, general and multiplexing function I/O, interrupts and timers, etc., must be read thoroughly. The later chapters describe specific functional module designs. If we use a certain module, we can read that module. For example, when using AD, we need to read Chapter 10 ADC. No other examples. I believe every beginner has their own research direction and judgment.
Reading the “STM32 Firmware Library User Manual” is mainly to simplify programming. STM32 provides us with a very good firmware function library, we just need to call it. Of course, we can also choose not to touch these firmware libraries – there is some truth that using them can reduce code efficiency. Many netizens have also written code without using the firmware library functions. How to choose depends on your choice. Here I mainly emphasize that when reading the “STM32 Firmware Library User Manual,” the first few chapters must also be read. For example, the naming rules and coding rules in the document and library specifications in Chapter 1 are all important to note. Chapter 2 is the most critical; I hope everyone reads it thoroughly. Chapter 2 describes the architecture of the firmware library, how we use the firmware library, etc. With the foundation of Chapter 2, we can write our own code using the firmware library. After Chapter 4, you can read according to everyone’s needs. In fact, the subsequent chapters describe what functions each module has and how to use each function.
Regarding the later chapters, it is recommended to be familiar with GPIO library functions, interrupt library functions, reset and clock setting library functions, as they will be frequently used.
The two documents mentioned above are already enough for you to read, haha. I hope you can gain a lot of basic knowledge about STM32 from them.
3.2 30-Day Plan to Get Started with STM32
(1) The so-called “getting started” here refers to being able to understand and master some commonly used STM32 peripherals. To truly master a processor, 30 days cannot explain much. It can only be said that you have gotten started. But this is enough for us beginners.
(2) The so-called “30 days” varies according to each person’s time arrangement.
If you have ample time to learn every day, you can set a goal to quickly be able to independently conduct simple STM32 development. If you only have spare time to learn STM32 every day, it is advisable to arrange time according to your specific situation. After all, if the planned time is too tight, it will lead to poor results, only entering a vicious cycle, which we want to avoid.
However, it is advisable, regardless of whether you have ample time or not, to make a plan for yourself!
Here I list a thought process for reference:
Step 1: After installing the STM32 learning software, such as J-Link, Keil for ARM (MDK), ISP (if you need to download from the serial port). The detailed steps for installing these software can be referenced in our corresponding tutorials.
Step 2: Choose some example HEX files, such as the LED light example HEX file, download it to the STM32 development board, and observe the LED light’s flashing situation. This part of the operation can be referenced in our corresponding tutorials.
In fact, the above two steps are to familiarize yourself with the software tools you will use. This is still in the phase of finding the feel. We haven’t started learning STM32 yet!
Step 3: Prepare several commonly used documents, such as “STM32 User Manual,” “STM32 Firmware Library User Manual,” etc., for reference in daily use. These documents can all be found in the chip manual directory on the CD.
Step 4: Start looking at the example codes, see how the examples are written, and whether you can modify the examples to achieve the desired effect? The CD that comes with the Chipda STM32 development board provides a wealth of example codes for reference. You will definitely be able to modify more exciting examples!
Step 5: Would you like to try UCOS-II porting?
Congratulations, at this point, you can freely conduct independent development. The last step is to give yourself a goal (project) and implement it!
Again, the above is just a thought process for learning STM32, for everyone’s reference. Below are the key steps mentioned earlier; I hope everyone can get started quickly. For the subsequent programming of each module, please refer to our Chipda STM32 entry series tutorials.
3.2.1 Step 1: Familiarize Yourself with Debugging Software
For beginners, we need to install at least two software: J-Link driver software and MDK (formerly Keil) software. These two pieces of software are, in the words of “Rural Love,” “a must!”
How can you verify that you are already familiar with the operation of the debugging software? Very simple, the STM32 development board CD contains many HEX format files; you can choose some HEX files to observe the running results.
For example, download the LED light example HEX file to the Chipda STM32 development board and observe the LED light’s flashing situation. If the light is flashing, it indicates that you have successfully written the HEX file to the flash memory.
The goal of this step: to familiarize yourself with the debugging software, such that if there are problems in writing HEX, you can simply identify the problem and solve it independently.
3.2.2 Step 2: GPIO Programming
This is the first time you are exposed to programming with the firmware library, and you must grit your teeth and understand the firmware library. I suggest everyone try to use the firmware library instead of avoiding it and writing code themselves – this can only happen during learning. In actual projects, there are hundreds or thousands of lines of code; how can you write each one by yourself? Calling functions from the firmware library to complete it is the way to go.
GPIO programming is actually very simple:
1. Set the GPIO pin to input or output mode. When we are writing code for lighting, we generally set it to push-pull output mode.
2. Operate the registers, set 1 or clear operations in the registers – this step has already been provided by the firmware library with dedicated GPIO_SetBits and GPIO_ResetBits functions, we just need to call them to set and clear the IO port.
3. Implement various patterns of LED flashing to familiarize yourself with the GPIO programming process. However, when calling the firmware library, we also need to pay attention to GPIO structure declarations, structure member initialization, system clock configuration, and other considerations. The goal of this step: to familiarize yourself with the debugging software, such that if there are problems in writing HEX, you can simply identify the problem and solve it independently.
3.2.3 Start a New In-Depth Study of STM32
After familiarizing yourself with the debugging software and GPIO programming, I believe you have a certain understanding of STM32. At least you know how to use the STM32 firmware library to write code. OK, now we will start a new in-depth study of STM32. In this stage, you will encounter serial port programming, TFT LCD screen driver programming, timer programming, serial peripheral interface SPI programming, memory programming, SD card and file system porting, USB reading and writing, UCOS porting, etc. If you have the energy, you can also study other peripherals.
Due to space and the theme of this tutorial, I will not elaborate on how to program each module here. Please refer to the STM32 entry series tutorials. Finally, I wish everyone to become an STM32 expert as soon as possible!

Welcome communication engineers and FPGA engineers to follow our public account

The Largest FPGA WeChat Technical Group in the Country
Welcome everyone to join the national FPGA WeChat technical group, which has tens of thousands of engineers, a group of engineers who love technology, where FPGA engineers help each other, share knowledge, and have a strong technical atmosphere! Hurry up and invite your friends to join! !
Press and hold to join the FPGA national technical group
FPGA Home Component City
Advantageous component services, please scan the code to contact the group owner: Jin Juan Email: [email protected] Welcome to recommend to procurement
ACTEL, AD part of the advantageous ordering (operating the full series):
XILINX, ALTERA advantage stock or ordering (operating the full series):
(The above components are part of the models; for more models, please consult the group owner Jin Juan)
Service concept: FPGA Home component self-operated city aims to facilitate engineers in quickly and conveniently purchasing components. After years of dedicated service, our customer service is spread across large listed companies, military research units, and small and medium-sized enterprises. Our greatest advantage is emphasizing the service-first concept and achieving fast delivery at favorable prices!
Directly Operated Brands: Xilinx, ALTERA, ADI, TI, NXP, ST, E2V, Micron, and more than a hundred component brands, especially good at handling components under the US embargo against China. We welcome engineer friends to recommend us to procurement or consult us personally! We will continue to provide the best service in the industry!
Official thanks to the FPGA technical group brands: Xilinx, Intel (Altera), Microsemi (Actel), Lattice, Vantis, Quicklogic, Lucent, etc.