Embedded Control Systems Design/Processors

Processor technology involves the architecture of the computation engine used to implement a system’s desired functionality. All devices we know have processors embedded in it (microwave, cars ...). Choosing the right embedded processor is critical to perform the wanted operations.

=Trends= Nowadays hardware is more and more like software. It can easily be programmed and integrated with other components by an end-user. One simple example is a FPGA which has many more components than it should have so in that way it can be programmed for various applications. It can also be used as an interface for the communication of several hardware components, for instance the integration of a DSP and a hybrid CPU on a mobile phone chip.

Another important trend is a modular design. This means that hardware components are designed as separate parts and can be put together in one device. In this way the device is only programmed for the control and communication of the different components. This has the following advantages:


 * Components can easily be replaced when broken
 * Adding new functions (upgrading) is very simple
 * A small step towards standardization

In the domain of mechatronics standardization is not yet that common. Electronics however is some kind of a pioneer because we can find there many examples of standardization: VHDL, standard components like adders, multiplexers, registers, memory … One simple example here is National Instruments. As time evolves this standardization will also be needed in the mechanical world.

Specific branches
In automotive there is a trend towards centralization. This is because designers have noticed in the past that there were too many parts that required their own controller. So now they are trying to use as few as possible CPU’s. The design is thus more and more focused on the communication busses between the several components which are controlled by only a few CPU’s.

In aviation the requirements are very different. First of all safety is very important. In this way standardization and certification becomes very important. One simple example is the fact that in aviation they only use certified hardware. They still use a Pentium II because this is proven technology.

=Choice of hardware= When one reached the moment at which a choice has to be made about the processor technology, one can choose between 5 categories of processors, each with its own advantages and disadvantages:
 * General purpose processor: usable for several applications, low price, short design time but low performance, high energy consumption and large dimensions
 * Single purpose processor: good performance, small, less energy consumption but more difficult design, more expensive, less flexible
 * ASIP: intermediate solution between single and general purpose processor
 * PLD: low design cost, fast product development, available in large numbers but more energy consumption than ASIP. Some examples are: PLA, FPGA
 * PLC: usable in several working conditions, more standardised but not suited for complex calculations, relative expensive

Besides the choice of processor the designer also has to look for the right communication and storage technology. One example of robust storage technology are solid state hard disks. They are resistant against vibrations, magnetic fields and dirt so they can be used in several working conditions. Examples of communication technology are given by USB, Firewire, CAN-Bus, Ethernet ...

Processor technology involves the architecture of the computation engine used to implement a system’s desired functionality. Most devices we know have processors embedded in it (microwave, cars…). Choosing the right embedded processor is critical to perform the wanted operations. The choice of a processor in a design process can take place on 2 moments. Either you choose a processor in the beginning of the design when you only had a peak on your specifications, this means that throughout the next stages of your design you will need to adapt the wanted functionalities to the processor possibilities. This is the case for instance when you have a fixed budget for the processor, choose the one with the highest possibilities which fits the budget. Or you make the decision at the end of the project, so you know all the necessary functions you want to implement and you can choose a processor type which fits your situation exactly. If possible you must always choose the processor which you have the most experience with to minimise design time and avoid problems. Minimising design time equals less design cost and faster time-to-market.

First we will make an overview of some terms and concepts you should keep in mind when choosing a processor. Then we will look at the different types of processor technology available for the moment and take a peak at the available processors today. And in a third part of this chapter we’ll discuss the programmable logic controller (PLC).

In the text there will be references to interesting articles,sites and links where you can find a clear explanation and a broader view about the subject. In the text they are shown as numbers which refer to a site shown in the reference list. A list of all the references is at the bottom of this chapter.

=Terms, questions=

Performance/speed of a processor
This means the number of clock cycles per second. It determines the number of instructions performed each second. If your processor demands more than processortechnologie can offer, a single processor will not do it anymore. Then it's time to think of a dual-core processor. This will not only double the computational load, but provides flexibility in how software is architedted across the cores, which can even result in reducing power consumption versus a single core running at twice the frequency.

compatible
All hardware selected should be able to communicate with each other. The environment in which the processor has to work can be damaging, so precautions must be taken to avoid unexpected failures.
 * electronic compatibility
 * environmental compatibility
 * Connection is realised by busses

