Embedded in the pit for many years! Linux is not that difficult, and the microcontroller is not easy!

I often think that the rapid development and change of modern society has surpassed many people's cognition. Fatty Luo said that he has to pay a cognitive tax if he can't keep up with the times , which makes sense. The semiconductor and IT industries are again the center of the vortex, and their development has accelerated. In fact, think about innovations in other industries (Meituan Waimai, Didi Taxi, WeChat Social, Taobao Jingdong e-commerce, and the latest new retail vending machines, self-driving cars, etc. ) In essence, they are all driven by innovation in the semiconductor industry. They must rely on chips, supporting software resources and development talents before anyone can innovate in these industries.

Having been in the pit of embedded development for many years, facing the rapid development and changes of chips and related software development technologies, I often think about the internal driving force and external rationality of these developments and changes. These developments and changes will affect us. What kind of enlightenment and guidance, and where should you go when you are in the center of the vortex, can you ensure that you are not washed away by the torrent of history and that you can continue to enhance your value.

Single chip microcomputer

The Chinese name of the single chip microcomputer is "Single Chip Microomputer" in English. Many people may be surprised that they usually say MCU (Micro Control Unit)?

In fact, MCU should be accurately translated as microcontroller. Now many Chinese books use this term, instead of single-chip microcomputer. Because the term single-chip microcomputer is a concept many years ago, in that era, the semiconductor technology was still in its infancy and its integration capabilities were very poor. It was often a CPU chip, SRAM a chip, and a Flash chip. If interrupts were needed, there had to be a special process. Interrupted chips, so a complete and usable computer system is composed of many chips on one PCB.

What about the single chip microcomputer? It is to integrate the CPU, SRAM, Flash and other required modules on a chip (Chip) to realize a microcomputer system on a chip, so it is called Single Chip Microcomputer, which is a single chip microcomputer.

In fact, from this perspective, the term single-chip microcomputer is meaningless now , because the semiconductor technology is already very powerful now. Now all you buy are "microcontrollers", and there is no such thing as a separate so-called "multi-chip computer". ". Moreover, modern single-chip microcomputers not only integrate indispensable components of microcomputers such as CPU, SRAM, Flash, etc., but also integrate many internal peripherals, such as Nand controller, LCD controller, serial communication, timer, RTC, etc., so now The microcontroller should actually be called SoC (System on Chip).

English is very accurate. There are several words here that you can understand their respective meanings: microcomputer, computer, system, microcontroller. If they are not strictly distinguished, these words can be interchanged and used in many cases, but strictly speaking, they actually refer to differently. For example, computer refers to computers, which you can understand as computers, such as notebooks and desktops. Of course, many years ago, computers were very large and heavy, so computer refers to this kind of computer with a case, a keyboard and mouse, which is very large, heavy, and versatile. The microcomputer refers to things like single-chip microcomputers. It is also an independent computer system with CPU, memory and peripherals, which can run computer programs. But compared to the computer, it is very small, and it is not general-purpose but special-purpose, so it is called microcomputer.

What about system? It is more inclined to the whole system, that is to say, system=microcomputer+various peripherals . The simple understanding is that when the serial port, LCD controller and other modules enter the chip, the entire microcomputer becomes the system. So in fact, system is more meaningful and more suitable for a name for modern single-chip microcomputers. So now we all call the chip SoC, which is more valuable.

What about microcontrollers? Many microcontroller manufacturers now call their microcontrollers microcontrollers . In fact, I personally understand that the focus of microcontrollers lies in the controller, which means that they want to emphasize that the system integrated in this chip is a controller and is good at control. Rather than a DSP (good at computing).

Embedded

The full name of embedded is embedded system, and English is Embeded system, so it can be seen that embedded is a system.

Why is it called embedded? The embedding here means that we embed this system (represented as a Chip on the hardware) into a certain device. For example, the chip on the board of a refrigerator is a system embedded in the refrigerator, which is responsible for controlling the user buttons, refrigerator lights, refrigeration system, etc. It can be seen that the name of the embedded system is mainly named from the organization of the chip in use. So from this perspective, as long as the chip is embedded in the device, it can be called an embedded system.

Then this range is too wide. It is really difficult to find a system that does not belong to the embedded system. So I often think that the term embedded is simply nonsense and has no meaning at all. Fortunately, this understanding is only the definition of embedded in a broad sense, but we usually understand embedded in a narrow sense.

