Selecting a microcontroller for your project
[Partner Content] Selecting the microcontroller may prove to be quite easy, as it depends on our skills or available equipment. However, sometimes we need to face new challenges, and then we have to answer numerous questions and take into account various criteria.
Step-by-step selection criteria
When tackling the challenges related to creating a new electronic device, a number of problems must be solved. Firstly, you need to select suitable components, which is not always easy. In recent years, many components have been difficult to obtain, so they sometimes had to be quickly replaced with other elements offering similar performance, even at the expense of making a new PCB. The microcontroller is the key element of numerous modern devices. Selecting the microcontroller may prove to be quite easy, as it depends on our skills or available equipment. However, sometimes we need to face new challenges, and then we have to answer numerous questions and take into account various criteria.
Selecting a suitable microcontroller is one of the initial stages of each project. While analysing the available systems, three groups, i.e. microcontrollers with 8-, 16-, and 32-bit cores, should be taken into account. There are no hard-and-fast rules for selecting a microcontroller, but there are numerous factors that should influence your decision. Sometimes, in particular at the beginning of a project implementation process, it is difficult to foresee which microcontroller features will be most relevant for your application. For example, the ability to operate over a wide temperature range or availability of built-in interface modules may prevent fulfilling the requirements for low power consumption from the power supply.
The first section of such a description should refer to the basic functionalities, i.e. contain a list of properties that will be crucial for our project. It should include the following information:
Next, design constraints should be analysed:
At this stage of the specification development process, precision is not an issue. The main objective is just to estimate the actual needs to compare characteristics and functions of selected microcontroller systems. For example, hardware-based execution of functions in the sleep mode, real-time response, and resistance to EMI interferences are typical properties of systems fitted with 8-bit cores. 32-bit microcontrollers should be selected to design a multitasking device and ensure such characteristics as dynamic supply power consumption management, high computing power or operation controlled by an operating system.
The microcontroller controlling a battery-powered application should have a very high-performance core to perform as many operations as possible after waking it up from the sleep mode, in which it stays for most of the time (to minimise power consumption). Therefore, a system with the 32-bit ARM core is the best choice for the majority of mobile devices. Microcontroller speed in a stationary device with its own power supply module is important, but only for the application purposes.
In a mobile device, a large number of possible microcontroller sleep states is an advantage. It is typical for 32-bit controllers, whereas simpler, 8-bit models come with at one or two operation modes at lowered power consumption. It also often happens that a microcontroller can be on or off. It doesn’t matter in the case of many applications, but some more advanced ones may require running a larger number of energy-saving modes. This helps minimise average power consumption and extend the battery operation time.
The supply voltage value also affects power losses in the core, but in most microcontroller applications no additional cooling is required.
Obviously, you can use additional expander systems with serial interfaces, which reduces considerably the necessary number of pins, but also complicates the process of selecting suitable software and boards, and hinders the commissioning process. Selecting a microcontroller in terms of the number of leads always requires compromise between what is available and the effort involved in writing and commissioning the target application.
The selection of signals to be processed is also very important. If your application is designed to process analogue signals, a high-performance microcontroller with a correct number of A/C converters operating at the required sampling frequency is necessary. Ideally, peripheral modules enhancing their operation, such as DMA, MAC (Multiply And Accumulate), DSP or FPU units should also be available. Then, analogue signals can be processed efficiently, without the necessity to cater for higher requirements related to the core itself and its performance.
An operating system requires significantly more memory resources than an independently coded application. In addition to the actual program, it must provide space for redundant data, which in this case would include the operating system code stored in flash memory and its operating memory requirements (stack, system variables, interruption handling, interface systems, etc.).
Typically, programs written in an assembler have smaller memory requirements. Using a high-level language compiler requires a certain amount of memory to be allocated for the program stack and variables. As mentioned earlier, the operating system and the program running under its control require even more memory resources. It must also be specified whether the microcontroller will operate with a graphic display, because then the flash memory stores icon patterns or other graphic elements, which usually come in a form of bitmaps and take up a lot of space when stored together with colour attributes.
While selecting a system type or IDE runtime environment, attention should be paid to the availability of function libraries. More often than not, system manufacturers do a huge amount of work for the programmer, creating functions and routines that are responsible for handling numerous functionalities and peripheral modules i.e. for touch interfaces, displays, communication interfaces, PWM generators, etc. Standardised code fragments tested in manufacturer’s laboratories can significantly accelerate the program creation process and reduce the time spent working on a given project.It is also worth reusing previously written code, so selecting a chip manufacturer that supplies a variety of microcontrollers programmed in the same way and with the same tools is often a sensible idea.
Text prepared by Transfer Multisort Elektronik Sp. z o.o.
https://www.tme.eu/en/news/library-articles/page/58382/selecting-a-microcontroller-for-your-project/
When tackling the challenges related to creating a new electronic device, a number of problems must be solved. Firstly, you need to select suitable components, which is not always easy. In recent years, many components have been difficult to obtain, so they sometimes had to be quickly replaced with other elements offering similar performance, even at the expense of making a new PCB. The microcontroller is the key element of numerous modern devices. Selecting the microcontroller may prove to be quite easy, as it depends on our skills or available equipment. However, sometimes we need to face new challenges, and then we have to answer numerous questions and take into account various criteria.
- Precise project description
- Microcontroller selection criteria
- Power supply type
- Operating voltage
- Number of leads
- Peripheral modules
- Core and peripheral system speed
- Available memory
- Electric reliability
- Volume
Selecting a suitable microcontroller is one of the initial stages of each project. While analysing the available systems, three groups, i.e. microcontrollers with 8-, 16-, and 32-bit cores, should be taken into account. There are no hard-and-fast rules for selecting a microcontroller, but there are numerous factors that should influence your decision. Sometimes, in particular at the beginning of a project implementation process, it is difficult to foresee which microcontroller features will be most relevant for your application. For example, the ability to operate over a wide temperature range or availability of built-in interface modules may prevent fulfilling the requirements for low power consumption from the power supply.
Project description
While selecting device components, such factors as parameters, price, availability and workshop equipment must be taken into account. The same rule fully applies to microcontrollers, which are very important components. Selecting them may be even more difficult, if we consider the fact that it influences the current and future parameters of the target device, as well as the possibility of creating further development versions. Therefore, at this stage, it is worth identifying and describing the necessary requirements, which will not only facilitate selecting a microcontroller, but also help compare the properties and parameters of various systems.The first section of such a description should refer to the basic functionalities, i.e. contain a list of properties that will be crucial for our project. It should include the following information:
- What are the functions of the designed device?
- What will be the input and output signals? What will be their levels (voltage and current) and frequency?
- Will the device communicate with the environment? If so, how? Will a wireless interface be required? Will data be presented on a graphic display?
- What data will be stored in the memory and how much storage space will be required? Should this data also be available when the power supply is off/on?
- How prompt should a response to an event be?
- What language will be used to develop the control application (which affects the RAM and program memory size)?
Next, design constraints should be analysed:
- What is the target device price, which affects assembly and component costs?
- What are the constraints related to power supply? Is it a mobile or stationary device? What is the required operation time following battery replacement/charging?
- What is the size of the target device? What enclosure will be used to house it?
- Is the device designed for industrial, consumer or special applications?
At this stage of the specification development process, precision is not an issue. The main objective is just to estimate the actual needs to compare characteristics and functions of selected microcontroller systems. For example, hardware-based execution of functions in the sleep mode, real-time response, and resistance to EMI interferences are typical properties of systems fitted with 8-bit cores. 32-bit microcontrollers should be selected to design a multitasking device and ensure such characteristics as dynamic supply power consumption management, high computing power or operation controlled by an operating system.
Selection criteria
In order to select a suitable microcontroller, we have developed a number of criteria that are worth taking into account. They should be treated as general guidelines and food for thought, listed according to their significance and expected device properties, along with your own criteria that are not discussed in this article. Some issues will be crucial in the case of certain devices, but in the case of other devices they can even be omitted.Power supply type
Mobile devices are usually supplied by single-use or rechargeable batteries. Therefore, the microcontroller embedded in such a device must consume as little energy as possible. Microcontrollers embedded in mains-powered devices (via a power supply unit) should also be energy efficient in order to keep up with the current trends related to cutting-edge applications, but in their case minimising power consumption is not such a vital issue.The microcontroller controlling a battery-powered application should have a very high-performance core to perform as many operations as possible after waking it up from the sleep mode, in which it stays for most of the time (to minimise power consumption). Therefore, a system with the 32-bit ARM core is the best choice for the majority of mobile devices. Microcontroller speed in a stationary device with its own power supply module is important, but only for the application purposes.
In a mobile device, a large number of possible microcontroller sleep states is an advantage. It is typical for 32-bit controllers, whereas simpler, 8-bit models come with at one or two operation modes at lowered power consumption. It also often happens that a microcontroller can be on or off. It doesn’t matter in the case of many applications, but some more advanced ones may require running a larger number of energy-saving modes. This helps minimise average power consumption and extend the battery operation time.
Power supply voltage
The power supply voltage must be taken into account in at least two cases. Firstly, it impacts the microcontroller operation speed. It is usually the case that lower power supply voltage results in slower core operation, as the clocking frequency is lower, too. It is worth considering this aspect when planning on the code execution speed. In the case of interconnected external systems, another important question should be asked, i.e. whether the microcontroller supplied with low voltage can operate, for example, with interface systems requiring higher voltage. This means it must be checked whether such systems are available at all or special converters must be used or the microcontroller must be supplied with voltage higher than previously planned.The supply voltage value also affects power losses in the core, but in most microcontroller applications no additional cooling is required.
Number and types of leads
The number of I/O leads in the enclosure to be used in the target application is another vital criterion. While considering this aspect, the application must already be “roughly” designed. This means defining such things as the display to be used, its control method, possible I/O interface systems, and the method of connecting them to the microcontroller itself. You must also know the number of necessary bistable (input and output) I/O leads, the number of planned buttons, analogue inputs/outputs, etc. Only after considering these aspects, you can estimate the number of leads and select the microcontroller enclosure.Obviously, you can use additional expander systems with serial interfaces, which reduces considerably the necessary number of pins, but also complicates the process of selecting suitable software and boards, and hinders the commissioning process. Selecting a microcontroller in terms of the number of leads always requires compromise between what is available and the effort involved in writing and commissioning the target application.
Special, additional requirements
Modern microcontrollers are quite well-equipped with embedded peripheral modules, among them models which facilitate direct control over motor or inverter drives. Other ones come with a decent number of built-in PWM generators, which facilitates controlling multiple servomotors in the manipulator. Many can be directly connected with a USB interface. Embedded peripheral modules simplify the application, accelerate its operation and reduce the size of the program code. They also facilitate much faster commissioning. It is definitely worth taking into account the availability of peripheral modules and other special functionalities when selecting a microcontroller.The selection of signals to be processed is also very important. If your application is designed to process analogue signals, a high-performance microcontroller with a correct number of A/C converters operating at the required sampling frequency is necessary. Ideally, peripheral modules enhancing their operation, such as DMA, MAC (Multiply And Accumulate), DSP or FPU units should also be available. Then, analogue signals can be processed efficiently, without the necessity to cater for higher requirements related to the core itself and its performance.
Core and peripheral system operation speed
The choice between hardware- and software-based implementation of functions comes with important implications for the overall design. It results from the fact that you must choose between low computing power requirements and design simplicity. When making this decision, it is necessary to pay attention to the consequences of your choice. For example, software-based UART interface implementation is possible, but it requires the CPU to continuously monitor signals on the selected lead or to interrupt the main program thread execution, if you choose to implement interruptions from the I/O port. Such a functionality may consume a large part of the CPU processing power and hinder the operation of other peripherals. The same applies to a graphic display. A large amount of data sent may influence the program execution speed. In such a case, especially when a high-resolution display is used, it may be a much more efficient solution to use the DMA sending data from the memory via a hardware-based SPI, without any core intervention.Available memory
By definition, an operating system offers multitasking features and independently switches between the different machine states, which significantly simplifies programming. On the other hand, an independently coded state machine uses much less program and data memory, requires less computing power and can be an optimum solution in terms of the application needs and speed. Both these approaches are effective and often used in practice.An operating system requires significantly more memory resources than an independently coded application. In addition to the actual program, it must provide space for redundant data, which in this case would include the operating system code stored in flash memory and its operating memory requirements (stack, system variables, interruption handling, interface systems, etc.).
Typically, programs written in an assembler have smaller memory requirements. Using a high-level language compiler requires a certain amount of memory to be allocated for the program stack and variables. As mentioned earlier, the operating system and the program running under its control require even more memory resources. It must also be specified whether the microcontroller will operate with a graphic display, because then the flash memory stores icon patterns or other graphic elements, which usually come in a form of bitmaps and take up a lot of space when stored together with colour attributes.
Electric reliability
In an ideal application, such factors as microcontroller resistance to supply voltage fluctuations, EMI interferences or overvoltage on I/O lines are not taken into account. However, in real-world application conditions, the microcontroller is affected by these factors, in particular in automotive applications. Therefore, microcontrollers with an 8-bit core or intermediate microcontrollers with a 16-bit core supplied with 5 V are much more suitable for vehicle systems. In practice, implementing a 32-bit core supplied with voltage ranging from 2.7 to 3.3 V is difficult, as it results in higher risk of exposure to EMI interferences. Such an application is possible to be implemented, but its commissioning is much more time-consuming.Production volume
While selecting different components (not only a microcontroller), it must be decided whether the device will operate as an industrial machine component marketed in just a few pieces or it will be introduced to the consumer market in thousands of pieces. In the former case, the enclosure size and components costs are usually not an issue, while in the latter case, attention must be paid to the components and their prices, but also to the installation method on the target board.Runtime environment, software tools
Nowadays, there is a wide selection of excellent, free-of-charge, high-level language compilers, editors, debuggers, simulators, and other hardware and software tools compatible with numerous microcontroller models. Therefore, often this criterion will not matter much, but this is not always the case. If you design a device for automotive or aerospace applications, you must use approved software tools, which are not cheap and limit the choice to specific chip families that are often offered only by specific manufacturers.The designer who builds a new device for the consumer market (for example a toy controller) has much more freedom.While selecting a system type or IDE runtime environment, attention should be paid to the availability of function libraries. More often than not, system manufacturers do a huge amount of work for the programmer, creating functions and routines that are responsible for handling numerous functionalities and peripheral modules i.e. for touch interfaces, displays, communication interfaces, PWM generators, etc. Standardised code fragments tested in manufacturer’s laboratories can significantly accelerate the program creation process and reduce the time spent working on a given project.It is also worth reusing previously written code, so selecting a chip manufacturer that supplies a variety of microcontrollers programmed in the same way and with the same tools is often a sensible idea.
Final notes
Once all criteria have been analysed and the necessary compromise defined, you may start looking for a microcontroller meeting the specified project-related requirements. Unfortunately, despite the multitude of available systems, selecting a perfect model is often an issue. Sometimes, you are forced to give up certain options, as they make the design more complicated and, simultaneously, increase its cost. In such cases, it is not only the price of the microcontroller that matters, but also the cost of the equipment needed to commission it and test the features of a ready-made product, as well as the cost of peripheral systems necessary to implement a given functionality. More often than not, introducing an additional functionality results in raising the test complexity level and may significantly prolong the device marketing time. Your workshop capabilities are also important. Sometimes, writing a system soldered in a board (in-circuit) is the only available programming option. Luckily, it is offered by most, though not all, modern microcontrollers.Text prepared by Transfer Multisort Elektronik Sp. z o.o.
https://www.tme.eu/en/news/library-articles/page/58382/selecting-a-microcontroller-for-your-project/