Embedded Systems Basics

Embedded system Introduction : Introduction to Embedded System, History, Design challenges, optimizing design metrics, time to market, applications of embedded systems and recent trends in embedded systems, embedded design concepts and definitions, memory management, hardware and software design and testing, communication protocols like SPI, SCI, I2C, CAN etc

An embedded system can be defined as the computing device that has computer hardware, either with software embedded in it as one of its most important component. It may be an independent system or a part of a larger system. The emergence of embedded systems is a recent development. As a scientific discipline it resembles the state of microelectronics (and VLSI design, in particular) around 1980. Today’s challenge is similar to back then, except that the stakes are probably higher. Embedded systems will appear in virtually all devices, and intelligent devices have the tendency to oust their “stupid” counterparts from the market place, just like CD players have ousted gramophone players. Thanks to developments in microelectronics, the computing power of the desktop computers is now becoming available on the palmtops. Embedded systems are heterogeneous. Since they are mixtures of hardware and software, trade-off is important design decisions: do we realize a function in hardware or in software? But embedded systems are more heterogeneous than just combining computer science and digital electronics. This paper presents an overview of existing modes of Embedded Systems, architecture & their application. A look has also been given to future deployment of Embedded Systems. Nearly 99% of the processors manufactured end up in embedded systems. Embedded systems find applications in every industrial segment. Embedded systems can be categorized as stand-alone systems, realtime systems, networked information appliances & mobile devices. Just in the 10 years, such changes have occurred more rapidly that they see more revolutionaries than evolutionary. As these systems have brought about radical changes in Electronics and Computer, they have also begun to impact other human activities.

An embedded system is some combination of computer hardware and software, either fixed in capability or programmable, that is specifically designed for a particular kind of application device. Hardware and software that forms a component of some larger system and is expected to function without human intervention. Typically an embedded system consists of a single-board microcomputer with software in ROM, which starts running a dedicated application as soon as power is turned on and does not stop until power is turned off. An embedded system is any device controlled by instructions stored on a chip. These devices are usually controlled by a microprocessor that executes the instructions stored on a Read Only Memory (ROM) chip. Here an example of a chip “PIC” is shown.

cope with unusual conditions without human intervention. on the order of $1 • Low speed. but again. the existence of the processor & the software could be completely unnoticed by a user of the device. and recently 64-bit architecture • Large memory size.2 / BASIC OF EMBEDDED SYSTEMS WITH RECENT CONTROLLERS An embedded system is pre-programmed to perform a dedicated or narrow range of functions as part of a larger system. on the order of 10 KHz – 20 MHz • Low Power. 32-bit. these programmable devices or systems are generally used to perform. enough for the type of application intended for Microprocessors • A Microprocessor is fundamentally a collection of on/off switches laid out over silicon in order to perform computations • Characteristics of a Microprocessor • High cost. anywhere between $20 . extremely low power in sleep mode • Small architecture. In fact a general computer system is made up of numerous embedded systems. The term ‘embedded’ implies that these chips are an integral part of the system. but usually enough for the type of application it is intended for. Broadly speaking. usually an 8-bit architecture • Small memory size. Embedded systems have several things to do at once–respond to several Events at once. control or monitor processes. environments. used to control devices • It has all the memory and I/O it needs on board • Is not expandable – no external bus interface • Characteristics of a Microcontroller • Low cost. onboard flash and cache. If an embedded system is designed well. with an external bus interface for greater memory usage . Microcontrollers A Microcontroller is essentially a small and self-sufficient computer on a chip. • Limited I/O. usually with minimal enduser or operator intervention. machinery. lots of heat • Large architecture. equipment and communications tasks. while being subjected to a deadline. Onboard Flash.$200 or more! • High speed. on the order of 100 MHz – 4 GHz • High Power consumption.