In a narrow sense , embedded is to distinguish it from single-chip microcomputers. We often call the system that does not have MMU (memory management unit) in the chip and therefore does not support virtual addresses, and can only run bare metal or RTOS (typically such as ucos, Huawei LiteOS, RT-Thread, freertos, etc.) as a microcontroller (typically such as STM32, NXP) LPC series, new NXP imxRT1052 series, etc.), and the chip's own MMU can support virtual addresses, and the system that can run operating systems such as Linux, Vxworks, WinCE, and Android is called embedded. So Linux, WinCE, etc. are often called embedded operating systems, and that's how it is. If you look back carefully, in fact, most people talk about microcontrollers and embedded devices from a narrow perspective, not a broad perspective.

Single-chip technology and market conditions

The single-chip computer is the largest type of computer shipped. This is easy to understand, because single-chip microcomputers are so versatile, almost all the built-in control systems of home appliances are single-chip microcomputers, and this number is amazing. There are also various public facilities, factory automation equipment, etc., almost all controlled by single-chip microcomputers. There are also many manufacturers and categories of single-chip microcomputers. I will list a few commonly used ones below.

8-bit and 4-bit machines

This kind of single-chip microcomputer has low performance and low configuration, but the advantage is that it is cheap. So many low-end home appliances will be used, and small home appliances are the largest market for this type of microcontroller. In order to reduce costs, many of these microcontrollers can only be programmed with assembly (of course, many have also provided C compilers in recent years), and many chips are packaged in bounding (that is, the chip core is directly attached to the PCB and then glued with black hard glue. , If you have played LCD1602, look at the disc-shaped black one at the back).

In the past, those who made this kind of products were small chip manufacturers in Taiwan. In recent years, many such chip manufacturers have emerged in mainland China. Most of these single-chip microcomputer industries are benchmarking against a specific application field and are very familiar with the needs of the industry, and directly introduce solutions suitable for this industry. The layman may never have heard of the model and related information of this kind of microcontroller.

Generally speaking, this is a relatively low-end industry, and it is not recommended that you learn and enter. In particular, China is now engaged in industrial upgrading, and backward traditional home appliances continue to cut prices and still cannot be sold. On the contrary, various high-end functions and appearance "industrial upgrade" home appliances are highly profitable. Therefore, this kind of chips and technology suitable for traditional old electronic products is not worth investing in.

51 single chip microcomputer

In fact, 51 single-chip microcomputer is also an 8-bit machine, and the reason why it was taken out separately is because 51 single-chip microcomputer is so famous. In fact, back then, when a hundred schools of thought contended for single-chip microcomputers (about the 1980s), 51 single-chip microcomputers were only one of them, and there were many other powerful ones, but unfortunately they were all blown away by the rain and wind.

The reason why the 51 single-chip microcomputer is famous and alive today is that Intel later opened the copyright of the 51 core, so many companies and many people can use it without fear of payment or copyright risks. In fact, up to now (2018), 51 single-chip microcomputer is a very old solution with no technical advantages, but why is it still used in large quantities? The main reasons are as follows:

One is a large number of stock projects and stock developers. These people are very familiar with 51 single-chip microcomputers. Even many old engineers may only use 51 single-chip microcomputers. Many old projects cannot be re-developed, so 51 single-chip microcomputers are used.

Second, 51 single-chip microcomputers are also cheap enough, and many products that do not require too much performance can simply use 51.

The third is that the 51 core is open, so many SoCs that require a built-in microcontroller core (such as many capacitive touch screen chips, many fingerprint recognition chips, etc.) will choose to use 51 cores. If you don't need money, you can use it. Whoever chooses this one.

Many students asked me if I still want to learn 51 MCU? I think I still need to learn.

One reason is that the technical skills used in the development of 51 single-chip microcomputers are still useful when developing other single-chip microcomputers. Therefore, after learning 51, it will be much faster to learn other ones in the future, and time will not be wasted.

Another reason is that sometimes 51 microcontrollers are used in actual development, so learning it can be regarded as a handy skill. So if you want to learn MCU development, you can't go wrong starting with 51 MCU. But remember not to indulge in 51. After quickly learning 51 single-chip microcomputer, quickly continue to learn more modern and practical other single-chip microcomputers (such as stm32). Many people don't move after they learn 51. It's just like graduating from kindergarten and stop studying. It's not right.

