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.