Teach you how to choose the right microcontroller?

System performance is not equivalent to computing power. Lower power consumption, rich on-chip peripherals, and real-time signal processing power are paramount for most embedded applications. Traditional 8-bit and 16-bit microcontrollers have handled this type of problem very well, but with the ever-increasing functional requirements and special requirements of today's embedded designs, many microcontroller manufacturers have begun to abandon their traditional 8-bit, 16-bit microcontrollers. . But choosing a 32-bit processor may not be optimal for some tasks. Below we will discuss the selection of the microcontroller.

Understand system performance

MIPS (million instrucTIons per second) is a representation of the computing power of a microcontroller. However, all embedded applications not only require computing power, so the diversity of applications determines the diversity of system performance measurement methods. Most of the parameters are equally important and difficult to represent with one parameter. We should not just use MIPS. Just judge the quality of the system. Perhaps an application requires a highly integrated microcontroller that requires multiple timers and multiple interfaces due to cost constraints. But another application requires high precision and fast analog conversion capabilities. The commonality between the two may be just the power supply, such as battery power. For a real-time sequential processing application, the failure of communication can have catastrophic consequences. In this case, a smart controller is needed. This controller should be able to handle tasks in the correct order and the response time must be balanced. A common problem with all of the above applications may be regular on-site upgrade capabilities.

In addition to specific product requirements, system performance can be measured for easy-to-use, easy-to-use development tools, application examples, comprehensive documentation, and an efficient support network.

System performance related issues

1. Limitations of traditional 8-bit microcontrollers

Most engineers are concerned about system performance because more and more 8-bit and 16-bit microcontroller families are no longer able to meet today's growing demand. Old and inefficient architectures limit processing power, memory capacity, peripheral processing, and low power requirements. 8-bit processor architectures such as 8051, PIC14, PIC16, PIC18, 78K0, and HC08 were developed prior to the advent of high-level languages ​​such as C, and their instruction sets were only used in the assembly development environment. And the central processing units (CPUs) of this type of architecture lack some key functions, such as 16-bit arithmetic operations support, conditional jumps, and memory pointers.

Many CPU architectures require several clock cycles to execute an instruction. Microchip's 8-bit PIC family requires four clock cycles to execute one of the simplest instructions, which results in a 5M IPS with a 20M clock. For other CPU architectures, such as the 8051 core. It takes at least 6 clock cycles to execute an instruction, which makes the actual MIPS much lower than the given clock frequency.

Int max(int ​​*array)

{

Char a;

Int maximum=-32768;

For (a=0;amaximum)

Maximum=array[a];

Return (maximum);

}

The above code is a simple C language function, and Table 1 lists the corresponding results of compiling this code on three different CPU architectures. The execution time of the 8051 core is almost 4 times that of the PIC16 core, and it is 28 times for the AVR architecture.

Table 1 Code capacity and execution time of different CPU architectures

Some semiconductor manufacturers have solved the clock distribution problem, enabling the microcontroller to implement a single clock cycle instruction. When the clock frequency is 100MHz, Silicon Labs claims that their 8-bit 8051-based microcontrollers can reach a peak of 100MIPS. However, there are a few issues here:

First, since most instructions require two clock cycles or more, their actual capabilities are close to 50 MIPS;

Second, the 8051 is an accumulator-based CPU, and all data that needs to be calculated must be copied to the accumulator. Looking at the assembly code of the 8051 processor, you can see that 65%-70% of the instructions are used to move data. Because of the modern 8-bit and 16-bit microcontroller architectures, there are a series of registers connected to the arithmetic logic unit (ALU). Therefore, the 50MIPS of the 8051 core is only equivalent to 15 MIPS of modern 8-bit and 16-bit microcontroller architectures.

MOV A, 0x82

ADD A, R1

MOV 0x82, A

MOV A, 0x83

ADDC A, R2

MOV 0x83, A

MOVX A, @DPTR

MOV OxF0, A

INC DPTR

MOVX A, @DPTR

RET

Third, the older CPU architecture lacks support for mass storage. Back in the 1970s, it was difficult to imagine an embedded application that required more than 64KB of memory, which allowed many CPU designers to choose a 16-bit address bus. Therefore, the CPU, registers, instruction set, and data bus for program memory and data memory are always limited by this.

Fourth, in 2006, about 9% of 8-bit embedded applications used 64KB or more of program memory, which represents 26% of the 8-bit MCU market. It is speculated that in 2009, 14% of 8-bit embedded applications will represent 36% of revenue. And 14% of the applications will use 64KB or more of program storage space.

From a system performance point of view, all of this makes older 8-bit MCUs increasingly uncompetitive.

2. Unsuitable for 32-bit processors

Older CPU architectures cannot meet today's market demands. To solve this problem, many vendors have upgraded to 32-bit processing platforms. This is undoubtedly the best choice for applications that require 32-bit processing power, but many designers are not the right choice to switch to a 32-bit platform. Using 32-bit MCUs to solve the limitations of 8-bit and 16-bit microcontrollers will result in excessive cost.