STM32 microcontroller

Finally, STM32 is a popular hot chicken. ST released the first STM32 in 2007, and it has been 11 years. STM32 is an ARM Cortex-M core microcontroller. In fact, there are many microcontrollers that also use the ARM Cortex-M series cores (such as NXP's LPC series, the original Freescale K60 series, Taiwan Nuvoton's M051 series, and the domestic like Zhaoyi Innovation GD32 series, etc.), STM32 is just one of the masterpieces.

ARM has been very strong in recent years. It has beaten Intel in application-level SoCs. Now the chips in the mobile phone industry have been eaten by ARM, and MIPS and the like are even more crushed. In the field of single-chip microcomputers, ARM's Cortex-M series (M0, M3, M4, M7) also achieved great success. Many semiconductor manufacturers have given up their original architecture and turned to ARM core single-chip microcomputers.

How to put it, I personally think that the ARM core microcontroller is very suitable for the current era, especially the STM32, regardless of the hardware configuration or development tools, it has won the market recognition, and the popularity is getting higher and higher. It is strongly recommended to study STM32 in the university, and it is very valuable to be able to play STM32.

As for domestically produced STM32-like microcontrollers such as GD32, I think it will become stronger and stronger in the future, and even dominate the market to drive foreign brands out of China. The development methods of these chips are also very similar to STM32, so STM32 development is easy to cut through, don't worry.

Other MCU

I mean PIC, ATmega, MSP430, STM8 and the like, which are not very familiar, so I won’t elaborate on them. In general, these single-chip microcomputers are very cost-effective and have certain competitiveness in their respective fields, but they are still not as broad as STM32. Therefore, unless it is used by the company for research and development, it is not recommended to learn actively.

High performance and high price single chip microcomputer

Here I specifically refer to microcontrollers such as STM32F7, STM32H7, and NXP imxRT1052. Although this type is a single-chip microcomputer, its performance is much stronger than that of a general single-chip microcomputer, and its peripherals are much more complicated. It even requires an external SDRAM to provide more memory, and an external SLC Nand or Spiflash to provide storage.

At the same time, from the perspective of price, most of these microcontrollers are above RMB 30, or even as high as RMB 100. These are really the fighters in the microcontroller, and the price is scary. For this kind of microcontroller, I personally don't think much of it. In fact, writing this long article is to explain why I am not optimistic about this type of microcontroller. Interested students can continue to see the analysis below.

Embedded technology and market conditions

The most popular in the embedded field is ARM+linux and ARM+android.

The chips are all based on ARM. The low-end ones are ARM9 and ARM11, and the high-end ones are Cortex-A7, Cortex-A8, Cortex-A9, Cortex-A53, Cortex-A57, etc. From single-core to dual-core, quad-core, and eight-core. There are also a large number of manufacturers, domestically produced and imported from Taiwan. The coverage is also wide, including consumer, industrial, and automotive grades.

Embedded-level ARM can run complex OS very well because it has MMU. Therefore, although the chip itself can also run on bare metal, basically no one uses this type of chip to run bare metal or RTOS. Will be on the operating system.

Simply put, if the product does not require a gorgeous and beautiful man-machine interface, use Linux (such as routers, network cameras). If a man-machine interface is required but the interface is simple and focused on function and stability, then use linux+QT (such as industrial control HMI, electric Car charging piles, parking lot displays), if the product focuses on the user experience of human-computer interaction, then Android (such as smart phones, smart TVs, game consoles, etc.).

In general, embedded systems are highly complex, difficult to develop, and have a long learning curve. Because of the complexity of the software, the possibility of bugs is high. Once bugs are found, skills and experience are even more needed. Therefore, many companies use embedded linux or android to make products that have a lot of problems. On the one hand, it is related to the technical ability of the developers, and on the other hand, it is related to the company's inability to spend time and cost to make the products stable and mature.

The real difference between embedded and microcontroller

In fact, at this point of analysis, everyone also knows the real difference between embedded and single-chip computers, that is, whether there are complex operating systems such as linux or android.

Single-chip microcomputers are either streaking or RTOS. In fact, students who have played RTOS and linux know that although RTOS is also called an operating system, it is not at the same level as linux. The difference is far, not to mention Android. A module code that comes out of Android is much larger and more complicated than a complete RTOS. So whether there is a complicated OS like linux/android is really different for development.