They take inputs. it allows for using a single. when at the same time using a Von-Neumann Architecture to access external memory CATEGORIES OF EMBEDDED SYSTEM 2.2. the inputs are from sensors that convert a physical entity such as temperature or pressure into its equivalent electrical signal. process them & produce the desired output. For example. stand-alone systems work in stand-alone mode. & there is a delay of a milliseconds in executing the command. sequential memory.Consider a system that has to open a valve within 30 milliseconds when the humidity crosses a particular threshold. consumer electronic items etc. The input can be electrical signal from transducers or commands from a human being such as pressing of a button. the CPU can either be fetching an instruction from memory. 2. an LED or LCD display for displaying of information to the users. On the other hand. automobiles.EMBEDDED SYSTEMS BASIC / 3 • Lots of I/O and peripherals. The output can be electrical signals to drive another system. If the valve is not opened within 30 milliseconds. and we employ a very fast but small amount of memory (cache) local to the processor • Modern processors employ a Harvard Architecture to read from two instruction and data caches. the CPU can read both an instruction and data from the respective memory banks at the same time • This inherent independence increases the throughput of the machine by enabling it to always prefetch the next instruction • The cost of such a system is complexity in hardware • Commonly used in DSPs Von-Neumann Machine • A Von-Neumann Machine. Real-time Systems Embedded Systems in which some specific work has to be done in specific time period are called realtime systems. though Microprocessors tend to be short on General purpose I/O Harvard Architecture • Harvard Architecture refers to a memory structure where the processor is connected to two different memory banks via two sets of buses • This is to provide the processor with two distinct data paths. but this delay won’t lead to a serious implication. Such systems with strict deadline are called hard real-time systems. a catastrophe may occur. if we consider a DVD player and we give some command from a remote control. Embedded Systems used in process control. one for instruction and one for data • Through this scheme.1 Stand-alone Embedded Systems As the name implies. . in contrast to the Harvard Architecture provides one data path (bus) for both instruction and data • As a result. fall into this category in a process control system. or read/writing data to it • Other than less complexity of hardware. These electrical signals are processed by the system and the appropriate electrical signals are produced. Such systems are called as soft real-time systems. • Today’s processing speeds vastly outpace memory access times.

The operating system runs above the hardware and the application software run above the operating system. The door-lock of your home can be a small-embedded system with TCP/IP and HTTP server software running on it. For applications involving complex processing. The monitoring can be done using a web browser such as the Internet Explorer. These systems have emerged in recent years.4 / BASIC OF EMBEDDED SYSTEMS WITH RECENT CONTROLLERS 2. It is not compulsory to have an operating system in every embedded system. This hardware also contains memory chips onto which software is loaded. there is no need for an operating system. For small appliances such as remote control units. The CPU instruction set includes instructions for data transfer operations. The software residing on the memory chip is called the firmware. the software will continue to run for a long time & you don’t need to reload the new software. Fig. typically a network running TCP/IP (Transmission Control Protocol/ Internet protocol) protocol suite.. When your children stand in front of the door-lock after they return from school. such as the Internet or the Company’s Intranet. Here are some examples of such systems:A networked process control system consists of a number of embedded systems connected as a LAN. The embedded system architecture can be represented as a layered architecture as shown in fig-4. Once the software is transferred to the memory chip. you need to integrate the application software with the operating system & then transfer entire software into a memory chip.3 Network Information Appliances Embedded systems that are provided with network interfaces & accessed by networks such as Local Area Network or the Internet are called networked information appliances. stack . air conditioner. Each embedded system can send real-time data to a central location from where entire process control system can be monitored. ALU operations. it is advisable to have an operating system. 3 : Network Information Appliances OVERVIEW OF ARCHITECTURE EMBEDDED SYSTEM Every embedded system consists of custom – built hardware built around a Central Processing Unit (CPU). toys etc. In such a case. the web camera in the door-lock will send an alert to your desktop over the Internet and then you can open the doorlock just by clicking the mouse. Such embedded systems are connected to a network. BUILDING BLOCK OF HARDWARE OF AN EMBEDDED SYSTEM Central Processing Unit (CPU) The CPU is a unit that centrally fetches & processes a set of general-purpose instructions.

. ADC etc.EMBEDDED SYSTEMS BASIC / 5 operations. Program flow Control Unit (CU) 2. A processor is mostly in the form of an IC chip. Multiprocessor system using General Purpose processors (GPPS) & Application Specific Instruction Processors (ASIPs) 4. 1. halt. The generalpurpose instruction set is always specific to a specific CPU. BLOCK DIAGRAM OF COMPONENT OF ES HARDWARE Processor A processor is the heart of the embedded system. A processor has two essential units: 1. interrupt.It is an 8-bit processor. which is a 16-bit processor. microprocessors are more powerful. Another is Intel 8086 or 8088. there will be many other components such as memory. General Purpose Processor (GPP): a) Microprocessor b) Microcontroller c) Embedded processor d) Digital signals processor (DSP) e) Media Processor 2. Core means a part of the functional circuit on the VLSI chip. The CPU can be of the following:• Microcontroller. say. Its main attraction is that on the chip itself. Execution Unit (EU) The CU includes a fetch unit for fetching instruction from the memory. For an embedded system designer. DSP is mainly used for applications in which signal processing is involved. The EU includes the Arithmetic and Logical Unit (ALU) and also the circuits that execute instructions for a program control tasks. GPP core(s) or ASIP core (s) integrated into either an Application Specific Integrated Circuit Circuit (ASIC) or a Very Large Scale Integrated Circuit (VLSI) circuit or an FPGA core integrated with processor unit(s) in a VLSI (ASIC) chip. Processors runs the cycle of fetch and execute the instruction defined in the processor instruction set are executing in the sequence that they are fetched from the memory. One example of an older generation Microprocessor is Intel 8085. Application Specific System Processor (ASSP) As Additional Processor 3. It can also execute instructions for a call or branch to another program and for a call to a function. input &output operations & program control. The EU has circuits that implement the instructions pertaining to data transfer operation & data conversion from one form to another. sequencing & supervising operations. Processor in the System An embedded system processor chip or Core can be one of the following. or jump to another set of instructions. microprocessor or Digital Signal Processor (DSP). on the other hand. • A micro-controller is a low-cost processor. alternatively it could be in core form in an ASIC or at a Soc. knowledge of microprocessors & Microcontrollers is a prerequisite. but you need to use many external computers with them.

