I learned the pointers from Hao Bin in C language, Taobao punctually clicked on the Atom board, and the MDK development environment was set up. Then I learned the video for a few days and I didn’t understand it. I always feel that there is a lot of knowledge or a course between me and stm32? I implore you guys to give me some advice (I have never studied 51 single-chip microcomputer)

Lack of understanding of the basic knowledge of MCU The specific work of the microcontroller (that is, STM32) is not clear. According to the order of the entire learning phase, the following is a more detailed interpretation to explain the problem. 1. Specific terminology For MCU, when there is no specific function, there are only specific terms, such as cross-compilation, kernel, adder/divider, coprocessor, arithmetic accelerator, instruction set, floating point operation, pipeline, Harvard structure, registers (general and peripherals), interrupts and exceptions, FLASH, RAM, Cache (cache), SDRAM (refresh time), USART (baud rate, stop bit, parity check), CAN, SPI (chip select) And I2C, etc. Some of these are basic knowledge, and some are knowledge points that need to be understood for advanced levels. The understanding of these nouns is the first threshold for beginners. If you don’t understand some specific nouns, then combine sentences It’s even more obscure and difficult to understand. Here is my learning method: when you encounter technical terms that you don’t understand, go to the Internet to find and understand, and find a notebook or computer to record it in the form of a document, review it for a period of time, it is not as good as a bad memory Written, here I recommend the , which explains the core knowledge that you need to know in the MCU learning. 2. The technical terminology of the chip workflow is not too difficult. Remember that you will not forget it, even if you forget to review it, it is easy. After passing this hurdle, the next step is to understand the chip execution process and what we have to do to make the chip Get to work. After power-on, the chip reset starts the MCU to read instructions and data from FLASH through the instruction/data bus, and cooperate with the analysis and execution. Among them, the variable data is processed through RAM and general registers (internal registers of R0~R12). According to the executed instructions, configure and operate the registers of the peripherals, so as to drive the corresponding peripherals to achieve specific functions. Cooperate with the upper combination logic, combine the peripheral functions, and perform all the requirements of specific applications. The above is the work flow of the chip, and it is developed as a single-chip microcomputer. Or, the implemented code is the program in FLASH, which is composed of the official SDK package and the peripheral driver defined by the user tailored implementation. According to the above process, it includes: initialization of the stack during the chip startup process, system related peripherals Processing (such as clock) => This part is provided by the manufacturer, we can put the file into the project, take STM32 as an example, it is the startup file startup_xxx.s and the SystemInit function of system initialization to configure the peripheral modules required by the application. If you look The online teaching videos all start directly from this step, especially the implementation of STM32 based on STM32CubeMx. It will tell you that writing this way meets the requirements. If you are not a person who is willing to delve into it, it doesn’t matter. When you delve into this thing, You will find that no one has told why you want to write this way, and the confusion will naturally come. In fact, this part is the so-called experience component of embedded. If most peripheral modules need to be clock enabled, GPIO must be configured with pin pull-up/pull-down, push-pull/open-drain, USART configuration mode, baud rate, parity, stop bit, data bit, etc. To consider the port multiplexing corresponding to GPIO, I2C must consider the master-slave mode, and determine the module clock according to the required transmission rate. In addition to the pin multiplexing and timing, SDRAM also calculates the refresh time to ensure the stability of the data. These knowledge theories The above are all accumulated in the work for a long time. After the project requirements are determined, according to the chip and device selection, the drawing and layout of the hardware PCB can be determined, and the functional requirements can also be determined. For example, if the external EPPROM is accessed, the I2C will be determined. Master mode, and according to the read and write timing of EPPROM and chip performance, considering the balance of efficiency and stability, the I2C rate can be determined. Considering the layout and other requirements, the I2C corresponding multiplexed pin can also be determined. In fact, For real projects, it is all from the requirements => project plan => software and hardware framework => software drive. The video you watch is directly learned from the software drive. If you don’t know the background, you will be confused. As for how to change your thinking, you can Refer to my previous summary. At the end, there is also my explanation about embedded entry. Listen to the sound of the heartbeat: change your mind to learn embedded-methods and summary zhuanlan.zhihu.com 3. The realization of the upper application logic and the application logic realization of the peripherals is actually the most complicated part of the project, including the interaction between the front and back end systems. , There may be RTOS application and protocol transplantation, GUI management operation, interaction with other modules such as wifi module, Bluetooth module, but this part is advanced content, when you have a certain understanding of peripheral modules, this part should also be I have my own learning method, so I won’t go into details here. This is the end of this answer. This is just a summary of my understanding of the microcontroller problem. Although the microcontroller does not need to innovate and develop unknown technologies, it involves all the realization from the bottom of the chip to the software interface, including the modern computer technology. All the essential technologies in the direction of microprocessors also require continuous learning to not be abandoned by the times. In addition, I hope you can also summarize your own methods, and go on this road as better as possible. If you have learning needs of embedded Linux, you can also read my answer.