Input/Output
For this you should take a look in Hardware Peripherals

fixed-point/ floating-point device
These are 2 categories of processor computation arithmetic. In general:

Fixed-point:
 * faster
 * more power-conscious
 * cost-sensitive

Floating-point: refers to the granularity with which a fraction can be defined refers to the ratio between the largest and smallest numbers that can be represented in a numeric format
 * high precision
 * dynamic range

memory

 * Cache: Is used by the processor to reduce the time needed to communicate with the (main) memory.
 * Memory address
 * RAM (random access memory)
 * ROM (read only memory)

Are my system needs changing in time
Example: changes for user interface features
 * Yes : then a programmable solution will probably required ( DSP, MCU, FPGA)
 * No : an ASIC might be suitable

life time
required lifetime depends on wanted lifetime of the system, willingness to replace the controller or desire to reuse the controller in other systems

how do I develop on the processor
If you use a good, easy development tool you will increase productivity and decrease development/debug time. This is also dependent of the experienced personnel you have (which are more expensive) and the experience your company has with certain processor types. Of course, when you use code that is written in a common known language it can be easily ported to a new processor and increases the possibility of expanding and rewriting the program.

power consumption
A device can get his power from the electric net or can work on a battery. This restriction (battery) usually involves a tradeoff between performance and power efficiency. Choosing a system with a battery we need to take in account the weight of the battery, time between recharge and safety.

Real-Time Aspects

 * Interrupts and interrupt vectors
 * Support for ‘atomic operations’ ~ mutex (=mutual exclusion) such as Test and Set and Compare and Swap
 * Granularity
 * Privilege levels and CPU modes
 * For the most common processortypes:
 * Microprocessor: When a microprocessor is selected together with an embedded operating system, the operating system is the cause of real-time operations not being straight-forward.
 * Microcontroller: Being a very simple microprocessor, real-time operations are difficult.
 * DSP: When real-time is important such as in signal processing (audio, video…) the DSP will perform the best.
 * FPGA: An FPGA can be configured in such a way that it performs completely like a microprocessor or completely like a DSP. So real-time performance is depending on whether a DSP-like configuration is chosen.
 * PLC: A PLC gets his input from the sensors, evaluates these and makes changes (output), thus it acts as a real-time system

operating system
An operating systems manages the system: managing and processing I/O, memory management, controlling simultaneous processes. If so, make sure your processor supports the OS you chose.

-> An interesting link with a longer explanation about some topics:

=types of processor technology= In this part we will discuss the general processor types, their characteristics and examples

Interesting links for choosing the right processortype for your application:

general purpose processor
The system designer only needs to program the processor’s memory to carry out the required functionality: software portion. These types are created to produce large numbers for a variety of applications

Here are some general characteristics from a general purpose processor:
 * Advantages:
 * easy to design and use (only programming the memory)
 * design time is thus low
 * design cost is thus low
 * reprogrammability (changing functionalities or improving a system becomes easy when you only need to change the program)
 * Disadvantages:
 * performance is not very good
 * size is high ( because they are built to be used in a variety of applications with different specifications and all these specifications must be possible on the processor)
 * they consume much power

Usually they are used to put in a product the first time it goes to the market, because of their cheap design cost and ease to use. Because of the use of code, a designer usually strives to minimize compiled code size, rather than maximize performance.


 * example:Microcontroller (MCU), Microprocessor