2) Once the board & input/output interfaces are designed for a GPP. transducers. the program is transferred to RAM and program is executed. depending on its application. developers have to keep the below specialties in mind: . Microprocessor A microprocessor is a single VLSI chip that has a CPU &may also have some other units (for eg: floating-point processing arithmetic unit. the firmware is stored in the ROM. APPLICATION-SPECIFIC CIRCUITRY Sensors. A small Liquid Crystal Display (LCD)may also be used to display some important parameters. 3) Ready availability of a compiler Facilitates embedded software development in high level language. COMMUNICATION INTERFACES The embedded systems may need to interact with other embedded systems or they may have to transmit data to a desktop. SPECIALITY OF EMBEDDED SYSTEM While designing the embedded systems. Many embedded system uses in process control do not have any I/P device for user interaction. There will be keyboard or a mouse. Some embedded systems will have a few Light Emitting Diodes to indicate the health status of the system modules. & hence interacting with the embedded system is no easy task. The circuitry interacts with the processor to carry out the necessary work. these Can be used for a new system by just changing the embedded software in the Board ROM. pipelining & super-scaling units) that are additionally present & that result in faster processing of instructions. special processing & control circuitry may be required for an embedded system. A keypad may be used to I/ P only the digits. they take I/Ps from sensors or transducers & produce electrical signals. Input devices Unlike the desktops. When the power is switched on. Many embedded systems will have a small keypad-you press one key to give a specific command. the CPU reads the ROM. the I/P devices to an embedded system have very limited capability.6 / BASIC OF EMBEDDED SYSTEMS WITH RECENT CONTROLLERS A General Purpose Processor is used because of the following 1) Processing by the known instructions available at redefined general-purpose instruction set result in fast system development. Output devices The output devices of the embedded systems also have very limited capability. Memory The memory is categorized as Random Access Memory (RAM) and Read Only Memory (ROM). 4) Ready availability of a well tested & Debugged processor specific APIs & the Codes previously designed for other Applications results in fast development of new system. So. The contents of RAM will be erased if power is switched off.

The size and the weight (i. 16. The amount is calculated by a firmware.2 POWER CONSUMPTION Most of the embedded systems operate through a battery. 5. 4. & microprocessors are available to cater to the different market segments . if you can telecom operator will change the algorithm for the calculation of the bill amount.” The system meets such deadlines. embedded software development is no longer ‘rocket science’. an embedded system is used which displays the amount to be paid by a telephone user. a constraint can be: “if the temperature exceeds 40 degrees. it may be necessary its upgrade the software. For instance.1 PROCESSOR POWER The growing importance of embedded systems can be gauged by the availability of processors about 150 varieties of processors are available from around 50 semiconductor vendors. To reduce the battery drain & avoid frequent recharging of the battery. in a process control system. considering that a memory chip will have to replace in thousands of PCO. the power consumption of an embedded system has to be very low.e. However. This is very cumbersome.1 PERFORMANCE Many embedded systems have time constraints.EMBEDDED SYSTEMS BASIC / 7 4. Powerful 8-bit. based on the calling number & the duration of the call from time to time. By a careful analysis design. open a valve within 10 milliseconds.4 SIZE Size is certainly a factor for many embedded systems. missiles etc. in some cases.bit. cost may not be a very important factor. If the deadlines are missed. So. We do not like a mobile phone that has to be carried on our backs. & consumer electronic products. it may result in a catastrophe. because in such cases. the cost is of utmost importance. Suppose you have designed a toy in which the electronics will cost US$20. 4. Most of the embedded systems are written only in assembly language & hence writing. However. once the software is transferred to the embedded system. for an embedded system used in consumer electronics or office automation. 4. 4. At the PCO. debugging & maintaining the code were very difficult & time consuming. With the availability of powerful processors & advanced development tools. the broadband & wireless network. RECENT TRENDS IN EMBEDDED SYSTEM In old good days. the same software will run throughout its life. You can imagine the damage that can be done if such deadlines are not met in a safety system of a nuclear plant.3 COST For an embedded system used in safety applications of a nuclear plant or in a spacecraft.5 SOFTWARE UPGRADATION CAPABILITY Embedded systems are meant for a very specific task. every inch & every grain matters. Consider the example of a Public Call Office (PCO). developing embedded systems was confined to very specialists. compactness) are the important parameters in embedded systems used in aircraft. 32bit and 64-bit micro controllers.

