This article is a part of Arduino / ATmega328p Embedded C Firmware Programming Tutorial. Consider exploring the course home page for articles on similar topics.
Also visit the Release Page for Register Level Embedded C Hardware Abstraction Library and Code for AVR.
Embedded System is a dedicated Computing System with one or many dedicated functions within a Mechanical or Electrical System.
Unlike general purpose computers, which are designed to handle multiple tasks like media playback, internet browsing, word processing, file management, gaming, computation, etc. Embedded Systems are designed and programmed to perform some specific task over and over usually till the end of the life of that system.
Embedded Systems are smaller in size, low power, less costly, and have limited computational resources compared to a general purpose computer.
Modern Embedded Systems are mostly based on Microcontrollers (uC) but there are many applications where Microprocessors (uP), Digital Signal Processors (DSP), Field-Programmable Gate Arrays (FPGA), Application-Specific Integrated Circuits (ASIC) are being used.
In general, an Embedded System is a combination of hardware and software that performs a specific task.
- It is a system built to perform its task, entirely or partially autonomous.
- Is specially designed to perform a few tasks in the most efficient way.
- Interacts with physical elements in our environment, e.g. controlling and driving a motor, sensing temperature, etc.
Most embedded systems are time-critical applications meaning that the embedded system is working in an environment where timing is very important: the results of an operation are only relevant if they take place in a specific time frame. An autopilot in an aircraft is a time critical embedded system. If the autopilot detects that the plane for some reason is going into a stall then it should take steps to correct this within milliseconds or there would be catastrophic results. Another time-critical application is fuel injection in engines, ABS in braking, etc.
What You Will Learn
- What is the characteristics of an embedded system?
- How how many type of systems are there in computing system?
- What are the peripheral components of an embedded system?
Real-Timeliness of Embedded Systems
A Real-Time Embedded System is defined as a system whose correctness depends on the timeliness of its response. Examples of such systems are flight control systems of an aircraft, sensor systems in nuclear reactors and power plants. For these systems, delay in response is a fatal error. A more relaxed version of Real-Time Embedded Systems is the one where timely response with small delays is acceptable. An example of such a system would be the Scheduling Display System on the railway platforms. In technical terminology, Real-Time Systems can be classified as:
- Hard Real-Time Systems – systems with severe constraints on the timeliness of the response.
- Soft Real-Time Systems – systems which tolerate small variations in response times.
- Hybrid Real-Time Systems – systems which exhibit both hard and soft constraints on its performance.
Criticality of Embedded Systems
Embedded computers may be economical, but they are often prone to some very specific problems. A PC computer may ship with a glitch in the software, and once discovered, a software patch can often be shipped out to fix the problem. An embedded system, however, is frequently programmed once, and the software cannot be patched. Even if it is possible to patch faulty software on an embedded system, the process is frequently far too complicated for the user.
Another problem with embedded computers is that they are often installed in systems for which unreliability is not an option. For instance, the computer controlling the brakes in your car cannot be allowed to fail under any condition. The targeting computer in a missile is not allowed to fail and accidentally target friendly units. As such, many of the programming techniques used when throwing together production software cannot be used in embedded systems. Reliability must be guaranteed before the chip leaves the factory. This means that every embedded system needs to be tested and analyzed extensively.
An embedded system will have very few resources when compared to a full blown computing system like a desktop computer. The memory capacity and processing power in an embedded system are limited. It is more challenging to develop an embedded system when compared to developing an application for a desktop system as we are developing a program for a very constricted environment. Some embedded systems run a scaled down version of an operating system called an RTOS (real-time operating system).
Example of an
Laser Printers have a notable amount of embedded systems in them to control all aspects of printing. Along with the primary job of printing it has to take user inputs, handle communication with the computer, sensing paper jams, handling faults, sensing papers left on the tray, etc.
The microprocessor’s primary task is to understand the text and control the printing head such that it discharges ink where it is needed. To do so it has to decode the different files given to it and understand the font and graphics. It takes a significant CPU time to process the data as well as it has to control motors, take user inputs, etc so you can imagine that it takes quite an effort to design and program an embedded system.
Embedded System Components
- Microprocessor / Microcontroller
- Interrupt Controller
- I/O Ports
- ADC – Analog to Digital Converter
- RTC – Real Time Clock
- Communication Interfaces
- Active / Passive Components
- Crystal Oscillator
- Pull Up / Down Circuit
- Power Supply and Controller PMIC
- Microprocessor / Microcontroller
- Application Software
- Operating System
Selection of Microprocessor / Microcontroller
The selection of a Microcontroller or Microprocessor depends on many factors. Some of the important factors are :
- Required Peripheral Interfaces
- Depending on the application of the microcontroller the need for different peripherals will change as well as the specifications for the peripherals will change. Ex – an application may need only USB1.0 interface so there will be no need to go for an expensive MCU with USB2.0 / 3.0.
- Software Architecture
- The Software going to run on the system may demand specific CPU requirements. Ex – You may need an FPU or DSP Instruction Set enabled CPU if you need to do any heavy mathematical computation or signal processing application. Based on your application you have to choose a 16MIPS AVR or a 300MIPS ARM.
- CPU Architecture
- Based on the previous two steps you have to choose the CPU Architecture most suitable for the kind of software application you want to run on the device. Some small applications may work well with 8-bit CPUs but Applications like motion processing will demand a 32-bit or 64-bit CPU.
- Memory Need
- This also depends on the size of the software you want to run. Memory need includes Internal or External Flash, RAM, EEPROM or any special memory. Based on the peripherals and application software it can be calculated how much memory resources are needed. You also have to keep some extra memory for future improvements and versions.
- Cost is an important factor when you are planning to make an end product. Every penny is important when a product will be manufactured in large quantities like in tens of thousands.
- Availability and Supply
- When a product is planned for long production cycle. It is important to note parameters like lead time, availability, long-term support. Every MCU manufacturer will let you know when they will stop supplying the IC. You have to choose the Microcontroller accordingly otherwise you have to stop production after a couple of years and again invest in development.
- Development Kit and Support
- It is always advisable to get a development board from the supplier to help you develop and test the software before your hardware is built. This will ensure the first four points are correctly chosen. Even support from the supplier can cost you money, so it advisable to make sure you have a proper deal with the MCU Supplier.
- Compilers and Tools
- Compilers, Debuggers and other tools may cost you separate money due to license. Make sure you consider this while selecting the MCU.
Other Indirect Cost Involved in Selecting a MCU
- Power Consumption
- Heat Sink Requirement
- Space on PCB
- Other passive and active support components
- PCB Assembly Cost
|Tech||Cost||Time to Initial Run||Time to Performance||Time to change code|
|ASIC||Very High||Very Long||Very Long||Impossible|
|Generic||Low-Medium||Very Short||Not Attainable||Very Short|