In embedded development, the selection of single-chip microcomputers can be said to be a very difficult task, because it involves factors such as the working performance and cost of the product. Generally speaking, the selection of single-chip microcomputers should be considered from the aspects of practicality, developability, price, etc. The specific details are as follows:
Memory
The capacity of the MCU FLASH is determined by the size of the program, and the FLASH capacity must be greater than the code size. For example, if your code size is about 50 KB, it is recommended that you choose a MCU with a FLASH capacity of 64 KB or 128 KB.
speed
The running speed of a microcontroller depends first on the clock frequency. Generally speaking, for microcontrollers of the same structure, the higher the clock frequency, the faster the speed.
If your design requires high speed, then choose a microcontroller that runs faster. For example, in general, motor control applications mostly use sampling rates of 100ksps or higher, so when the microcontroller is used for motor control, the clock frequency must be high enough.
In short, when selecting a single-chip microcomputer, you should choose the clock frequency according to the needs of the product, and do not pursue high speed unilaterally. The higher the clock frequency, the greater the power consumption. In addition, the stability, anti-interference and other parameters of the single-chip microcomputer are basically inversely proportional to the running speed of the single-chip microcomputer. Therefore, try to find a single-chip microcomputer that can run at a very high clock frequency and has low power consumption.
Peripheral requirements
If your design requires peripherals such as ADC, SPI, GPIO, USB, etc., then you need to find a microcontroller that integrates all of these peripherals. Because using a microcontroller with the above peripherals is obviously more economical than using an ordinary microcontroller and peripherals plus a separate ADC.
In addition, the integration of peripherals into the microcontroller also means lower power consumption, because there are no peripheral circuits that can generate power consumption, and there is no copper foil that can generate power consumption for connecting peripheral circuits. Only the microcontroller itself generates power consumption.
Convenient development tools
This is a very important aspect because the development tools can greatly affect the power consumption of the product you design. Many companies have developed compilers with code optimization functions, so when you compile the code, the compiler will tell you the specific compilation information, and you can optimize the code according to the compilation information to reduce power consumption.
For example, if your design requires peripherals such as ADC, UART, and GPIO, you need to initialize these devices, but the use of UART in the design is conditional (only used to display results during debugging), then the compiler will prompt you to disable this peripheral to reduce power consumption. It must be said that this intelligent development tool is a blessing for developers.
Future requirements and compatibility
When designing a product, designers need to consider issues such as the possibility that the product may need to be upgraded in the future. For example, if certain functions need to be added to the design, it may be necessary to increase memory, peripherals, etc., and it may also be necessary to increase the operating speed of the microcontroller. Therefore, when selecting a microcontroller, it is necessary to find a balance between current design requirements and future designs to meet different levels of requirements.
cost
A good design should not only have perfect functions, but also meet the cost requirements. If the cost cannot be controlled, no matter how good the design is, it will be in vain. Therefore, it is necessary to reduce the cost of the microcontroller or even the entire product as much as possible.
Operating voltage (VCC)
The operating voltage of a microcontroller refers to the voltage required for it to work normally. The higher the operating voltage, the greater the power consumption of the microcontroller. Therefore, in order to reduce the power consumption of the product, the operating voltage must be reduced as much as possible.
In addition, designers choose the appropriate chip architecture according to specific product requirements. If it is just a simple control application (such as lighting systems, electronic toys, etc.), then you don't need a chip with a complex architecture like ARM. For low-power design, the microcontroller must have a sleep mode, and the use of sleep mode/low-power mode based on interrupt operation is a standard industry practice to reduce power consumption.
Conclusion : At any time, we should be clear: the microcontroller is just a tool to realize the development function. There is no need to worry about whether the chip is newly launched or the latest product. What we need to work hard on is to improve our embedded theoretical knowledge, accumulate development experience, and select the most cost-effective microcontroller!