By zhiwo

0 0 vote
Article Rating
Notify of
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
7 months ago

Through the problem description of the subject, the subject has basically been completed in the preliminary preparation stage (including C language, experiment board and compilation environment), and started to follow the teaching video of Brother Atom to start the learning path of STM32. However, according to what I have shared with other friends in the past, the subject is still missing a key step: learning and understanding of the theoretical knowledge of STM32 MCU.
For beginners, if you don’t have a solid and correct understanding of the theoretical knowledge of MCU (such as clock tree, GPIO/UART/IIC/SPI and other configuration procedures), then I personally feel that following the video learning, even if you learn it, you will know most But I don’t know why. Of course, it is not excluded that some friends can also lay a solid foundation based on the video (but I think they also interspersed basic learning and understanding in the video learning).

7 months ago


Speaking of people’s methods: First of all, you have to know the C language and basic logic operations. The while for if array is enough. Understand the data in hexadecimal and binary. Be proficient in mental arithmetic. It is best to learn about 51 single-chip microcomputer first, because it is simple and easy to get started. The program of 51 single-chip microcomputer is relatively simple. You can understand the essence through the example program. The control of the single-chip microcomputer is mainly to configure the contents of various peripheral registers. Then you will see how some conventional peripherals are implemented. If you really want to learn stm32, just to realize some simple functions, you can modify and realize it with other people’s example programs. Here are some goals for you: 1. Realize a pulse that can output a certain frequency from a pin. And the pulse frequency can be modified by pressing the button. 2. Realize a measurement of the above output pulse frequency. (Measure the period, used for low frequency. The unit time count is used for high frequency.) 3. Realize the change of control LED brightness. Can achieve relatively smooth changes. (PWM realization) 4. Realize the measurement of external input voltage and display it. 5. Serial communication can realize the analysis of modbus protocol. 6. Realize LCD LCD screen drive. It is best to use the fsmc method. The above few difficulty are not high, the example program also has reference. You can study, those example programs can achieve the goals mentioned above. After learning the above, I suggest you to look at the data of electricity and analyze how some internal peripherals are implemented. Then go to read books about operating systems. Begin to come back and do the following experiment. You will find that you can flexibly apply various algorithms in the operating system to the following goals. 7. Understand the use of DMA. Let the idle interrupt of the serial port trigger DMA transfer. Reduce the burden of the main program of the microcontroller. 8. Understand the usb HID protocol and realize a usb keyboard. 9. To control the brushless motor, it can simply change direction in 6 steps. Copy can use svpwm, foc. Refer to the official motor library of st. It’s basically enough when it’s done.

7 months ago

