How to get started with microcontrollers/embedded systems
[Copy link]
1. Understanding of MCU
A single-chip microcomputer is a control chip of an integrated circuit. Most of the household appliances we are familiar with, such as the timing control and drum operation of washing machines, the insulation function and beeping reminder of rice cookers, refrigerators, air conditioners, etc., are controlled by single-chip microcomputers according to program operation. Of course, the uses of single-chip microcomputers are not limited to these, but also include intelligent instruments, industrial control, automotive electronics, aerospace and other fields.
2. Employment and competition
At present, single-chip microcomputers still have a place in the employment field of most electronic communication majors. After all, single-chip microcomputers are powerful, widely used, and related information is mature. The employment threshold is not difficult for students with basic practical experience.
Among the beginners of single-chip microcomputers, college students account for the majority. At this time, they have mastered certain common sense and mathematical foundations, and have ample time and support from school laboratory platforms. In addition to doing some electronic DIY, most students learn single-chip microcomputers mainly to prepare for technical competitions such as the National Electronic Design Competition. I think that students who can make physical objects related to single-chip microcomputers must have had certain competition experience.
Microcontrollers play an important role in both employment and competition.
3. Difficulty
The difficulty of single-chip microcomputer lies in the abstract and complex relationship between program and hardware. Many beginners find it difficult to learn not because they have no foundation in digital and analog electronics, but because the execution of program and the processing of hardware are very brain-burning. Even if some students have mastered the basic computer operation of C language, they are still unable to analyze the execution principle of single-chip microcomputer. Many times they are helpless from getting started to giving up. Some self-taught learners also take many detours because there is no one to guide them.
To address these issues, this tutorial will provide a detailed explanation of the execution relationship between hardware and program.
4. MCU selection
Regarding the selection of MCU model, we use STC89C52RC of 51 MCU series as the template for teaching, and the crystal oscillator is 11.0592M.
5. Advice for college students
If you are still a college student at this time, and have a certain understanding of MCU and its importance, then it is highly recommended that you make good use of the loose time and laboratory resources in school. For beginners, no matter how good the tutorials and resources are, it takes 3 months of polishing to become familiar with the system structure. The most difficult thing for beginners is to program by yourself, which requires a long time of training, and the code you write yourself is often full of loopholes. Even if you can vaguely understand other people's programs, it is definitely a blank when you build the system structure in your mind.
Although we don't need to force ourselves to work hard during college, we must be exposed to and understand this field for a long time. All the difficulties are just that we don't spend enough time and our understanding of the code is not deep enough.
I studied microcontrollers in my freshman year, and played with embedded systems for a few years in my undergraduate studies. I worked on smart homes, smart cars, oscilloscopes, switching power supplies, etc. I stopped working after I started working (in the chip industry), but the experience I accumulated during this period can benefit my entire career.
Microcontrollers are relatively easier to understand the underlying things of computers, as well as hardware and so on. People who have played with microcontrollers have a better understanding of the upstream and downstream of the IT industry than those who have graduated from general software majors. The following is an introduction to the learning route.
The greatest pleasure of learning embedded systems is that I have built something and I know every detail inside it, and I feel completely clear about it. It is not like writing application software or doing web development, where the underlying system is all covered for you and you are just a user.
But if you pursue every detail too much, you will die miserably. Because a lot of the work you do has no value, and others do it better and more robustly than you.
So it is important to understand your learning goals. Don't pursue understanding every detail too much. It is important to learn to stand on the shoulders of giants.
1. Software Application
0. To learn single-chip microcomputers, you must first understand that a single-chip microcomputer can't do anything. The purpose of learning single-chip microcomputers is to learn how to use single-chip microcomputers to drive external devices, such as digital tubes, motors, LCD screens, etc. This requires the cooperation of peripheral circuits. Therefore, learning single-chip microcomputers at this level can be equivalent to learning how to use the development board of single-chip microcomputers (the development board is a circuit board composed of a single-chip microcomputer and its peripheral circuits. If you don't understand it, you can buy it on Taobao). In other words, you can learn how to write software that runs on the single-chip microcomputer.
1. At the beginning, you can just learn 51 single-chip microcomputers. Watch Guo Tianxiang's video "Learn Single-chip Microcomputer in Ten Days". There are a lot of videos on the Internet. Just follow them and learn. It doesn't matter if you don't know C language. You will learn it after you finish learning it. Be careful not to buy development boards with exactly the same pins as those in Guo Tianxiang's video. Create some difficulties for yourself so that you can learn more solidly. The main thing is to understand how to drive peripherals and how to configure the function registers of the single-chip microcomputer, how to use interrupts, and how to schedule tasks and allocate time slices in while (1).
2. Then learn STM32, a higher-end single-chip microcomputer. There is a good tutorial by Zhengdian Atom. If you follow it, your software level can be greatly improved. You can think of a project to do, such as smart home or smart car. It is very simple. After you finish it, you will feel that all single-chip microcomputers are similar, and the only difference is power consumption and performance. For advanced, you can buy some circuit modules to learn, such as LCD screen, stepper motor, infrared, voice, Ethernet, etc. In theory, learning the use of any single-chip microcomputer product, as long as it can light up the running light (using GPIO), is half a step in the door. The rest is to learn how to use the registers of those peripherals. Common ones are UART, i2c, spi, Adc/dac, Dma, usb, Ethernet, external bus, etc. Among them, uart is the serial port that must be mastered, and you can learn anything else temporarily. Of course, it would be great if you can master them allヾ^_^
3. When learning ucos-ii, don't worry about how it is implemented. First, learn how to use it and write tasks. Finally, learn how to implement this system. Read the author's classic works and benefit from it for life.
4. When learning embedded linux, there are two types of linux development. One is to develop user programs, such as Tencent QQ, which is similar to writing programs under windows. You can also use c++ or java. The other is to develop kernel drivers, which can only be written in c, such as usb drivers or camera drivers. Just learn them separately.
Linux development and microcontroller development are completely different things. Microcontrollers use low-level protocols, such as i2c, uart, spi. If there is no protocol, you can use gpio to make one yourself. However, most of the development under linux uses general network protocols, which are built on a bunch of software libraries, such as tcpip, ssh, telnet, ftp, http, etc. Learning linux application development is basically pure software, which can be run under any linux, but microcontrollers are not, and are tightly coupled with hardware.
If you just want to play around with application development in Linux, you can get a Raspberry Pi, learn shell, python, C development under Linux, makefile, etc. If you don't want to spend money, just use a virtual machine to install Ubuntu. If you want to learn kernel driver development and want to understand uboot and the kernel bottom layer, you can buy a Linux development board, which costs about 500 yuan. You can use Linux to write a driver for a running light to get started. The kernel driver is tightly coupled with the hardware, and colleagues also need to understand the kernel scheduling mechanism, which is a bit difficult. At this time, you have actually entered the room and should be able to find the way back.
5. C language! C language! C language! It's really important. Learn it well, it's enough for you to eat for half a lifetime. Of course, it would be better if you can learn a scripting language, such as Python. It is the only choice in the era of artificial intelligence. Learning C language basically takes half a day to get started with Python. Advice: Beginners should not be entangled in whether it is better to learn assembly language or C language for microcontrollers. Each has its own uses. Now you can use Python to develop microcontrollers.
https://github.com/wfwgwge/pnnvbjpzzl/discussions/304?C0s2S
https://github.com/wfwgwge/pnnvbjpzzl/discussions/304?mywuu
https://github.com/wfwgwge/pnnvbjpzzl/discussions/304? 24240
https://github.com/wfwgwge/pnnvbjpzzl/discussions/305
https://github.com/wfwgwge/pnnvbjpzzl/discussions/305?fnNd9
https://github.com/wfwgwge/pnnvbjpzzl/discussions/305?njtzz
https://github.com/wfwgwge/pnnvbjpzzl/discussions/305?95719
https://github.com/wfwgwge/pnnvbjpzzl/discussions/306
https://github.com/wfwgwge/pnnvbjpzzl/discussions/306?R9TPB
https://github.com/wfwgwge/pnnvbjpzzl/discussions/306?ljhtf
https ://github.com/wfwgwge/pnnvbjpzzl/discussions/306?19759
https://github.com/wfwgwge/pnnvbjpzzl/discussions/307
https://github.com/wfwgwge/pnnvbjpzzl/discussions/307?j1z7p
https: //github.com/wfwgwge/pnnvbjpzzl/discussions/307?vjztd
https://github.com/wfwgwge/pnnvbjpzzl/discussions/307?75911
https://github.com/wfwgwge/pnnvbjpzzl/discussions/308
https://github.com/wfwgwge/pnnvbjpzzl/discussions/308?O6a86
https ://github.com/wfwgwge/pnnvbjpzzl/discussions/308?eywoc
https://github.com/wfwgwge/pnnvbjpzzl/discussions/308?06802
https://github.com/wfwgwge/pnnvbjpzzl/discussions/309
https: //github.com/wfwgwge/pnnvbjpzzl/discussions/309?55D59
https://github.com/wfwgwge/pnnvbjpzzl/discussions/309?jlrfx
https://github.com/wfwgwge/pnnvbjpzzl/discussions/309?99579
https://github.com/wfwgwge/pnnvbjpzzl/discussions/310
https ://github.com/wfwgwge/pnnvbjpzzl/discussions/310?zz71x
https://github.com/wfwgwge/pnnvbjpzzl/discussions/310?fpthd
https://github.com/wfwgwge/pnnvbjpzzl/discussions/310?19997
https://github.com/wfwgwge/pnnvbjpzzl/discussions/311
https://github.com/wfwgwge/pnnvbjpzzl/discussions/311?vVd3b
https://github.com/wfwgwge/pnnvbjpzzl/discussions/311?thlxv
https://github.com/wfwgwge/pnnvbjpzzl/discussions/311? 73795Language
is just a tool, just like you can use a hoe or a tractor to plow the land. Tractors are more efficient, but you still need a hoe to get to the corners. They each have their own uses. As long as the land can be plowed well, it depends on your mood to use which tool. Learning C language well is a link between the previous and the next. It will be easy to learn assembly language and high-level language in the future. When learning assembly language, it is best to learn computer principles and master the basic knowledge of address decoding, binary, CPU structure, etc.
6. Advanced: LWip (embedded lightweight TCPIP protocol stack implementation), ucgui embedded graphical interface implementation, QT (graphical interface design under Linux), javascript/html/css (web interface design), php dynamic website construction , sql database implementation, etc., the road of software is endless. The content listed in this article is the direction of your efforts when you really have nothing to learn. . .
2. Hardware Circuit
1. If the MCU is regarded as the CPU of the computer, the development board of the MCU is roughly equivalent to the motherboard of the computer. So how is this motherboard designed?
2. First of all, you need to have a certain basic knowledge of electronic circuits, such as digital electronics and analog electronics. You don’t need to be proficient, but you must understand the basics, such as combinational circuits, timing circuits, diodes, and commonly used classic circuits of triodes. There seems to be a series of electronic circuit books written by a Japanese. The various illustrations are easier to understand, but I forgot the name.
3. You need to understand the characteristics of basic components, such as resistors, capacitors, diodes, triodes, and 74 series chips. Understand what types and parameters there are. If you don’t know, please go to Taobao to find out. There are a lot of electronic component stores.
4. The above are all basic circuit knowledge. The development board of the MCU also needs to understand the design of the typical peripheral circuit of the MCU. Generally, there are drawings on the datasheet, and you can just connect them according to the drawings.
5. Software tools: To design a circuit board, you must first draw a circuit diagram, then design a PCB board, and finally hand it over to the factory for production (please go to Taobao). You can learn protel99, autim designer, or candence, and the difficulty increases in order. . .
6. If you are not interested in drawing a board, you can use a perforated board (please buy it from Taobao) for welding, or directly connect the wires on a breadboard. For welding, please go to Youku to watch videos to learn about it. Welding skills are very important, please pay attention to safety.
7. Advanced: high-frequency circuit design, anti-interference circuit design, extremely low-cost circuit design
8. As for the job of drawing boards and welding, I personally feel that it is difficult to make money (please don't criticize if you don't agree), because any high school student can fool people after being taught for two or three months. Of course, there are awesome people in every field, and you can make a lot of money if you are the best at drawing single boards, but it is difficult!
https://github.com/wfwgwge/pnnvbjpzzl/discussions/293?cccco
https://github.com/wfwgwge/pnnvbjpzzl/discussions/293?06684
https://github.com/wfwgwge/pnnvbjpzzl/discussions/294
https ://github.com/wfwgwge/pnnvbjpzzl/discussions/294?bfDR7
https://github.com/wfwgwge/pnnvbjpzzl/discussions/294?fbjbz
https://github.com/wfwgwge/pnnvbjpzzl/discussions/294?31977
https://github.com/wfwgwge/pnnvbjpzzl/discussions/295
https://github.com/wfwgwge/pnnvbjpzzl/discussions/295?PXZ99
https://github.com/wfwgwge/pnnvbjpzzl/discussions/295?bjjxt
https://github.com/wfwgwge/pnnvbjpzzl/discussions/295? 11933
https://github.com/wfwgwge/pnnvbjpzzl/discussions/296
https://github.com/wfwgwge/pnnvbjpzzl/discussions/296?951BF
https://github.com/wfwgwge/pnnvbjpzzl/discussions/296?ffvvb
https://github.com/wfwgwge/pnnvbjpzzl/discussions/296?75115
https://github.com/wfwgwge/pnnvbjpzzl/discussions/297
https://github.com/wfwgwge/pnnvbjpzzl/discussions/297?EI8u2
https://github.com/wfwgwge/pnnvbjpzzl/discussions/297?sywmu
https ://github.com/wfwgwge/pnnvbjpzzl/discussions/297?84484
https://github.com/wfwgwge/pnnvbjpzzl/discussions/298
https://github.com/wfwgwge/pnnvbjpzzl/discussions/298?csiGC
https: //github.com/wfwgwge/pnnvbjpzzl/discussions/298?mewwi
https://github.com/wfwgwge/pnnvbjpzzl/discussions/298?48822
https://github.com/wfwgwge/pnnvbjpzzl/discussions/299
https://github.com/wfwgwge/pnnvbjpzzl/discussions/299?jxbRP
https ://github.com/wfwgwge/pnnvbjpzzl/discussions/299?zzvjz
https://github.com/wfwgwge/pnnvbjpzzl/discussions/299?73993
https://github.com/wfwgwge/pnnvbjpzzl/discussions/300
https: //github.com/wfwgwge/pnnvbjpzzl/discussions/300?W4EQ4
https://github.com/wfwgwge/pnnvbjpzzl/discussions/300?gkoqc
https://github.com/wfwgwge/pnnvbjpzzl/discussions/300?48222
https://github.com/wfwgwge/pnnvbjpzzl/discussions/301
https ://github.com/wfwgwge/pnnvbjpzzl/discussions/301?G420Y
https://github.com/wfwgwge/pnnvbjpzzl/discussions/301?sqmgy
https://github.com/wfwgwge/pnnvbjpzzl/discussions/301?86466
https://github.com/wfwgwge/pnnvbjpzzl/discussions/302
https://github.com/wfwgwge/pnnvbjpzzl/discussions/302?vZ3nN
https://github.com/wfwgwge/pnnvbjpzzl/discussions/302?lljrb
https://github.com/wfwgwge/pnnvbjpzzl/discussions/302? 55959
https://github.com/wfwgwge/pnnvbjpzzl/discussions/303
https://github.com/wfwgwge/pnnvbjpzzl/discussions/303?9HZD5
https://github.com/wfwgwge/pnnvbjpzzl/discussions/303?lbbxh
https://github.com/wfwgwge/pnnvbjpzzl/discussions/303?93539
https://github.com/wfwgwge/pnnvbjpzzl/discussions/304
3. Chip Design
0. Wait, we were talking about how to learn MCU, why did it get to the point of learning chip design? This is because many people are fooled by others and think that after learning MCU, they should learn FPGA, or even more powerful MCU. This is basically nonsense. . . These are two completely different fields.
1. Let’s first talk about how the chip (SoC) is made. First, you need to design the circuit. Now basically digital circuits are implemented by Verilog, and analog circuits are basically AD and DA, which have not changed for ten thousand years. Therefore, a large number of people in chip design companies nowadays are digital circuit design engineers. After the design is completed, someone needs to check it for him. This is verification, to ensure that the circuit can achieve the established specifications. After the verification, the back-end will do comprehensive layout and wiring, and finally give the results to the foundry for foundry. After production, there is packaging and testing.
2. Here we will focus on digital circuit design. The so-called SOC is basically to hang the CPU and a bunch of peripherals, such as UART, SPI, Ethernet, USB, and other peripheral IPs on APB/AHB/AXI or other buses, assign addresses, and add some on-chip RAM to form a SOC. So chip design is basically to design peripherals, peripherals with various functions, which is to learn digital circuit design and Verilog language, and in-depth knowledge is state machines, low power consumption, asynchronous circuits, etc.
3. So what is FPGA? This big black block is a universal chip. You can burn the circuit written in Verilog onto FPGA, so that FPGA will have the same function as the circuit you wrote. It is mainly used for chip verification and also for hardware acceleration.
4. Regarding chip design, this is a deeper story about the chip industry, which I will write about later when I have time.
|