Low cost embedded system


Published on

Explains how target board is designed using 8051 microcontroller

Published in: Technology, Business
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Low cost embedded system

  1. 1. AT89C52 based Low Cost Target board for Embedded System Design Environment DS Rao Head, ECE Department Swami Vivekananda Institute of Technology (Mahbub College Campus),Patny Center, Sec’bad
  2. 2. Embedded Systems AT89C52 based Low Cost Target board for Embedded System Design Environment DS Rao Head, ECE Department Swami Vivekananda Institute of Technology (Mahbub College Campus),Patny Center, Sec’bad
  3. 3. <ul><li>An embedded system is </li></ul><ul><li>an electronic/electro-mechanical system designed to perform </li></ul><ul><li>a specific function </li></ul><ul><li>and is </li></ul><ul><li>a combination of </li></ul><ul><li>both hardware and firmware (software) </li></ul>What is an Embedded System ?
  4. 4. <ul><li>Any computer that </li></ul><ul><li>pretends not to be a computer </li></ul><ul><li>is an embedded system. </li></ul>What is an Embedded System ?
  5. 5. General purpose system vs Embedded System <ul><li>A system which is a combination of a generic hardware and a General purpose Operating System for executing a variety of applications </li></ul><ul><li>A system which is a combination of special purpose hardware and embedded OS for executing a specific set of applications. </li></ul>
  6. 6. General purpose system vs Embedded System <ul><li>Contains a General Purpose Operating System (GPOS) </li></ul><ul><li>May or may not contain an Operating System for functioning </li></ul>
  7. 7. General purpose system vs Embedded System <ul><li>Applications are alterable (programmable) by the user ( it is possible for the end user to re-install the operating system, and also add or remove user applications) </li></ul><ul><li>The firmware of the embedded system is pre-programmed and it is non-alterable by the end-user (There may be exceptions for systems supporting OS kernel image flashing through special hardware settings) </li></ul>
  8. 8. General purpose system vs Embedded System <ul><li>Performance is the key deciding factor in the selection of the system. Always , ‘faster is better’. </li></ul><ul><li>Application-specific requirements (like performance , power requirements , memory usage , etc.) are the key deciding factors. </li></ul>
  9. 9. General purpose system vs Embedded System <ul><li>Less/not at all tailored towards reducing operating power requirements, options for different levels of power management. </li></ul><ul><li>Highly tailored to take advantage of the power saving modes supported by the hardware and the operating system </li></ul>
  10. 10. General purpose system vs Embedded System <ul><li>Response requirements are not time-critical </li></ul><ul><li>For certain category of embedded systems like mission critical systems, the response time requirement is highly critical </li></ul>
  11. 11. General purpose system vs Embedded System <ul><li>Need not be deterministic </li></ul><ul><li>Execution behaviour is deterministic for certain types of embedded systems like “Hard Real Time “ systems. </li></ul>
  12. 12. Applications of Embedded Systems <ul><li>Camcorders, Cameras, Television, DVD players, washing machines, refrigerators, microwave ovens, air conditioners, sprinklers, intruder detection alarms, cctv cameras, fire alarms, anti-lock breaking systems, engine control, ignition systems, automatic navigation systems, cellular telephones, telephone switches, handset multimedia applications, printers, scanners, fax machines, network routers, switches, hubs, firewalls, scanners, EEG, ECG machines, digital multimeters, digital CROs, logic analyzers, PLC systems, Automatic Teller Machines (ATMs) , currency counters, point of sales (PoS, Barcode , smart card readers, hand held devices etc… </li></ul>
  13. 13. What do Embedded Systems do ? <ul><li>Data collection / Storage / Representation </li></ul><ul><li>Data Communication </li></ul><ul><li>Data (signal) processing </li></ul><ul><li>Monitoring </li></ul><ul><li>Control </li></ul><ul><li>Application specific user interface </li></ul>
  14. 14. Operational Quality Attributes <ul><li>Response : measure of quickness of the system. </li></ul><ul><li>Throughput : Efficiency of a system </li></ul><ul><li>Reliability : Mean Time between failure (MTBF) and Mean Time to Repair (MTTR) </li></ul><ul><li>Maintainability : to end user on technical issues </li></ul><ul><li>Security : Confidentiality, Integrity, Availability </li></ul><ul><li>Safety : No possible damage to users of the system. </li></ul>
  15. 15. Non operational Quality Attributes <ul><li>Test ability and debug ability </li></ul><ul><li>Evolvability </li></ul><ul><li>Portability </li></ul><ul><li>Time to prototype and market </li></ul><ul><li>Per unit and total cost </li></ul>
  16. 16. Factors to be considered in selecting a controller <ul><li>Feature set : Does the microcontroller support all the peripherals required by the application ? Serial interface , parallel interface etc. Does it satisfy the general I/O port requirements by the application ? Does the controller support sufficient number of timers and counters ? Does the controller provide the required performance ? </li></ul>
  17. 17. Factors to be considered in selecting a controller <ul><li>2. Speed of operation : Speed in MIPS is critical. </li></ul><ul><li>3. Code Memory Space : Sufficient for a C code ? Hex code ? </li></ul><ul><li>Data Memory Space : On chip RAM to hold run time variables and data structures. </li></ul><ul><li>Development support : Does the controller manufacturer provide cost-effective development tools ? Does the manufacturer provide product samples for prototyping and sample development stuffs to reduce development pains. Third party development tool support provided ?Tech support when needed ? </li></ul><ul><li>Availability </li></ul><ul><li>Power Consumption </li></ul><ul><li>Cost </li></ul>
  18. 18. Why 8051 Microcontroller ? <ul><li>Powerful Boolean processor that supports bit manipulation instructions for real time industrial control applications. </li></ul><ul><li>Supports 6 interrupts (2 external, 2 timer and 2 serial interrupts) </li></ul><ul><li>Two 16 bit timer / counters </li></ul><ul><li>32 I/O lines </li></ul><ul><li>Programmable full duple serial interface </li></ul><ul><li>Interrupts have two priority levels and each interrupt is allocated fixed 8 bytes of code memory. This is a very efficient feature in real time applications. </li></ul><ul><li>Though INTEL invented it, it is now available from 20 vendors with more than 100 variants of the original flavour. </li></ul><ul><li>It supports CAN, USB, SPI and TCP/IP interfaces </li></ul><ul><li>Integrated ADC/DAC , LDC controller </li></ul><ul><li>Extended number of I/O ports </li></ul><ul><li>Remarkably low cost </li></ul>
  19. 19. Communication Interfaces <ul><li>Essential for communicating with various subsystems of the embedded system and with the external world. </li></ul><ul><li>Device / Board level communication interface (onboard communication interface) : Serial interfaces like I2C, SPI, UART, 1-Wire etc. </li></ul><ul><li>Product level communication interface (External communication interface) : </li></ul><ul><li>Infrared (IR), Bluetooth (BT), Wireles LAN (Wi-Fi), Radio Frequency waves (RF), GPRS are for wireless interfaces. </li></ul><ul><li>RS-232C/RS-422/RS-485 , USB, Ethernet IEEE 1394 port , parallel port, CF-II interface, SDIO, PCMCIA etc are examples of wired interfaces. </li></ul>
  20. 20. I2C Bus
  21. 21. Inter IC Bus <ul><li>In idle state , SDA and SCL lines switch to HIGH IMPEDANCE state </li></ul><ul><li>Both bus lines should be pulled up to Vcc ( TTL : 5V, CMOS: 3.3V) </li></ul><ul><li>Master device pulls the clock line (SCL) of the bus to HIGH </li></ul><ul><li>Master device pulls the data line (SDA) to LOW, when the SCL line is at logic HIGH (this is start condition of data transfer). </li></ul><ul><li>Master device sends address of slave device over SDA line. Clock pulses are generated at the SCL for synchronisation. MSB of the data is always transmitted first. Data in the bus is VALID during the HIGH period of the clock signal. </li></ul><ul><li>Master device sends the Read (= 1) or Write (=0) as applicable. </li></ul><ul><li>Master device waits for acknowledgement bit (=1) from slave device on SDA line. </li></ul><ul><li>Master device then sends the 8 bit data to the slave device over SDA line, if the requested operation is Write to device. If the requested operation is Read from device, the slave device sends data to the master over the SDA line. </li></ul><ul><li>The Master device waits for the acknowledgement bit from the device upon byte transfer complete for a write operation and sends an acknowledge to the slave device for read operation. </li></ul><ul><li>The Master device terminates the transfer by pulling the SDA line HIGH when the clock line SCL is at logic HIGH (indicating STOP condition) </li></ul><ul><li>I2C Supports 3 data rates : Standard mode ( up to 100kbps), Fast mode (up to 400kbps) and High speed mode ( up to 3.4Mbps) </li></ul>
  22. 22. Serial Peripheral Interface - SPI Bus
  23. 23. Serial Peripheral Interface (SPI) Bus <ul><li>This is a synchronous bi-directional full duplex four wire serial interface bus. </li></ul><ul><li>Introduced by Motorola. </li></ul><ul><li>Single Master multi-slave system. </li></ul><ul><li>Possible to have a a system with more than one master provided only one master is ACTIVE at a time. </li></ul><ul><li>Four signal lines (MOSI, MISO, SCL, SS) are required. </li></ul><ul><li>Master device is responsible for generating the clock signal. </li></ul><ul><li>Master selects slave by asserting slave’s SS to LOW. </li></ul><ul><li>MISO of all slave devices floats to HIGH IMPEDANCE when NOT selected. </li></ul><ul><li>Serial data transmission is fully configurable through programmable registers. </li></ul><ul><li>SPI registers hold key information like Master/Slave selection of the device, baud rate , clock signal control. </li></ul><ul><li>SPI works on the principle of shift register. </li></ul><ul><li>During transmission, data in Master’s shift register is shifted out to the MOSI pin and it enters the shift register of the slave device through the MOSI pin of the slave device. </li></ul><ul><li>At the same time the shifted out data bit from the slave device’s shift register enters the shift register of the AMster device through MISO pin. </li></ul><ul><li>The shift registers of Master and Slave for a circular buffer. </li></ul><ul><li>The decision on whether the LSB/MSB of data needs to be sent out first is configurable through configuration register. </li></ul>
  24. 24. <ul><li>Provide a low cost target board (8051 based). </li></ul><ul><li>Provide free tools that handle all the design challenges </li></ul><ul><li>Provide basics that make migration to branded tools easier </li></ul><ul><li>Provide the knowledge bank to design, test, produce and repair the entire system without any outside help . </li></ul>Objectives
  25. 25. <ul><li>Doing the most work with a given amount of processing power </li></ul><ul><li>Practise optimizing the code for a given amount of CPU power </li></ul><ul><li>Design applications that meet performance specifications </li></ul><ul><li>Develop a feel for where performance issues will cause problems </li></ul><ul><li>Learn to write great code by starting with the fundamentals , that is, understanding how the machine operates </li></ul><ul><li>Understand how typical CPUs execute machine-level code and how compilers translate high-level source statements into machine instructions </li></ul><ul><li>Begin thinking in low-level terms but write high-level code </li></ul>Considerations
  26. 26. <ul><li>Embedded-system development tools </li></ul><ul><ul><ul><li>Editors </li></ul></ul></ul><ul><ul><ul><li>Assemblers </li></ul></ul></ul><ul><ul><ul><li>Compilers </li></ul></ul></ul><ul><ul><ul><li>Debuggers </li></ul></ul></ul><ul><ul><ul><li>Simulators </li></ul></ul></ul><ul><ul><ul><li>Emulators </li></ul></ul></ul><ul><ul><ul><li>Flash/OTP programmers </li></ul></ul></ul>
  27. 27. <ul><li>To the newcomer to embedded system development it is often not clear how all of these different components play together in the development cycle. </li></ul>
  28. 29. <ul><li>The Development tool-kit consists of the following : </li></ul><ul><ul><ul><li>Target Board : AT89C52 based Single Board Computer (SBC) </li></ul></ul></ul><ul><ul><ul><li>SDCC (cross-compiler) 8051 Tools (Windows version) </li></ul></ul></ul><ul><ul><ul><li>Host Computer with Windows ‘98 or above </li></ul></ul></ul>
  29. 31. <ul><li>Target Board Configuration and Schematic : </li></ul><ul><ul><ul><li>AT89C52 – Microcontroller with Flash ROM </li></ul></ul></ul><ul><ul><ul><li>MAX232A – RS232 interface </li></ul></ul></ul><ul><ul><ul><li>LM7805 – 3-pin +5 V regulator </li></ul></ul></ul><ul><ul><ul><li>6264 - RAM </li></ul></ul></ul><ul><ul><ul><li>74158 - Decoder </li></ul></ul></ul><ul><ul><ul><li>74373 - Buffer </li></ul></ul></ul><ul><ul><ul><li>82C55A – Programmable Peripheral Interface </li></ul></ul></ul>
  30. 32. <ul><li>AT89C52 SBC features : </li></ul><ul><ul><ul><li>easy to use </li></ul></ul></ul><ul><ul><ul><li>low cost </li></ul></ul></ul><ul><ul><ul><li>Free monitor program ( Paulmon) </li></ul></ul></ul><ul><ul><ul><li>No expensive EPROM programmers or emulators </li></ul></ul></ul><ul><ul><ul><li>no other equipment except serial cable and power supply adaptor. </li></ul></ul></ul>
  31. 33. <ul><li>PAULMON Monitor (Features) : </li></ul><ul><li>Simple menu-based system that enables us to download code on to the board. </li></ul><ul><li>PAULMON has easy to understand menus, prompts, and most functions use a sequence of single keystroke commands. </li></ul><ul><li>All functions have plenty of on-screen feedback , which makes learning the system quick and easy. </li></ul><ul><li>PAULMON provides many features aside from program download, such as a full-screen memory editor, disassembler, and a simple single-step execution mode. </li></ul><ul><li>A strong advantage of PAULMON is that the source code is available for free . </li></ul><ul><li>We can use code from PAULMON in the project, without any restrictions . </li></ul><ul><li>Because we have complete access to the code, there are no hidden secrets , and we can use its code and techniques in your own programs. </li></ul><ul><li>This helps in a clear understanding of the code and development of monitor program </li></ul>
  32. 34. <ul><li>The circuit board should be assembled in three steps. </li></ul><ul><li>1. Minimal Hardware To Boot . </li></ul><ul><li>2. Add RAM For Downloading Programs. </li></ul><ul><li>3. Add Peripheral Components . </li></ul>1. Minimal Hardware to Boot 2. Add RAM for program download 3. Add Peripheral components
  33. 35. <ul><li>Testing </li></ul><ul><li>Step #1 </li></ul><ul><li>Connect the serial port to a COM port on a standard PC computer. </li></ul><ul><li>Run HyperTerminal. </li></ul><ul><li>The terminal program should be set to a slow baud rate, such as 1200 baud, 8 bits, no parity, 1 stop bit, no flow control . </li></ul><ul><li>Connect an 8-12 volt power supply to the board. </li></ul><ul><li>The voltage must be between 4.5 to 5.5. </li></ul><ul><li>Once the terminal program is running, turn on the power to the board. </li></ul><ul><li>One or two random characters may appear on the computer's terminal window as the power is turned on. </li></ul><ul><li>PAULMON waits for you to send a carriage return character after the power is turned on (so it can detect your baud rate setting). </li></ul><ul><li>Press Enter and you should receive the PAULMON2 welcome message: </li></ul><ul><ul><li>Welcome to PAULMON2 </li></ul></ul>
  34. 36. <ul><li>Testing </li></ul><ul><li>Step #2 </li></ul><ul><li>To test the RAM, download the Test Program 1 </li></ul><ul><li>From the PAULMON menu, press &quot;D&quot; to begin the download. </li></ul><ul><li>PAULMON will respond Begin ascii transfer of Intel hex file, or ESC to abort. Then you must send the ex1_2.obj file to PAULMON2. </li></ul><ul><li>Most terminal emulation programs call this ASCII Upload or some similar name. The text that appears on the screen should look like this: </li></ul><ul><ul><ul><li>PAULMON2 Loc:2000 > Download </li></ul></ul></ul><ul><ul><ul><li>Begin ascii transfer of Intel hex file, or ESC to abort </li></ul></ul></ul><ul><ul><ul><li>................................. </li></ul></ul></ul><ul><ul><ul><li>Download completed </li></ul></ul></ul><ul><ul><ul><li>Summary: </li></ul></ul></ul><ul><ul><ul><li>33 lines received </li></ul></ul></ul><ul><ul><ul><li>505 bytes received </li></ul></ul></ul><ul><ul><ul><li>505 bytes written </li></ul></ul></ul><ul><ul><ul><li>No errors detected </li></ul></ul></ul>
  35. 37. <ul><li>Testing </li></ul><ul><li>Step #3 </li></ul><ul><li>To test the 82C55 chip, download the </li></ul><ul><ul><li>LED Blink Test Program. </li></ul></ul><ul><li>Completed Board </li></ul><ul><li>After all of the components are added, the board appears The additional space provided with pad-per-hole area can be used to add other circuits. </li></ul>
  36. 38. <ul><li>At the PC, the programmer can write his program using an editor and compile the C source with a compiler, such as the SDCC. The output of the compiler can be an object file in the Intel hex format. </li></ul><ul><li>Use the download command of the monitor program to transfer the object code from the PC to the data/program RAM space (say 2000H), if this space is common to data and program, the monitor program can place the object code received to the space as if they are data. </li></ul><ul><li>From the PC hyper terminal, issue a run command to execute the code from the address location of the testing program. </li></ul><ul><li>The advantage of using this monitor program approach is that there is no extra hardware needed, you only need a SBC, a serial cable and a PC. </li></ul>Development Cycle
  37. 39. Conclusions <ul><li>23 boards were made and used in rugged conditions by students in the lab </li></ul><ul><li>The main objective “to allow students a free and unbridled access to the target board” was achieved. </li></ul><ul><li>Maintenance costs minimal. </li></ul><ul><li>Speedy repair of faulty boards because of experience gained while making the boards in-house thereby removing the delays that are caused when such kits are purchased from vendors. </li></ul><ul><li>A number of programming exercises that were specifically aimed at improving the C programming skills on the microcontroller environment have been successfully attempted by the students in the lab. </li></ul><ul><li>Because of its low cost, students are even encouraged to take the boards to their residence and work on design problems on their home systems. </li></ul>
  38. 40. Recommendation <ul><li>If students are exposed to the various phases </li></ul><ul><li>of design and development of electronic systems, </li></ul><ul><li>it will help in understanding </li></ul><ul><li>the difficulties, challenges and thrills </li></ul><ul><li>that are involved in such a process. </li></ul><ul><li>An understanding of practical challenges in the field </li></ul><ul><li>at an early stage </li></ul><ul><li>will help turn out engineers who are more inclined </li></ul><ul><li>towards design and development in the field of electronics. </li></ul>
  40. 42. Key Players in Embedded Technology Industry <ul><li>Analog Devices : Provider of world class DSP chips </li></ul><ul><li>Xilinx : Supplier of High performance FPGAs , CPLDs and specific IP cores </li></ul><ul><li>Atmel : Cost effective high-density Flash controllers and memories. Supplies ARM, AVR and 80C51 </li></ul><ul><li>Maxim/Dallas: World class analog , digital and mixed signal products, RF components etc. </li></ul><ul><li>Nxp : Supplier of 8/16/32 Flash microcontrollers. </li></ul><ul><li>Renesas : Provider of high speed microcontrollers and LSI technology. </li></ul><ul><li>Texas Instruments : Microcontrollers, DSP </li></ul><ul><li>Fujitsu : Fingerprint sensors, Graphic Display controllers, GPS </li></ul><ul><li>NEC : High performance microcontrollers </li></ul>
  41. 43. Tools and Platform providers in the Industry <ul><li>ENEA : OSE Real Time operating system. </li></ul><ul><li>MathWorks : MATLAB and SUMULINK </li></ul><ul><li>Keil Software: Keil Microvision is a powerful embedded software design tool </li></ul><ul><li>Lauterbach : World’s number one supplier of debug tools </li></ul><ul><li>ARTiSAN : Collaborative modelling tools </li></ul><ul><li>Microsoft: WindowsCE is apowerful RTOS platform </li></ul>
  42. 44. What more ? <ul><li>What are the bottlenecks in the industry today ? </li></ul><ul><li>What are the design trends that will take us into the future ? </li></ul><ul><li>Emerging trends. </li></ul><ul><li>A passing note on……….. </li></ul><ul><li>ASICS </li></ul><ul><li>Configurable FPGAs </li></ul><ul><li>Reconfigurable FPGAs </li></ul>
  43. 45. Thank You DS Rao Head - ECE Department Swami Vivekananda Institute of Technology (Mahbub College Campus),Patny Center, Sec’bad