Basically a microprocessor performs all the tasks that must be accomplished by a microcontroller/embedded system. A general microprocessor consists of a bus unit which is a pathway to communicate with the (computer) memory, an instruction cache to keep track of instructions coming from the computer memory through the bus unit, a (pre)fetch unit copying instructions from the instruction cache for further processing, a decode unit getting instructions from the prefetch unit that will be converted to a binary code understood by the processor, a control unit that performs tasks or instructions which are comprised in the binary code coming from the decode unit, ‘data cache’ to save instructions or data, an ALU (arithmetic logic unit) that executes mathematic operations such as adding, multiplying…, and finally registers which are also some memory used by the ALU to store the results of performed operations. A microcontroller does not have a data bus or bus unit as described above for a general microprocessor. The reason is that there is no need to communicate to memory because memory is incorporated on the same chip as the microprocessor itself. A MCU is typically used as a systems controller, with many conditional operations and frequent changes in program flow. The MCU code is written in C or C++. There’s a wide variety of MCUs available: from 4-bit, 32 kHz models to 32-bit, 500 MHz devices, and beyond(The "-bit" designation refers to the width of a device's data bus, registers, execution units, etc.)

If you choose an embedded operating system (Windows, Linux, Dos...) a microprocessor is needed. But for real-time operations you better not use a microprocessor. The microcontroller is actually a low-end microprocessor, and is used in more simple tasks (traffic light to hold the light for a certain time...)

single purpose processor
This type of processor is designed to execute exactly one program. An embedded designer creates a single-purpose processor by designing a custom digital circuit Advantages and disadvantages are more or less the opposite of the general-purpose processor:
 * Advantages:
 * performance is very good
 * small size (exact to fit one solution)
 * they consume little power
 * Disadvantages:
 * not very easy to design and design time is thus high
 * design cost is thus higher
 * reprogramming is difficult
 * limited flexibility: not easy to make changes, accommodate features

In design we can make a difference between standard single-purpose processors and custom single-purpose processors (ASSP). The standard single-purpose processors (hardware peripherals) are explained in a different chapter Hardware Peripherals. They are used for in a wide variety of applications for the same task.


 * example: application-specific integrated circuit (ASIC),application-specific standard product (ASSP)

They are designed to fit the specific requirements of an end product. In the design process they will be optimised for both power and performance. An ASIC is introduced for a product usually after a product is stabilised on the market (with non-ASIC solution), because of the higher development time and cost. After the stabilisation the producer can look for extra margin by making the processor as good as possible for his application. A disadvantage is that when you make a mistake, you will need to make a whole new chip, but for a general-purpose processor you just change the code and recompile. You can use an ASIC in a stable market where technology and requirements aren't going to change rapidly.

application specific instruction-set processor (ASIP)
An ASIP is designed for a particular class of applications with common characteristics it’s an 'intermediate' solution between a general-purpose and a single-purpose processor and gives more flexibility than a single purpose processor and still better performance, power, size than a general purpose processor. Of course this leads to a longer design time (cost) and there's also a compiler problem, you will have to create your compiler usually yourself.

A DSP is optimized to efficiently perform repetitive and numerically intensive tasks such as matrix operations, convolution for filtering in real-time, because of the performance limitations of the MCUs. DSPs can run at very high clock rates, and they are often compared in terms of how many millions of MAC operations they can perform per second. This metric is known as "mega MACS," or MMACS.
 * example:Digital signal processor (DSP)

A DSP is optimized to do mathematical operations, but not for supervisory control. Thus, DSP-based systems are integrated with the slower MCUs, this can be done in 2 ways:
 * Discrete DSP + MCU (separate in the system)
 * Advantages:
 * design of DSP and MCU separate from each other
 * Disadvantages:
 * hard partitioning between control and DSP function, if there are too many instructions for the DSP, the MCU can’t take over
 * the DSP and MCU require different development tools
 * Convergent Processor (a convergent processor is optimized both for computation on real-time data flows, and for control-oriented tasks)
 * Advantages:
 * optimised for computation on real-time data flows as well as for control-oriented tasks
 * high clock rates
 * lower power dissipation
 * Disadvantages:
 * mixing a control application with signal processing on the same device, non-real-time tasks may interfere with time-critical tasks
 * the skills of developers must be higher

programmable logic device (PLD)
A processor exists of layers : the bottom layer are the transistors, if you connect the transistors you get logic gates and by connecting these you can make a circuit. In a PLD all layers already exist, the layers implement a programmable circuit, where programming has a lower-level meaning than a software program.

There are 2 types of Programmable Logic Device: Advantages of programmable logic devices over full-custom chips: There’s a large base of standard building-block libraries available for signal processing(fast development)  FPGAs like ASICS optimise hardware for a specific end product. They can also perform massively parallel computation (a MCU or DSP can’t). Because of their power consumption and cost, they shouldn’t be used in portable or cost-sensitive systems. The FPGA is able to talk to any external device thanks to it’s configurable nature. An ASIC can be created based on an FPGA implementation
 * simple PLD’s
 * Programmable Logic Array (PLA)
 * A PLA consists of a programmable array of AND gates and a programmable array of OR gates.
 * Programmable Array Logic (Pal)
 * A PAL consists of just one programmable array to reduce the number of expensive programmable components.
 * complex PLD’s
 * CPLD
 * A CPLD consists of ...[Fixme: definition]
 * field programmable gate array (FPGA)
 * A FPGA offers more general connectivity among blocks of logic, rather than just arrays of logic as with PLA’s and PAL’s, and are thus able to implement far more complex design.
 * low design cost (fast product development)
 * almost instant availability
 * Disadvantages
 * higher unit cost
 * bigger than ASICs
 * consume more power
 * example: FPGA

For more details, see Programmable Logic.

Trends for tomorrow

 * Multi core CPUs
 * Cell processor
 * GFX cards: With the increase in processing power available on these cards it becomes interesting to use them for more than just graphics processing alone.  They are especially good at parallel processing  and can be used as stream processors, they are then often referred to as GPGPUs. Currently only the NVIDIA CUDA and the ATI/AMD CTM systems are available.
 * Multi processor solutions: It is possible to use several different processors for controlling a system on different levels. For instance: microcontrollers can be used for low level local control, they can receive commands from a higher control level which might be implemented on an embedded cpu, which in turn can be reprogrammed with a general purpose cpu somewhere in a control room.

Manufacturers
The core business is automotive electronics systems. Melexis is also a manufacturer of fully protected microcontrollers with sensor compatible interfaces. The range of standard products involves among others microcontrollers and sensor IC’s. NXP delivers microcontrollers, integrated circuits and logic devices. Consultancy in embedded systems design. Coware is a company that focuses on ESL Electronic_system_level design of hard- and software of DSP systems. Easics is involved in the design of complete telecommunication products ASSP's Application specific standard product for telecommunication equipment manufacturers. The field of research and technology is broadband, embedded systems and wireless networks. The Atmel Corporation designs and manufactures advanced semiconductors, with focus on microcontrollers, nonvolatile memory, logic, radio frequency (RF) components and sensors. Microchip develops several microcontrollers under the name PIC for use in automotive applications, home appliances, thermal management, power management, etc. The company is also active in memory, radio frequency products and interfaces. MIPS offers a broad range of 32-bit and 64-bit processor cores for the worldwide embedded market. ARM develops  processors,  cache and SoC designs, application-specific standard products (ASSP's), related software and development tools. Renesas is a merger of the Hitachi and Mitsubishi semiconductor groups which develops the SuperH CPU cores, architecture and products (SuperH Texas Instruments offers a wide range of embedded processors, from the popular ultra-low power MSP430 to high speed DSPs. TI also specializes in analog and wireless solutions.
 * Melexis: http://www.melexis.be
 * NXP Semiconductors: http://www.nxp.com
 * Essentium: http://www.essentium.net
 * Coware: http://www.coware.com
 * Easics: http://www.easics.com/
 * Motorola : http://www.motorola.com
 * Atmel : http://www.atmel.com,
 * Microchip: http://www.microchip.com
 * MIPS_Technologies : http://www.mips.com
 * ARM Holdings: http://www.arm.com
 * Renesas: http://www.renesas.com
 * Texas Instruments : http://www.ti.com/

=Programmable Logic Controller (PLC)= The Programmable Logic Controller was born out of the need for a device which would eliminate the large cost involved in adjusting and replacing complicated relay based machine control systems. Programmable logic controllers are specialized industrial computers. The PLC is a real –time device: inputs from switches and sensors, evaluating these based on a program (logic) and changing the state of outputs to control a machine or process.

Advantages
A PLC is very simple in its use: programming, wiring, installation and changes are simple and quick. Another important feature of the PLC are its environmental possibilities: A PLC is designed for: A PLC exists not only out of a processor, but also the I/O arrangements: All PLCs contain six basic components:
 * Extended temperature ranges
 * Dirty or dusty conditions
 * Immunity to electrical noise
 * Resistance to vibration and impact
 * Processor or CPU
 * Rack or mounting
 * Input assembly (sensors can be analog or digital)
 * Output assembly
 * Power supply
 * Programming unit, device (PC)

PLC Program
The CPU executes a program. This logic can be written in Ladder Logic, Instruction List, Sequential Function Charts or any of the IEC languages. The program will be downloaded to the PLC.
 * Early PLC's: Ladder Logic
 * Recently IEC standard 61131-3 defines five languages
 * FBD (Function Block Diagram)
 * LD (Ladder Diagram)
 * ST (Structured Text)
 * IL (Instruction list)
 * SFC (Sequential Function Chart)

I/O capabilities
The main difference between a modern PLC and other processors are the I/O arrangements. These connect the PLC to sensors and actuators. Based on these arrangements PLC's can be divided into three groups: Modular, Rack and P2P. Modular PLC's have a limited number of connections built in for inputs and outputs (digital as well as analog). Expansions are available if the base model does not have enough I/O connections. Rack-style PLC's have processor modules with separate I/O modules which may occupy many racks. These often have thousands of discrete and analog inputs and outputs. Often a high speed serial I/O link is used so that racks can be remotely mounted from the processor, reducing the wiring costs for large plants. In larger I/O systems, PLC's may have P2P (peer to peer) communication between processors. This allows separate parts of a complex process to have individual control while allowing the subsystems to coordinate over the communication link.
 * Modular PLC's
 * Rack-style PLC's
 * P2P communication

Communication
The I/O modules can be located in the same rack of station. Communication then takes place within the rack or across the backplane. Backplane extension modules allow I/O modules to be located in racks or stations which are separated from the controller Modules can communicate with a controller over a network. Industrial networks are used to interconnect field level devices with controllers. ( FieldBus, ProfiBus and DeviceNet)
 * I/O-modules can communicate with a PLC's CPU by:
 * Backplane
 * Backplane extension
 * Device network
 * between PLCs:
 * serial communication
 * industrial communications network
 * industrial I/O network

disadvantages

 * it cannot handle complex situations
 * expensive, so it's not a good idea in mass-production
 * There's need for maintenance

-> A good reference for comparing a PLC with other types of processortechnology: ,

References to PLCs and programming ,,,,

Trends
To be able to handle more complex situations there is an evolution in the direction of the PC (PAC: programmable automation ) The boundary between PC and PLC is becoming less clear-cut. The languages also became more complex while evolving towards a more complex PLC.

-> An interesting link about its future and evolution towards PC: (in Dutch),

=Links and references=

by F. Vahid and T. D. Givargis by Rick Kuhlman by Joel Huebner by Kim Rowe by David Katz by Henk Capoen
 * Embedded Systems Design: A Unified Hardware/Software Introduction
 * http://www.embedded.com
 * Choosing the right industrial control and acquisition hardware: FPGA vs. PLC vs. custom hardware:
 * http://www.embedded.com/design/embeddedfpga/205204626?_requestid=475779                 [6]  [13]
 * http://www.industrialcontroldesignline.com/howto/204803436;jsessionid=HXS4CWE4VDV0YQSNDLOSKH0CJUNN2JVN     [5]
 * http://www.dspdesignline.com
 * Choices, choices, choices: choosing a correct processortype
 * http://www.smallformfactors.com/departments/fundamentals/2006/Winter/       [4]
 * How a microprocessor works:
 * http://www.intel.com/education/mpworks/ Intel education corner
 * http://computer.howstuffworks.com/microprocessor2.htm howstuffworks
 * Microprocessor Design
 * DSP system design: The basic laws: DSPs vs. FPGAs
 * http://www.dspdesignline.com/showArticle.jhtml;jsessionid=MQDAQJY5XYY5UQSNDLPCKH0CJUNN2JVN?articleID=206903789&queryText=dsp+system+design+basic+laws
 * http://www.dspdesignline.com/howto/206905097
 * Convergent processors solve development challenges
 * http://www.dspdesignline.com/howto/showArticle.jhtml?articleID=187203618    [2]
 * Introduction to the PLC:
 * http://www.plctutor.com/   [7]
 * http://www.plcs.net/contents.shtml Beginners PLC Primer    [8]
 * http://www.ccontrols.com/pdf/Extv4n2.pdf Interview with Dick Morley (pdf)   [9]
 * http://www.plcdev.com/plc_timeline Timeline of PLC History  [10]
 * http://mat.sourceforge.net Linux Open Source PLC project   [11]
 * Evolution and future of PLC(ppt)
 * http://www.regeltechnieken.org/PLC/Capoen-PLC.pdf future of PLC [12]