In view of your situation, I will analyze it from my own perspective: the C language you only learn is not the same as the C language used by the single-chip microcomputer, and there are certain differences. Because you have not learned 51 single-chip microcomputers, you may not be familiar with the register configuration, then The library functions will also be relatively ignorant. C language skills may not be solid enough, and you need to lay a solid foundation in C language. Some peripherals or some communication protocols such as serial ports, IIC, etc., need to be understood separately, and then describe it from a code perspective. It will be better. It may be difficult to understand the configuration of some clocks. First, I will look at the clock tree, and then understand how to configure the clock frequency of each part. Some peripherals such as ADCs and other peripherals do require certain pre-knowledge. To understand, at this time, refer to the previous statement, first understand it, and then try to use the code to describe it. There are still some relatively advanced points, such as network programming, file system operation, GUI, etc., learn slowly, don’t try I have almost finished watching the punctual video in one step or a few days. If I have learned RTOS, it is normal to feel at a loss. I need to learn a little assembly, and I can watch it. There are also personal suggestions for low-level things such as general-purpose registers.

7 months ago

You should not start with STM32, because STM32’s entire system architecture and development methods are more complicated than eight-bit microcontrollers, so it is not suitable for beginners. You can look at other articles I wrote. There are some questions about getting started for newcomers. Take the PIC microcontroller data sheet as an example to explain how I learned a brand-new chip. You can learn other chips based on this method. . Due to space limitations, the screenshot is only part of the content. First download its data manual from the official website, I found the Chinese version of the data manual, but most chips do not have the Chinese version of the manual. Then we found its global configuration items in the manual, which is what configuration needs to be done first to use this microcontroller. In the PIC microcontroller, the configuration word must be written first. The function of the configuration word is to configure the parameters of the single-chip microcomputer globally. Find the location of the configuration word chapter, and then carefully read the definition of the register inside. In it, you can see which functions each bit of this register represents, and then the status of these functions corresponds to 1 or 0. We Set the value of these bits according to whether you turn on or turn off certain functions, and then calculate the value of the entire register.

7 months ago

Because…punctual atom’s video is not really suitable for zero-based people. I also bought the punctual atom’s video and board in mid-November last year (2020)… Then watching their video, I was also embarrassed… …Later the teacher asked me to watch wildfires…it was just fine in an instant…but now it’s more of a mixed look at both sides. Because the wildfire is too detailed and the organization is not clear enough in some places, then cut to the punctual atom, he will give you a more overall perspective, and the feeling will be much clearer…Personal feelings, no intention to pull, just for reference

7 months ago

It is normal for Xiaobai to get started with stm32, because your knowledge structure has not been completed yet. Once you make up for this knowledge, you will have a clear understanding of the microcontroller. There is not much shortcut for novices at the beginning stage. Just keep practicing and experimenting. First know how to use it and then slowly understand the principles behind it. Don’t rush to solve problems immediately when you have questions. The more knowledge you accumulate, you will feel a sense of clarity, and these problems will be solved. If you have any advice or experience as a past person, novices should consciously build their own knowledge system. To learn stm32, you need to master three major blocks: C language, digital circuits, peripherals and communication protocols. Learn the basics of single-chip microcomputer to deal with c language. You must be proficient. You can spend your energy to master the grammar in the early stage. Practice, don’t rush into it. I rarely use pointers, and I don’t use them as a last resort. A single-chip microcomputer is a digital circuit chip. Learning the knowledge of digital electronics can help you understand the principles behind it, such as how a line of code realizes the output of the gpio port, how the chip works internally, and understanding the principles can help you learn an external interface. , Then other external interfaces also know how to learn. Compared with the original interface, there are not many interfaces. The most commonly used ones are gpio, pwm, adc, dac, serial port, i2c, spi and the like. It will not take long to learn one by one from the other.

7 months ago