As a result. due to the availability of cross-compilers.11b wireless LAN & infrared. Wireless Application Protocol (WAP) development tools facilitate easy development of applications for mobile devices. In addition too many commercial embedded operating system open source software campaigned let to development of many open source operating system.2 Mobile Devices Mobile devices such as mobile phones. 5. Very powerful digital signal processors are also available for real time analyses of audio and video signals. Personal Digital Assistants. The limitations of the mobile devices-memory constraints. If real time performance is require a real time operating system can be used. Development tools such as BREW (Binary Routine Environment for wireless). 802. a very of operating systems are available which can be ported on to the embedded system. 5. display etc.4 Communication Interfaces and Networking Capability With the availability of low-cost chips. small size. System Application Specific Circuit Program & Data Memory . Network enabling of an embedded system has many advantages: it can be accessed over a network for remote control or monitoring. The software can be developed in a high level language such as “C”. debugging & testing as well as for modeling the embedded systems is Output Interfacing/Driver now paving way for the fast development of robust & reliable sysCircuit tems. The attraction of open source software is that it is free & also the complete source code is available to customize the software as per your application needs. the object-oriented languages like C++ & Java are now catching up. Hence mobile devices are considered as embedded systems. However.5 Programming Languages: Development of embedded system was done mostly in assembly languages. most of the development is now done in high-level languages such as C. Processor Timer Serial Communication ports 5.6 Development Tools Interrupt Controller Parallel port Availability of a number of tools for development. 5. smart phones etc. the power of desktop computers is now available on palm tops. So time to market the system gets reduced. are a special category of an embedded system. The advantage of embedding an operating system is that the software development will be very fast & marinating the code is very easy. embedded systems can be provided networking capability through communication interfaces such as Ethernet. Though the PDA does many general-purpose tasks. Reset & Oscillator Circuit 5. are same as those found in the embedded systems. they need to be designed just like the conventional embedded systems. Input Device Interfacing/Driver Circuit Power supply.3 Operating Systems Unlike the desktop on which the options for an operating system are limited.8 / BASIC OF EMBEDDED SYSTEMS WITH RECENT CONTROLLERS the clock speed & memory addressing capability of these processors are also increasing.

7 Programmable Hardware PLDs& FPGA pave the way for reducing the components on an embedded system. It is very powerful embedded system that provides voice communication while we are on the move.3 Medical Electronics Almost every medical equipment in the hospital is an embedded system. APPLICATION AREAS In today’s world the electronic devices have been dominated.2 Industrial Automation Today a lot of industries use embedded systems for process control. remote controls for TV & air conditioner etc.1 Consumer Appliances At home we use a number of embedded systems that include digital camera. digital diary. peripherals & application-specific circuitry. military and so on. routers. After developing the prototype of an embedded system. microwave. sugar.4 Computer Networking Computer networking products such as bridges.& data communication. navigation etc. The embedded system market is one of the highest growth areas as these systems are used in very market segment. These include pharmaceutical. spark control. television. FPGA can be developed having all the functionality of the processors. oil exploration. DVD player. & so on. microwave oven. current etc. cement. for mass production. The embedded systems for industrial use are designed to carry out the specific task such as monitoring the temperature. music system. humidity.EMBEDDED SYSTEMS BASIC / 9 5. 6. Even wristwatches are now becoming embedded systems. office automation. The children need embedded systems to play smart video games & to operate automatic chocolate Vending machines! Young people need embedded systems to borrow smart cards from parents to see movies! Housewives need embedded system for smart Internet – compliant home appliances. EEG. biomedical engineering. voltage.5 Wireless Technologies Advances in mobile communications are paving way for many interesting applications using embedded systems. 6.consumer electronics. & then take appropriate action based on monitored levels to control other devices. nuclear energy. such as. pressure. wireless communication. leading to small. blood pressure measuring devices & X-ray scanners etc. 6. The mobile phone is one of the marvels of the last decade of the 20th century. Nearly 99% of the processors manufactured end up in embedded systems. . 6. Today’s high-tech car has about 20 embedded systems for transmission control. electronic toy. low-cost systems. This equipment’s include diagnostic aids such as ECG. 6. Asynchronous Transfer Mode & relay switches are the embedded systems that implement the necessary data communication protocols. electricity generation & transmission. Integrated Services Digital Networks (ISDN).