For example, from the perspective of C language, the fourth part of my "Embedded Linux Core Course" "4. Deep Analysis of C Language" is a course specifically aimed at people who have insufficient C language skills in embedded linux development. Many students who have been working on single-chip microcomputers for many years are feeling that after reading it, they really don't know the depth of C language if they don't do linux. The elements of structure and pointers can't show the charm in the programming of single-chip microcomputer at all, but they have been perfectly played and released in the linux kernel. Without real research, it is really difficult to realize that kind of beauty and shock.

The intersection of embedded and microcontroller

Is there any intersection between embedded and single-chip microcomputer? The intersection here means: some products can be solved by embedded or single-chip microcomputer.

There was no such thing before. You think about the general single-chip microcomputer a few dollars more than ten dollars, but the embedded system SoC plus DDR and Flash at least dozens of dollars, how can there be an intersection. Even if the single-chip microcomputer can do things you can do with embedded devices, but why do I need to spend dozens of dollars for a job that I can do with more than ten dollars on embedded devices? So the two previously did not overlap. It's not a matter of grade at all.

But the situation has changed in the past two years. The first is that the configuration and price of many high-end microcontrollers are getting higher and higher. For example, the NXP imxRT1052 series microcontrollers released in October 2017 are known as cross-border processors. Why is it called cross-border? Which two realms are crossed?

As we know the single chip microcomputer, we need to provide the entire system with a single chip. Simply put, at least the three major components of cpu, sram, and flash are necessary, or else they can't run independently. So you see whether it is 51 single-chip microcomputer or STM32, it has CPU, SRAM, and Flash inside. This is a typical single-chip microcomputer.

The embedded SoC is different. For example, the S5PV210 only has a CPU and a small amount of SRAM. It needs to integrate DDR SDRAM and Flash (EMMC) to work normally. Therefore, the embedded system cannot be on a chip. Generally, the system of a typical embedded system consists of a core board. This core board integrates SoC, DDR SDRAM, Flash, power modules, etc., which is called an embedded system . The so-called cross-border processor is the two worlds of single-chip microcomputer and embedded. This imxRT1052 integrates CPU and SRAM internally, but without Flash, it needs an external independent Flash chip to form a system.

So this thing is neither a typical single-chip microcomputer nor a typical embedded one, but it is like a single-chip microcomputer and embedded, so NXP said this is a cross-border processor. Regardless of whether it works well, the name sounds cool.

By the way, why is NXP designed this way? In fact, because the built-in Flash of the microcontroller is very expensive, why imxRT1052 can be so much cheaper than the STM32 with the same performance, the main reason is that it does not have a built-in Flash.

So many people say that ST is lagging behind NXP, but it doesn't. It can only be said that the design of NXP is an innovation in the MCU industry. In comparison, it appears that STM32F7 and STM32H7 are too cost-effective. But to be honest, the STM32's F7 and H7 are really cost-effective. I don't know that just selling more than 100 single-chip microcomputers is going to go to heaven? Who gave ST's courage such a price, Liang Jingru?

Forget it, I'm too lazy to complain about F7 and H7. Let’s just say this cross-border processor imxRT1052. This thing has a main frequency of 600MHz, consumer-grade and industrial-grade, with a variety of peripherals (you can basically use it anyway), and can have a maximum resolution of 1024*768 TFT LCD (of course, an external SDRAM is required as a video memory). Compared with ordinary single-chip computers, this thing is like a god. Generally, those who play single-chip computers are so scared when they see this data, they kneel down and call Dad.

Besides the price, the official batch price of this thing is about RMB 30. Think about it, it feels cost-effective. In fact, STM32 is not so weak. Although the main frequency of F7 and H7 is not as abnormal as 600MHz, the overall performance of H7 is not much inferior to RT1052. Even if you don't call Dad, Big Brother can't escape.

The key reason why F7 and H7 did not make a big wave is that the price is too scary. Most people hear that more than 100 people just turn around and leave, and don't want to know your performance. And the 30 yuan of imxRT1052 is really tempting, it sounds like it is really high performance and low price, many people even judge that NXP is going to "kill ST" based on this.

The embarrassment of cross-border processors