It’s normal at first, and don’t try to follow the atomic tutorials. The blogs on the Internet will generally tell a little better. The same knowledge point can be fully understood through different ways of learning. Gpio, serial port, timer, interrupt knowledge and routines of these concepts repeatedly looked at. Personally, I think it’s better to go back and forth between the knowledge points on the microcontroller than step by step. When I studied before, I learned a peripheral at least three times. Write routines and blogs for the first time. Independent recurrence for the second time. The third round of summary, a deep understanding of what each step is doing and the common points of different peripheral codes. The first and second passes can be combined, but the third pass is the key. Every time I study it again, I feel that my understanding deepens. You don’t need to learn 51, but you have to understand the essence of all programs or the operation of registers, and what is the hardware composition of the microcontroller. It is no longer necessary to consolidate the C language alone. Learning the microcontroller itself can be seen as a process of truly understanding and proficiently mastering the C language. As for a course that you said is a bad feeling, it may be the scattered knowledge involved in the single-chip microcomputer, and there is no course that can be summarized. Basically, it will not be checked. There is no need to look for a book about MCU now. It is difficult to understand in a short time. The introduction is mainly based on online tutorials. It will be better if you need to study in depth. After understanding the concepts of gpio, pwm, serial port, timer, and interruption, you can build a remote control car controlled by the Bluetooth of your mobile phone. After you finish it, you are basically a beginner. If you still want to learn more, learn more open source code, even if it is the same effect, the structure, ideas, and specifications of the big guy’s code are much better.

7 months ago

Let’s talk about it in light of my own experience. To learn stm32, you must first learn the c language. If you say it is far, embedded development is basically the world of c, if you say it is closer, the functions, variables, structure definitions, shift left and right of stm32 are actually c. Since you don’t have a system, or you have studied c in depth, it is difficult for you to understand the connection between variables and functions at the beginning, and the pointer is the essence of c. Secondly, the single-chip microcomputer is a brand-new thing. If there is no basis similar to 51, at first glance, registers, timers and so on are naturally very confused. This is normal. So now you’d better learn c first, at least understand the pointer part first, and stm32, you can follow the atom or wildfire video tutorial again, the atom may be simpler, the lower part is relatively small, and most of them are Directly teach you how to use it. Of course, you can also learn c and stm32 together. This does not conflict. Moreover, this kind of driving learning is very efficient (personal feeling). When learning, you can consider modifying the official routines yourself, changing the io port, etc., so you will slowly Understand, but this may make it very difficult for you to learn. It may be a simple mistake, but it will be entangled for a long time because there is no foundation (but maybe this is the joy of learning? After a long time of confusion, I suddenly realized it). Therefore, it is best to visit Atomic forums or add related learning groups. The power of group friends is endless.

7 months ago

I suggest you look at the video of 51. I saw one of station b is okay. Programming is cool for a while. You can watch his 51 course, which is very suitable for our real zero-based ones. Just watch his video. I have some understanding of single-chip microcomputers. When looking at 32, I suggest to look at wildfire first. If wildfire can’t stand it, then look at atoms. Atomic sense is to realize the function. Wildfire should be more detailed.

7 months ago

The buddies who have experienced the same as me (but I bought the guide of Wildfire) I also skipped 51 to learn 32. Similarly, the analog, digital and electronic professional courses have not been opened yet, and the C language was learned from the online class of teacher Hao Bin at station B ( Finished learning, and I am learning his data structure). I spent a lot of ineffective time to get 32 ​​before the winter vacation. From the beginning of setting up the environment to learning 32 (using the course of the wildfire family), I feel that I lack too much basic knowledge, which leads to The learning efficiency is very low (mainly because I don’t understand, I’m not in the mood to learn). Then I skipped the class according to the senior’s suggestion (he mainly wanted me to learn the library functions). I just looked at the basic MCU and learned the library and learned to use the library. The function lights up to find some feeling. My learning route is: 1. First learn 32, and I will listen to the basics first. The focus is on tuning the library, such as building project templates, lighting up, and listening carefully. It should still be rewarding. After learning the serial port communication, I am ready to end (for the time being) I didn’t learn it) 2. In the process of learning 32, the C language has to be strengthened. I feel that I understand the functions, pointers and structures. 32 is not as good as before. 3. After learning 32, I am going to learn 51 (I want to make up Basics, wait for someone to read it after I finish learning it.) The number 4 may not have time to learn during the holidays. After the school starts, this is my experience of learning 32. Please experienced seniors, seniors, please correct me. Please give me advice.

Would love your thoughts, please comment.x