are all embedded systems. & by entering a four-digit pass code (PIN). The idea of a personal identification number (PIN) stored on a physical card being compared with the PIN entered when retrieving the money was developed by the British engineer James Good fellow in 1965.8 Finance Financial dealing through cash & cheques are now slowly paving way for transactions using smart cards and ATM (Automatic Teller Machine.In modern ATMs. protocol analyzer. temperature. Smart card. & also the information we transmit & store. 1967 by Barclays Bank. The world’s first ATM was developed by De la Rue & installed in Enfield Town in North London on June 27. voltage. customers identify themselves by using a plastic card with a magnetic stripe. There are ATMs that are . transfer money between their bank accounts or even buy postage stamps. Developing embedded systems for security applications is one of the most lucrative businesses nowadays. We need to project our homes and offices.6 Instrumentation Testing & measurement are the fundamental requirements in all scientific and engineering activities. has a small micro-controller and memory. of the size of a credit card. & it interacts with the smart card reader / ATM machine & acts as an electronic wallet.7 Security Security of persons and information has always been a major issue. The measuring equipment we use in laboratories to measure parameters such as weight. Many ATMs also allow people to deposit cash or cheques. current etc. 6.1 Automatic Teller Machine (ATM) ATM is an electronic device that allows a bank’s customers to make cash withdrawals and check their account balances without the need for a human teller.10 / BASIC OF EMBEDDED SYSTEMS WITH RECENT CONTROLLERS 6. which encodes the customer’s account number. radio communication test set etc. logic analyzer. SPECIAL APPLICATIONS 7. also expanded as Any Time Money) machine. Test equipment such as oscilloscope. are embedded systems built around powerful processors 6. If the PIN is entered incorrectly for several times in row then the ATM retains the card for a security purpose to avoid the use of card by an unauthorized user.

Single – functioned: the ES perform specific pre-defined task program repeatedly. Lots of consumer electronics have embedded CPU and thus became embedded systems. VCRs. 3. we analyze the embedded operating systems. In this presentation. point-of-sale devices.EMBEDDED SYSTEMS BASIC / 11 accessible to blind and visually impaired peoples. CPUs became cheap.2 Embedded System in a Shoe The microprocessor embedded in this Adidas running shoe calculates the pressure between the runner’s foot & the ground five million times per second & continuously changes the cushioning to match an adjustable comfort level. Another Definition Embedded system is application-oriented special computer system which is scalable on both software and hardware. Tightly constrained: ES have very tight constraints on design metrics. industrial robot control. Some report expects that the demand on embedded CPUs is 10 times as large as general purpose PC CPUs. With rapid development of IC design and manufacture. As applications of the embedded systems get more complex. 7. Windows CE and QNX. The majority of the Embedded Systems are deprived of the luxury of having more memory due to their compact size. These are types of ATMs whose keypads are equipped with Braille system. reliability. For example. The major embedded operating systems currently are Embedded LINUX. The computer controls a motor that lengthens & shortens a cable attached to a plastic cushioning element. volume. It can satisfy the strict requirement of functionality. Reactive and real time: Many ES must react to the changes to the environment time to time. There is more and more demand on the embedded system market. PDAs. embedded LINUX. cost. or even your toasters can be embedded system. the operating system support and development environment become crucial. cell phones. and power consumption of the particular application. They are characterized by • Less Memory • Small Size Embedded system has several common characteristics that distinguish such systems from other computing systems: 1. This is one of the great inventions. HISTORY OF EMBEDDED SYSTEM Design Challenges: Optimizing Design Metrics The embedded system designer must consider the following design parameters to optimize the design metrics as follows : . 2.

This is because. this parameter becomes more demanding. introducing an embedded system to the market place early can make a big difference in the system profitability. The duration for which the product is sold is called market window or product life and it is often measured in months. The revenue for an on time market entry is the area of the triangle labeled on-time and Time to market the revenue for a delayed entry product is the area of the product labeled Delayed.12 / BASIC OF EMBEDDED SYSTEMS WITH RECENT CONTROLLERS Design ↓ Metrics Performance Size Memory Size Weight NRE (Non Recurring Cost) Unit Cost Total Cost Reliability Power Flexibility Time to prototype Maintainability Correctness Safety Response time Time to market Testability Security trust and privacy ↓ Explanation Time to Market Time to market is time required to develop a system to a point that it can be released and sold to customer. Recent years. The fig shows the graph of product sales vs time. It clearly shows that on time entry of the product in the market gives more sale than the delayed entry. The revenue loss for a delayed entry is just the difference of these two triangles given by Revenue loss = Area of on-time triangle – Area of delayed triangle = ½ × H1 × 2W – ½ × H2 × (2W – D) .