The high-performance cross-border processor seems very good at first glance, but in fact it is not so easy to succeed. The reason is that this high-performance single-chip microcomputer actually has no advantage compared with the low-performance and cost-effective embedded linux solution.

Yes, many people think that the 600M frequency MCU is only 30 yuan, which is very cheap and very powerful. That's because you are not familiar with embedded solutions. In fact, the imxRT1052 single chip does not work very well. It needs at least external Flash and SDRAM to achieve high performance, even if it is only 1Gbit SLC Nand and 32MB SDRAM, plus the RT1052BOM cost is about 50 yuan. In addition, although RT1052 is claimed to be 30 yuan in batches, in fact, the small batch price is 40-50 yuan, so the current price of RT1052 core boards on the market is between 120-150 yuan. This price is actually not cheap, and there are many embedded linux solutions that are more cost-effective than this.

For example, NXP's imx6ul, built-in Cortex-A7 single core, the highest frequency is 1.2GHz, it is also industrial grade, and there are all kinds of peripherals you can think of. It comes standard with 256MB SLC Nand and 256MB DDR core boards. The lowest market price is 119 yuan, which is lower than RT1052.

In fact, there are more cost-effective solutions, such as the Nuvoton NUC972 solution used in the NUC972 Newton board launched by Shenzhen Maker, which has a built-in 64MB DDR and an external configuration of 1Gbit SLC Nand. The motherboard batch can be achieved within 100 yuan. The performance-price ratio is better than RT1052 and other high-performance microcontrollers.

Many people may say that I don't know how to develop embedded linux, I can only develop microcontrollers. So it doesn't matter how high the cost-effectiveness of your Linux solution is, it doesn't matter to me that the MCU is. I want to say that this is definitely a misunderstanding, a 100% misunderstanding. why?

The single-chip microcomputer is just three words, don't you think that what is called a single-chip microcomputer is one thing. Single-chip microcomputer and single-chip microcomputer are not the same. Do you think that the 600MHz MCU with 1024*768 resolution TFT LCD, its development method and difficulty will be the same as STM32F103 which is less than 10 yuan? Software development follows the hardware. What kind of performance hardware should be matched with what kind of software development methods and corresponding resources, and developers will also be required to have certain corresponding qualities.

So don’t think it’s just a single-chip microcomputer, so you can play. In fact, it is not an easy task to make the high-end MCU fully perform its performance and make a good-looking GUI and use it in the project to solve all the bugs.

At last

Today’s talk is relatively shallow, mainly talking about the origin and differences between single-chip microcomputer and embedded system. A comparison between high-end microcontrollers (STM32H7, imxRT1052, etc.) and cost-effective embedded linux solutions is drawn.

I mainly hope to give you a point of thinking and guide you to think about how to analyze and evaluate a chip solution, so that you can better select a chip solution that suits you when you are doing a project.

In general, my point of view is : if you can use a few dozen single-chip microcomputers, use the single-chip microcomputer. If these cost-effective single-chip microcomputers cannot meet the requirement of having dozens of high-performance single-chip microcomputers, then you should really consider whether It should be a cost-effective embedded linux solution in one step. Many people worry that Linux will not be developed, but this should not be considered.

If you really sink into the project, you will find that it is not that difficult to use embedded Linux, and it is not easy after the high-end microcontroller plus RTOS and a bunch of frameworks and protocol stacks. It's not easy to find if there is a problem. And after years of accumulation of embedded linux, most of its solutions are stable. And middleware such as the supporting RTOS and framework protocol stack of high-end single-chip microcomputers are often in the early stage of development, often with many bugs. Therefore, it is recommended that everyone is worth investing time to learn the skills of embedded linux software development.

1. It is said that many software engineers envy hardware engineers

2. Several communication interfaces commonly used in microcontrollers, such as I2C, SPI, UART, etc.

3. The results of the January rankings of programming languages ​​are released, and we have five important findings

4.5 yuan changed to 70, hey, the chip is out of stock again

5. How does the RISC-V processor design the instruction set? What's so special

6. Macro definitions commonly used by embedded engineers

Disclaimer: This article is reproduced online, and the copyright belongs to the original author. If you are involved in the copyright of the work, please contact us, we will confirm the copyright based on the copyright certification materials you provide and pay the author's remuneration or delete the content.

Guess you like

Origin blog.csdn.net/DP29syM41zyGndVF/article/details/114301180