Most 32-bit microcontrollers do not provide high speed, high resolution analog to digital (ADC) conversion, EMC performance is generally low, and ESD protection is weak. 8-bit and 16-bit microcontrollers have obvious advantages in these areas. In addition, strong IO drive capability, a variety of internal and external oscillators to choose from, on-chip voltage regulators without external components, etc. are other advantages of 8-bit and 16-bit microcontrollers.

Obviously, a 32-bit CPU contains more digital logic units than any 8-bit and 16-bit CPU, which results in high manufacturing costs. Although some special semiconductor processes can be used to reduce costs, the drawback is that it leads to higher leakage current and static power consumption. Some applications, such as water meters, gas meters, toll road electronic tags, security systems, etc., spend most of their lifetime, the CPU is in sleep mode, which is the stop state. The battery life of such applications must be 5-10 years, so in this case, it is not possible to upgrade the CPU from 8-bit or 16-bit to 32-bit processors. If you want to improve system performance, you can only use other methods.

Maintain a unified product line

Manufacturers regularly produce new embedded product extension lines to remain competitive. These new products are often perfected, upgraded, or reduced in cost. Other factors include manufacturing process upgrades, increased competitiveness and market trends. Independent of the first idea, new products are always based on some core ideas. Therefore, new products or upgrades will depend on existing platforms and source code.

Research shows that half of companies potentially reuse existing hardware and software to reduce development time. Engineers' understanding of a particular MCU product family, the detailed development of relevant MCU development documentation, and the availability of efficient development tools are also important factors in reducing development time and cost.

Protect intellectual property and handle confidential information

Some embedded applications are used to process personal information. Others authorize access to restricted areas or financial areas. Almost all microcontrollers are running proprietary programs. If the relevant software is cracked and even cloned products are circulated in the market, the owner of the intellectual property may lose future profits. For this reason, most microcontrollers have protection mechanisms. This mechanism prevents hackers or third parties from using a programmer, debugger, or test interface to read program memory.

Today, more and more applications use hierarchical design or functional module design. Wired communication or wireless communication between different functional modules or components becomes an increasingly difficult and noteworthy issue. In order to prevent unauthorized access by third parties, encryption is required. An example of this is the Remote Keyless Entry (RKE) or home wireless network. If the transmitted data is not encrypted, then anyone can use your car or use your wireless internet connection. The traditional solution is to use a closed algorithm or an encryption algorithm so that only those who know the algorithm can use it. Such an approach is called security by obscurity, which is a very dangerous approach. The best solution is to use public algorithms such as AES or DES, which allow both public access and security. If you use a private encryption algorithm or an anonymous encryption algorithm, you cannot estimate the security level or discover critical design flaws.

The problem with using a public encryption protocol is that it requires powerful computing power and a reliable algorithm design. A typical value for the time required to encrypt or decrypt an 8-byte block using the DES algorithm on modern 8-bit MCUs is approximately 100,000 clock cycles. This is equivalent to using all 15MIPS to support 9600Kbps communication speed. The 32-bit CPU is usually 50%-60% faster. At 32MHz system clock, 45,000 cycles or 1.4 milliseconds can only be used for secure data communication at 45 kbps, because all CPU time is used for encryption. And decryption. Obviously, the system doesn't have much time left for the actual application. Second, most wireless applications are battery-powered, and if most of the processing power is used for security, battery life will be reduced.

High integration and interrupt latency and security

Today's microcontrollers integrate more and more peripherals on their chips. In general, peripherals play a vital role in the efficient operation of the microcontroller. Peripherals function as a connection sensor, system control, data communication, fault control, and timing. The traditional approach is to use interrupts to communicate with on-chip peripherals. This advantage is obvious, greatly saving CPU time, so that the software does not have to cycle through the peripheral state, thus essentially improving the efficiency of the CPU. Even so, the interrupt mode still has some disadvantages, one of which is that the context switch in the interrupt routine takes some processing cycles. For modern CPU architectures, interrupt context switching requires 20-100 clock cycles. Suppose there is a simple task that gets the SPI data sent. If the SPI rate is 1Mbps, the SPI receive interrupt can reach 125KHz. If the SPI interrupt processing requires 25 clock cycles (including context switching), then for 20MIPS CPU time, it only takes 15% to process the SPI interrupt. CPU time. If there are other series of interrupts at the same time, it means that the CPU has to deal with huge tasks.

Another disadvantage of using interrupt mode is the effect of interrupt response time on critical system events. Some interrupt sources may require the CPU to respond immediately after the trigger. For example, the airbags of automobiles, the emergency stop of power equipment, and other emergencies. All of this requires immediate response or immediate shutdown of the control system to prevent permanent disaster events. If the CPU needs to complete other interrupt service routines first or it takes a long time to perform context switching, the results will be unpredictable.

At present, some semiconductor manufacturers have developed some new technologies. These techniques are used to replace traditional interrupt or DMA methods, and using such techniques for peripheral communication can save a lot of CPU time.

Drone Brushless Motor, Heavy Payload Brushless Motor, Drone Motors,Amorphous Brushless Motor

Drone Motors

Drone Brushless Motor, Heavy Payload Brushless Motor, Drone Motors,Amorphous Brushless Motor

shenzhen GC Electronics Co.,Ltd. , https://www.jmrdrone.com

Posted on