Productivity is measured as the number of transistors that one designer can produce in one month. Increasing code size In 1992 the average code size was 16-64 KB.001 1881 Fig: Trend in IC Technology 5. REUSE OF SOFTWARE AND HARDWARE COMPONENTS The reuse of software and hardware and software components is initiated to reduce the time to market 4. Improvement in IC Technology The present trends in the embedded system are directed by the trend in IC technology.000 0. Increasing Integration and system Complexity To performance levels today trend is to increase integration and system complexity by integration of RF. Increase in productivity Because of proper design procedures and knowledge base there is a lot of improvement in the designer productivity over the past several decades. 1883 2009 . MEMORY MANAGEMENT Hardware and Software Design and Testing Communication Protocols 12 C (Inter-IC) – Two-wires serial bus protocol developed by Philips Semicondutors nearly 20 years ago. 3. The coding style is also changed from hand assembly coding to HLL languages. 32 bit processors and IO processors 10. In 1996 it was increased up to 64KB – 512KB.EMBEDDED SYSTEMS BASIC / 13 Recent (Present) trends in embedded systems 1. DSP. Network interfaces. The IC transistor capacity has doubled roughly every 18 months for the past several decades and this trend is still going on as follows: 2.

This means that more than one IC capable of initiating a data transfer can be connected to it. SDA is the Serial DAta line.4 Mbits/s and 10-bit addressing in fast-mode – Common devices capable of interfacing to I2 C bus: • EPROMS. Consequently. The I2C bus is a multi-master bus. Obviously. Every device hooked up to the bus has its own unique address. an LCD driver is only a receiver. no matter whether it is an MCU. and SCL is the Serial Clock line. all the other ICs are regarded to be Bus Slaves. depending on the functionality.14 / BASIC OF EMBEDDED SYSTEMS WITH RECENT CONTROLLERS – Enables peripheral ICs to communicating using simple communication hardware – Data transfer rates up to 100 kbits/s and 7-bitd addressing possible in normal mode – 3. 1. The I2C protocol specification states that the IC that initiates a data transfer on the bus is considered the Bus Master. Flash. while a memory or I/O chip can be both transmitter and receiver. THE I2C BUS PROTOCOL The I2C bus physically consists of 2 active wires and a ground connection. watchdog timers. . are both bi-directional. or ASIC. and some RAM memory. at that time. and microcontrollers. The active wires. Each of these chips can act as a receiver and/or transmitter. called SDA and SCL. real-time clocks. LCD driver. memory.

click here for information on how to receive data from a slave). This is a signal that the bus has been released and that the connected ICs may expect another transmission to start any moment. These are all unique conditions on the bus. along with an indication whether the access is a Read or Write operation (Write in our example). When all is done. the MCU will issue the STOP condition. SPI (Serial Peripheral Interface Bus) The serial peripheral interface bus or SPI has is a synchronous serial data link standard named by Motorola that operates in full duplex mode. Having received the address. nSS. SI – Serial Data In • SDO. First. In our case. DATA . DO. let’s take a look at a general ‘inter-IC chat’ on the bus. Before we take a closer look at these bus conditions we need to understand a bit about the physical structure and hardware of the bus. Slave Output (output from slave) • SS—Slave Select (active low. If the address matches. all IC’s will compare it with their own address. it can start transmitting or receiving DATA. Slave Injput (output from master) • MISO/SOMI–Master Input. 2. however. contrasting with three. • SCLK— Serial Clock (output from master) • MOSI/SIOM—Master Output. Once the MCU receives the acknowledge. Slave Transmit Enable (active low. DI. Sometimes SPI is called a “four wire” serial bus. ACKNOWLEDGE. output from master) .EMBEDDED SYSTEMS BASIC / 15 As bus masters are generally microcontrollers. SO – Serial Data Out • nCS. ADDRESS. CS. This acts as an ‘Attention’ signal to all of the connected devices. We have had several states on the bus in our example: START. and one wire serial buses. All ICs on the bus will listen to the bus for incoming data. the MCU will issue a START condition. they simply wait until the bus is released by the stop condition (see below). Then the MCU sends the ADDRESS of the device it wants to access. The SPI bus specifies four logic signals. If it doesn’t match. Multiple slave devices are allowed with individual slave select (chip select) lines. Devices communicate in master/sieve mode where the master device initial the data frame. STE — Chip Select. the MCU will transmit data. two. Lets consider the following setup and assume the MCU wants to send data to one of its slaves (also see here for more information. STOP. output from master) Alternative naming conventions are also widely used: • SCK–Serial Clock (output from master) • SDI. the chip will produce a response called the ACKNOWLEDGE signal.

the lack of device addressing means less overhead. Figure 1 shows these signals in a single-slave configuration. SPI devices communicate using a master-slave relationship. data are always transferred in both directions. In fact. SPI interfaces are available on popular communication processors such as the MPC8260 and microcontrollers such as the M68HC11. master data output. Another is data transfer from analog-to-digital converters. MOSI carries data from master to slave. So a device must discard the received byte in a “transmit only” frame or generate a dummy byte for a “receive only” Figure 1: Single master. as far as SPI is concerned. slave data input (MOSI). But SPI is better suited than I2C for applications that are naturally thought of as data streams (as opposed to reading and writing addressed locations in a slave device). But SPI tends to be simpler and more efficient than I2C in point-to-point (single master.16 / BASIC OF EMBEDDED SYSTEMS WITH RECENT CONTROLLERS The SDI/SDO (DI/DO. It is a synchronous serial data link that operates in full duplex (signals carrying data go in both directions simultaneously). SPI specifies four signals: clock (SCLK). SI/SO) convention requires that SDO on the master be connected to SDI on the slave. and vice-versa. and slave select (ÇSS). such as the communication between a “codec” (coder-decoder) and a digital signal processor. These relationships are illustrated in Figure 2. A slave device is selected when the master asserts its ÇSS signal. slave data output (MISO). I2C Both SPI and I2C provide good support for communication with slow peripheral devices that are accessed intermittently. the master generates a separate slave select signal for each slave. If multiple slave devices exist. Devices communicate using a master/slave relationship. . SCLK is generated by the master and input to all slaves. Due to its lack of built-in device addressing. single slave SPI implementation frame. SPI-compatible interfaces often range into the tens of megahertz. SPI can also achieve significantly higher data rates than I2C. When the master generates a clock and selects a slave device. SPI requires more effort and more hardware resources than I2C when more than one slave is involved. in which the master initiates the data frame. Inside the box SPI is a serial bus standard established by Motorola and supported in silicon products from various manufacturers. single slave) applications for the very same reason. SPI vs. It is up to the master and slave devices to know whether a received byte is meaningful or not. EPROM’s and real-time clocks are examples of such devices. MISO carries data from slave back to master. master data input. An example of a “stream” application is data communication between microprocessors or digital signal processors. which consists of simultaneously sending samples in and out. data may be transferred in either or both directions simultaneously. SPI really gains efficiency in applications that take advantage of its duplex capability.

If multiple slaves are used that are fixed in different configurations. SPI also offers no flow control. a higher-level protocol is not needed and only raw data are exchanged. You have to time it relative to the other signals and ensure. the master will have to reconfigure itself each time it needs to communicate with a different slave. Note that the master must initiate the frames for both its command and the slave’s response. However. So a master/slave pair must use the same parameter pair values to communicate. A pair of parameters called clock polarity (CPOL) and clock phase (CPHA) determines the edges of the clock signal on which the data are driven and sampled. which allows for four possible combinations. you might need to do something outside of SPI. In fact. it’s complicated and usually unnecessary. may be necessary. so it’s not often done. without a communication protocol. such as a command-response protocol. Both SPI and I2C offer good support for communication with low-speed devices. some SPI devices support additional signals that make such implementations possible. An example of this is an interface to a simple codec. that you don’t toggle a select line in the middle of a frame. This consists of old-fashioned bit banging and can be pretty sensitive. a higherlevel protocol. While SPI doesn’t describe a specific way to implement multi-master systems. In other applications. Slaves can be thought of as input/output devices of the master. Each of the two parameters has two possible states.EMBEDDED SYSTEMS BASIC / 17 Figure 2: Single master. At a Higher Level SPI does not have an acknowledgement mechanism to confirm receipt of data. In some applications. If you need hardware flow control. but SPI is better suited to applications in which devices transfer data streams. the SPI master has no knowledge of whether a slave even exists. all of which are incompatible with one another. SPI does not specify a particular higherlevel protocol for master-slave dialog. . for example. multiple slave SPI implementation The master generates slave select signals using general-purpose discrete input/output pins or other logic.

high performance. It can also serve as a platform on which to create higher-level protocols.g. These requirements include a high level of error detection. extremely simple and efficient for single master. Communications may occur at a maximum recommended rate of 1 Mbit/sec (roughly a 40 meter bus length). ‘0’ = recessive if single data wire used • Bus guarantees dominant singal prevails over recessive signal if asserted simultaneously – Applications now using CAN include: • Elevator controllers. single slave applications. low latency times and configuration flexibility. telescopes. The CAN protocol specifies versatile message identifiers that can be mapped to specific control information categories.” SPI is often an elegant solution for modest communication needs. a standard communications protocol simplifies and economizes the task of interfacing subsystems from various vendors onto a common network. and medical instruments CONTROLLER AREA NETWORK (CAN) PROTOCOL The Controller Area Network (CAN) protocol. and the complexity only grows as the number of slaves increases. due to its lack of built-in addressing. Far from being just a dumb “byte port. On the other hand. The CAN protocol provides four primary benefits 1. copies. – Originally for communication among components of cars – Data transfer rates upto 1 Mbit/s and 11-bit addressing – Common devices interfacing with CAN • 8051-compatible 8592 processor and standalone CAN controllers – Actual physical design of CAN bus not specified in protocol • Requires devices to transmit/detect dominant and recessive signals to/from bus • e. in most cases. ‘1’ = dominant. First. and the availability of various CAN protocol implementations.18 / BASIC OF EMBEDDED SYSTEMS WITH RECENT CONTROLLERS SPI’s full duplex communication capability and data rates (ranging up to several megabits per second) make it. it can be troublesome to implement for more than one slave. CAN (Controller Area Network) – Protocol for real-time applications – Carried out over a twisted pair of wires – Developed by Robert Bosch GmbH to enable the communication among various elecgronics components of cars as an alternative to expensive and cumbersome wiring harness. offers a comprehensive solution to managing communication between multiple CPUs. In-vehicle networking protocols must satisfy unique requirements not present in other networking protocols such as those found in telecommunications and data processing. production-line control systems. developed by ROBERT BOSCH GmbH. . The protocol has found wide acceptance in automotive in-vehicle applications as well as many nonautomotive due to its low cost.

provide a high level of data integrity. as a standard protocol. industrial control and entertainment sector. CAN greatly reduce wire harness size and eliminates point-to-point wiring. The Intel 82526 was the first implementation of the CAN protocol. and accident avoidance systems require the exchange of particular performance and position information within a defined communications latency. The engine transmits engine speed and acceleration parameters to the transmission to allow smoother shifting. prioritized messages of length 8 bytes or less are sent on a serial bus. anti-lock braking. or Carrier Sense Multiple Access by Collision Detection using Arbitration protocol. environmental equipment and communications. as a multiplexed network. CAN is a CSMA/CD-A. Products using CAN Version 2. has been successfully implemented in passenger car. provides greater message handling capability and implements a more flexible interface to CPUs.0.EMBEDDED SYSTEMS BASIC / 19 2.0. transmission. Lastly. in production since 1989. the embedded systems technology. CAN have broad market appeal which motivates semiconductor makers to develop competitively priced CAN devices. 4. 3. Through a multi-master architecture. Sub-systems such as the engine. The previous CAN specification. and the impact of the technology on various markets. The range of embedded system is vast and includes all industrial and commercial sectors. Second. the hostCPU has more time to run its system tasks. Embedded systems are rapidly becoming a catalyst for change in the computing. which features an extended frame” with a 29. In broad terms embedded systems are programmable devices or systems which are generally used to control or monitor things like processes machinery. Version 2. Error detection mechanisms. They perform control. such as a 15-bit Cyclical Redundancy Check (CRC). The objective of this study is to enlighten readers about the application of embedded systems. data communication. Perhaps the transmission requests the engine to reduce fuel injection before a gear change. Thus embedded systems contain programmed instruction running via processor chips. SUMMARY An embedded system is closely integrated with the main system It may not interact directly with the environment. protection and monitoring tasks.2. An example of an application well-served by the CAN protocol is automotive networking because many modules are inter-dependent. CAN Version 2. please read the CAN Specification.0. broadens the application base for this protocol by allowing J1850 message schemes to be mapped into the CAN message format. . Third. The SAE CLASS C passenger car subcommittee is currently evaluating CAN. train and factory automation applications since 1989. the communications burden is shifted from the host-CPU to an intelligent peripheral.0 are already in production. Note: For information on the CAN protocol. which is a candidate for its high speed networks. telecommunications.bit message identifier.0 protocol was chosen by the SAE Truck & Bus Control and communications Network Subcommittee of the Truck & Bus Electrical Committee to support its ‘Recommended Practice for Serial Control and Communications Vehicle Network CLASS C” called the SAE J1939 specification. The Intel 82527 is a follow-on to the 82526 which implements CAN Version 2. Version 1. The CAN 2.

Sign up to vote on this title
UsefulNot useful