Cluster (Dashboard) Using S12HZ256 as a Single-Chip Solution



Similar documents
Software Real Time Clock Implementation on MC9S08LG32

How To Control A Motor Control On An Hvac Platform

Local Interconnect Network (LIN) Physical Interface

etpu Host Interface by:

IRTC Compensation and 1 Hz Clock Generation

Flexible Active Shutter Control Interface using the MC1323x

Blood Pressure Monitor Using Flexis QE128 Gabriel Sanchez RTAC Americas

3-Phase BLDC Motor Control with Hall Sensors Using 56800/E Digital Signal Controllers

Programming Audio Applications in the i.mx21 MC9328MX21

Understanding LCD Memory and Bus Bandwidth Requirements ColdFire, LCD, and Crossbar Switch

Initializing the TSEC Controller

Comparison of MC9S08QE128 and MCF51QE128 Microcontrollers Scott Pape and Eduardo Montanez Systems Engineering, Freescale Microcontroller Division

Real Time Development of MC Applications using the PC Master Software Visualization Tool. 1. Introduction. 2. Development of Motor Control.

Connecting Low-Cost External Electrodes to MED-EKG

Improving Embedded Software Test Effectiveness in Automotive Applications

PowerQUICC II Pro (MPC83xx) PCI Agent Initialization

Windows 7: Using USB TAP on a Classic CodeWarrior Installation (MGT V9.2 DSC V8.3)

Detecting a CPM Overload on the PowerQUICC II

Using XGATE to Implement LIN Communication on HCS12X Daniel Malik 8/16-Bit Products Division East Kilbride, Scotland

Handling Freescale Pressure Sensors

Using WinUSB in a Visual Studio Project with Freescale USB device controller

Emulated EEPROM Implementation in Dual Flash Architecture on MC9S08LG32 With Demo Description

How To Measure Power Of A Permanent Magnet Synchronous Motor

Point-of-Sale (POS) Users Guide Lech José Olmedo Guerrero Jaime Herrerro Gallardo RTAC Americas

Freescale Embedded GUI Converter Utility 2.0 Quick User Guide

Configuring the FlexTimer for Position and Speed Measurement with an Encoder

USB HID bootloader for the MC9S08JM60

Using eflexpwm Module for ADC Synchronization in MC56F82xx and MC56F84xx Family of Digital Signal Controllers

Performance Monitor on PowerQUICC II Pro Processors

3-Phase BLDC Motor Control with Hall Sensors Using the MC56F8013

MPC8245/MPC8241 Memory Clock Design Guidelines: Part 1

Using the Performance Monitor Unit on the e200z760n3 Power Architecture Core

Data Movement Between Big-Endian and Little-Endian Devices

Freescale Semiconductor. Integrated Silicon Pressure Sensor. On-Chip Signal Conditioned, Temperature Compensated and Calibrated MPX4080D.

MC13783 Buck and Boost Inductor Sizing

User Interface Design using CGI Programming and Boa Web Server on M5249C3 Board

How To Build A Project On An Eclipse Powerbook For Anarc (Powerbook) On An Ipa (Powerpoint) On A Microcontroller (Powerboard) On Microcontrollers (Powerstation) On Your Microcontroller 2 (Powerclock

Hardware Configurations for the i.mx Family USB Modules

Connecting to an SMTP Server Using the Freescale NanoSSL Client

How to Convert 3-Axis Directions and Swap X-Y Axis of Accelerometer Data within Android Driver by: Gang Chen Field Applications Engineer

Cyclic Redundant Checker Calculation on Power Architecture Technology and Comparison of Big-Endian Versus Little-Endian

Freescale Semiconductor, Inc. Product Brief Integrated Portable System Processor DragonBall ΤΜ

Installation of the MMA955xL CodeWarrior Service Pack Author: Fengyi Li Application Engineer

MCF54418 NAND Flash Controller

Freescale Semiconductor. Integrated Silicon Pressure Sensor. On-Chip Signal Conditioned, Temperature Compensated and Calibrated MPX5500.

Techniques and Tools for Software Analysis

BLDC Motor Control with Hall Effect Sensors Using the 9S08MP

Using the HC08 SCI Module

Implementing Positioning Algorithms Using Accelerometers

Using the Kinetis Security and Flash Protection Features

Freescale Variable Key Security Protocol Transmitter User s Guide by: Ioseph Martínez and Christian Michel Applications Engineering - RTAC Americas

Understanding Pressure and Pressure Measurement

How to Do EEPROM Emulation Using Double Flash Array on MC9S08LC60 Ronald Gonzalez and Tatiana Orofino RTAC Americas

Enhanced Serial Interface Mapping

Using Program Memory As Data Memory. 1. Introduction Program Memory and Data. Contents. Memory. Freescale Semiconductor Application Note

VGA Output using TV-Out Extension Solution i.mx21

PQ-MDS-T1 Module. HW Getting Started Guide. Contents. About This Document. Required Reading. Definitions, Acronyms, and Abbreviations

1 Introduction. Freescale Semiconductor Application Note. Document Number: AN3031 Rev. 1, 04/2010

AND8336. Design Examples of On Board Dual Supply Voltage Logic Translators. Prepared by: Jim Lepkowski ON Semiconductor.

How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player

Using the High Input Voltage Charger for Single Cell Li-Ion Batteries (KIT34671EPEVBE)

White Paper. Freescale s Embedded Hypervisor for QorIQ P4 Series Communications Platform

User Guide. Introduction. HCS12PLLCALUG/D Rev. 0, 12/2002. HCS12 PLL Component Calculator

DRM for Driver Information System on S12G128. Reference Design

SEMICONDUCTOR TECHNICAL DATA

Genesi Pegasos II Setup

Freescale Semiconductor, I

How To Improve Performance On A P4080 Processor

Generate Makefiles from Command Line Support in Eclipse-Based CodeWarrior Software

ColdFire Security SEC and Hardware Encryption Acceleration Overview

APPLICATION NOTE. Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor. Atmel AVR 8-bit Microcontrollers. Features.

Robust Over-the-Air Firmware Updates Using Program Flash Memory Swap on Kinetis Microcontrollers

Tire Pressure Monitoring Sensor Temperature Compensated and Calibrated, Fully Integrated, Digital Output

Microcontroller for Variable Speed BLDC Fan Control System. T.C. Lun System Engineer, Freescale Semiconductor, Inc.

LOW POWER NARROWBAND FM IF

NOT RECOMMENDED FOR NEW DESIGN

ULN2803A ULN2804A OCTAL PERIPHERAL DRIVER ARRAYS

Ref Parameters Symbol Conditions Min Typ Max Units. Standby μa. 3 Range kpa. 4 Resolution 0.15 kpa. 5 Accuracy -20ºC to 85ºC ±1 kpa

MSC8156 and MSC8157 PCI Express Performance

USB Thumb Drive. Designer Reference Manual. HCS12 Microcontrollers. freescale.com. DRM061 Rev. 0 9/2004

EMC6D103S. Fan Control Device with High Frequency PWM Support and Hardware Monitoring Features PRODUCT FEATURES ORDER NUMBERS: Data Brief

Processor Expert Software Microcontrollers Driver Suite Getting Started Guide

How To Fit A 2Mm Exposed Pad To A Dfn Package

NOT RECOMMENDED FOR NEW DESIGN

Getting Started with the Student Learning Kit Featuring the Freescale HCS12 Microcontroller Application Module

MC33064DM 5 UNDERVOLTAGE SENSING CIRCUIT

AN2680 Application note

KIT34845EPEVME Evaluation Board

White Paper Implementing a Flexible CPLD-Only Digital Dashboard for Automobiles

USB to SPI Interface Evaluation Board

56F800 Demonstration Board

76-77 GHz RF Transmitter Front-end for W-band Radar Applications

Hello and welcome to this training module for the STM32L4 Liquid Crystal Display (LCD) controller. This controller can be used in a wide range of

LC898300XA. Functions Automatic adjustment to the individual resonance frequency Automatic brake function Initial drive frequency adjustment function

1 Introduction. Freescale Semiconductor Application Note. AN3224 Rev. 0, 3/2006

Application Module Student Learning Kit Users Guide featuring the Freescale MC9S08QG8

Designing an Induction Cooker Using the S08PT Family

AND8433/D. Using ON Semiconductor Constant Current Regulator (CCR) Devices in AC Applications APPLICATION NOTE

Transcription:

Cluster (Dashboard) Using S12HZ256 as a Single-Chip Solution Designer Reference Manual HCS12 Microcontrollers DRM084 Rev. 0 10/2006 freescale.com

Cluster (Dashboard) Using S12HZ256 as a Single-Chip Solution Designer Reference Manual by: Kenny Lam 8/16-Bit Applications Engineering, APTSPG Freescale Semiconductor, Inc. To provide the most up-to-date information, the revision of our documents on the World Wide Web will be the most current. Your printed copy may be an earlier revision. To verify that you have the latest information available, refer to: http://www.freescale.com The following revision history table summarizes changes contained in this document. For your convenience, the page number designators have been linked to the appropriate location. Revision History Date Revision Level Description Page Number(s) October, 2006 0 Initial release N/A Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. This product incorporates SuperFlash technology licensed from SST. Freescale Semiconductor, Inc., 2006. All rights reserved. Freescale Semiconductor 3

Revision History 4 Freescale Semiconductor

Table of Contents Chapter 1 Introduction 1.1 Introduction................................................................. 7 1.2 System Overview............................................................. 8 Chapter 2 Benefits and Features of the 9S12HZ256 Controller 2.1 Introduction................................................................. 9 2.2 Basic Features............................................................... 9 2.3 Modes of Operation......................................................... 11 2.3.1 User Modes............................................................. 11 2.3.2 Low-Power Modes....................................................... 11 Chapter 3 Stepper Motor Drive Theory 3.1 Introduction................................................................ 13 3.2 Stepper Motor.............................................................. 13 3.3 Stepper Motor Control........................................................ 14 3.4 Stepper Motor Micro-Stepping Control........................................... 17 3.5 Stepper Stall Detection (SSD).................................................. 19 3.6 LCD Driver for LCD Display Panel............................................... 21 3.7 LCD2 Panel Initialization and Checking........................................... 22 3.8 LCD2 Panel Firmware (API)................................................... 23 Chapter 4 Software Integration 4.1 Introduction................................................................ 25 4.2 Micro-Stepping Control Using Internal Timer....................................... 25 4.3 Motor Running and LCD2 Panel Display Demonstration.............................. 27 4.4 Cluster System Demonstration................................................. 28 Chapter 5 Hardware Schematics Chapter 6 Bill of Materials Freescale Semiconductor 5

Table of Contents 6 Freescale Semiconductor

Chapter 1 Introduction 1.1 Introduction This manual describes the design of a cluster board (dashboard) using Freescale s S12HZ256 microcontroller unit (MCU). This is a single-chip design for the whole system. The traditional cluster board uses a cross coil motor to drive the analog pointers (actuator) which move either clockwise or counterclockwise to indicate the car speed, engine rotation speed, fuel level, engine temperature, etc. This technology is well established and widely used throughout the world. However, when the cross coil motor is being assembled, it requires an alignment process. The cross coil motor displacement linearity is also a drawback in regards to the displacement accuracy (linearity), as it may need motor fine tuning during cluster board manufacturing. In view of this, stepper motors can be one alterative solution in this application. In addition, the Moving Magnet Technology (MMT) is more mature for stepper motors nowadays. The following are some advantages in having the magnet of a stepper motor move relative to a stationary coil set. 1. The stationary drive coils are beneficial to a motor structure, as they can deal effectively with heat dissipation. 2. There are no flying leads since the coils are stationary which leads to improved longevity of the motor. 3. The weight of the stationary coils does not affect the maximum velocity of the motor. 4. There is no frictional wear out because the moving magnet concept does not make contact with any of the stationary elements of motor. For cluster applications in the automotive segment, Freescale offers the S12H family of devices which can support up to six stepper motors. These devices also include, as a single-chip solution, a 32 x 4 segment LCD driver to show time and mileage updates on a LCD panel. The designers have also integrated Stepper Stall Detection (SSD) in the new derivative of the S12HZ family. This derivative supports up to four stepper motors with SSD. This manual is based on the 9S12HZ256 features for designing a cluster application. NOTE This document is written for the user who is familiar with the S12H256 family and CodeWarrior for S12 and cluster applications. All hardware schematic diagrams and firmware source codes are available as reference materials. Freescale Semiconductor 7

Introduction 1.2 System Overview Figure 1-1 provides a pictorial overview of the system. 5V Vcc Vehicle Speed Engine RPM Engine Temp. Input Signal Cond n (as req d) I/C0 I/C1 ADC2 Vreg * PWM Gauge Drivers LCD DRIVER Batt. Voltage Fuel Level LM2902 MC33174 MC33184 TL064 ADC3 ADC4 I / O PWM SCI Keys LED RS232 ADC5 CAN MC9S12Hx 16 Bit MCU Integrated LCD Driver 32x4 (112 QFP package) Integrated Drive for 4 Stepper Motors With Motor Stall Detection (MSD) (16 hi-current PWM outputs) CAN Physical Interface Figure 1-1. S12HZ256 Dashboard System Easier PCB Routing Fewer Components Higher Reliability Cost Effective 8 Freescale Semiconductor

Chapter 2 Benefits and Features of the 9S12HZ256 Controller 2.1 Introduction As shown in this chapter, the S12HZ family of devices offers an excellent complement of peripherals and a broad range of memory and packages. 2.2 Basic Features Some of the S12HZ family benefits are shown below. Features have been broken down by type for your convenience. HCS12 Core: 16-bit HCS12 CPU Upward compatible with M68HC11 instruction set Interrupt stacking and programmer s model identical to M68HC11 20-bit ALU Instruction queue Enhanced indexed addressing Multiplexed external bus interface (MEBI) Module mapping control (MMC) Interrupt control (INT) Debugger and breakpoints (DBG) Background debug mode (BDM) Memory: 256K, 128K, 64K Flash EEPROM 2K, 1K byte EEPROM 12K, 6K, 4K byte RAM CRG: Low current oscillator Phase locked loop (PLL) Reset, clocks Computer operating properly (COP) watchdog Real time interrupt Clock monitor Freescale Semiconductor 9

Benefits and Features of the 9S12HZ256 Controller Analog-to-digital converter (ADC): 16 channels, 10-bit resolution External conversion trigger capability Two 1M bit per second, CAN 2.0 A, B software compatible modules: Five receive and three transmit buffers Flexible identifier filter programmable as 2 x 32 bit, 4 x 16 bit, or 8 x 8 bit Four separate interrupt channels for Rx, Tx, error, and wake-up Low-pass filter wake-up function Loop-back for self test operation Timer: 16-bit main counter with 7-bit prescaler Eight programmable input capture or output compare channels Two 8-bit or one 16-bit pulse accumulators Six PWM channels: Programmable period and duty cycle 8-bit 6-channel or 16-bit 3-channel Separate control for each pulse width and duty cycle Center-aligned or left-aligned outputs Programmable clock select logic with a wide range of frequencies Fast emergency shutdown input Serial interfaces: Two asynchronous serial communication interfaces (SCI) Synchronous serial peripheral interface (SPI) Inter-integrated circuit interface (IIC) Liquid crystal display driver with variable input voltage: Configurable for up to 32 frontplanes and 4 backplanes or general purpose input or output Five modes of operation allow for different display sizes to meet application requirements Unused frontplane and backplane pins can be used as general purpose input or output 16 high current drivers suited for PWM motor control: Each PWM channel switchable between two drivers in an H-bridge configuration Left, right, and center aligned outputs Support for sine and cosine drive Dithering Output slew rate control 10 Freescale Semiconductor

Modes of Operation Four stepper stall detectors (SSD): Full step control during return to zero Voltage selector and integrator/sigma delta converter circuit 16-bit accumulator register 16-bit modulus down counter 112-Pin LQFP and 80-Pin QFP packages: 85 I/O lines with 5-V input and drive capability 5-V A/D converter inputs Eight key wake up interrupts with digital filtering and programmable rising/falling edge trigger Operating speed: Operation at 50 MHz equivalent to 25 MHz bus speed Development support: Single-wire background debug mode (BDM) Debugger and on-chip hardware breakpoints 2.3 Modes of Operation 2.3.1 User Modes User modes include: Normal and emulation operating modes Normal single-chip mode Normal expanded wide mode Normal expanded narrow mode Emulation expanded wide mode Emulation expanded narrow mode Special operating modes Special single-chip mode with active background debug mode Special test mode (Freescale use only) Special peripheral mode (Freescale use only) 2.3.2 Low-Power Modes Low-power modes include: Stop mode Pseudo stop mode Wait mode Freescale Semiconductor 11

Benefits and Features of the 9S12HZ256 Controller 12 Freescale Semiconductor

Chapter 3 Stepper Motor Drive Theory 3.1 Introduction The stepper motor (MMT) is an excellent choice for cluster applications. This application employs high current drives suited for pulse width modulator (PWM) motor control, which supports sine and cosine drive, using the 9S12HZ256 device. Software running on the 9S12HZ256 device implements: Micro-stepping to achieve precise linear position Reduced noise Vibration during stepper motor running. 3.2 Stepper Motor In theory, although a micro-stepping controller offers hundreds of intermediate positions between steps, but it has some drawbacks. It is worth noting that micro-stepping does not generally offer great precision. This is because of both linearity problems and the effects of static friction. The utility of micro-stepping is limited by several considerations: 1. The angular precision achievable with micro-stepping will be limited if there is any static friction in the system. 2. It involves the non-sinusoidal character of the torque versus shaft-angle curves on real motors. Sometimes, this is attributed to the detent torque on permanent magnet and hybrid motors. But, in fact both detent torque and the shape of the torque versus angle curves are products of poorly understood aspects of motor geometry. Specifically the shapes of the teeth on the rotor and stator, these teeth are almost always rectangular. 3. Problems arise because most applications of micro-stepping involve digital control systems. Thus, the current through each motor winding is quantized, controlled by a digital-to-analog converter (PWM). Furthermore, if typical PWM current limiting circuitry is used, the current through each motor winding is not held perfectly constant, but rather, oscillates around the current control circuit's set point. As a result, the best a typical micro-stepping controller can do is approximate the desired currents through each motor winding. In view of these considerations, note that the drive stepper motor running smoothly in micro-stepping depends on the motor characteristics. The number of the steps in micro-stepping selection is also based on the stepper motor. We chose 24 micro-stepping / step in this reference design manual as an example. Freescale Semiconductor 13

Stepper Motor Drive Theory 3.3 Stepper Motor Control Figure 3-1 shows a 2-phase step motor control signal. This signal switches on and off in turn and is driven by an H-bridge as shown in Figure 3-2. CW A CCW /A B /B A Store trip Figure 3-1. 2-Phase Step Motor Control Signal Supply + /A - Phase A A Figure 3-2. H-Bridge 14 Freescale Semiconductor

Stepper Motor Control As shown in Figure 3-3, phase A and B are driven by a square wave to move the rotor. It can be locked at a desired position when the phase supply (square wave) stops to alter. Rotate + Gnd Vdd Phase B A - Phase A Vdd Gnd Figure 3-3. Basic Driving Circuit for Two Phase Step Motor In order to drive a moving stepper motor, the S12H family offers a simple instruction to control step movement. The example below, uses motor channel 0 to control the stepper motor moving forward. The phase supply sequences are as follows: Phase A B 0 1 0 0 1 0 void eat_time(int time) { while(time--!=0){} } //eat time void step_move() //step move { MCDC0H &=~0x80; //channel 0 (A = 0, /A = 1) Step 0 MCDC1H =0x80; //channel 1 (B = 1, /B = 0) eat_time(0x2000); //delay MCDC0H &=~0x80; //channel 0 (A = 0, /A = 1) Step 1 MCDC1H &=~0x80; //channel 1 (B = 0, /B = 1) eat_time(0x2000); //delay MCDC0H =0x80; //channel 0 (A = 1, /A = 0) Step 2 MCDC1H &=~0x80; //channel 1 (B = 0, /B = 1) eat_time(0x2000); //delay MCDC0H =0x80; //channel 0 (A = 1, /A = 0) Step 3 MCDC1H =0x80; //channel 1 (B = 1, /B = 0) eat_time(0x2000); //delay } Freescale Semiconductor 15

Stepper Motor Drive Theory Please refer to the firmware project (1. StepMove) for more detailed information. See Figure 3-4. Figure 3-4. StepMove Screen 16 Freescale Semiconductor

Stepper Motor Micro-Stepping Control 3.4 Stepper Motor Micro-Stepping Control The utility of micro-stepping is limited by at least three considerations. 1. Motor static friction 2. Non-sinusoidal character of the torque versus shaft-angle, each motor 3. Winding is quantized, controlled by a digital-to-analog converter (PWM) The most common control algorithm is adopted to use sinusoidal current to drive micro-stepping. One complete sinusoidal wave is equivalent to four steps in a 2-phase motor. Phase A is driven by a PWM as sinusoidal to move the rotor. It can also be locked at a desired position when the phase supply stops to alter. The stepper motor can be held by the supply current from the driver as static holding torque. Phase A and B are driven by a sinusoidal wave to move the rotor. It can be locked at a desired position when the phase supply (sinusoidal wave) stops to alter. To drive stepper motor moving, the S12H family can use a simple look-up table to implement a sinusoidal signal to drive micro-stepping movement. Refer to Figure 3-5 and Figure 3-6. CW CCW A /A B /B A S t Figure 3-5. Micro-Stepping Sinusoidal Control Freescale Semiconductor 17

Stepper Motor Drive Theory Store trip + /PWM PWM Phase Supply - Phase PWM /PWM A B Figure 3-6. Micro-Stepping Sinusoidal Control with PWM Please refer to the firmware project (2. MicroStepMove) for more detailed information. See Figure 3-7. Figure 3-7. MicroStepMove Screen 18 Freescale Semiconductor

3.5 Stepper Stall Detection (SSD) Stepper Stall Detection (SSD) This module provides a built-in circuit to detect the induced voltage on the non-driven coil of a stepper motor. The back EMF can be measured by an internal ADC module, which can integrate the induced voltage on the non-driven coil, and store its results to a16-bit accumulator register. The internal 16-bit modulus down counter can be used to monitor the blanking time and the integration time. The value in the 16-bit accumulator represents the change in linked flux. It can be compared to a stored threshold to distinguish whether the motor reaches the home position. Values above the threshold indicate a moving motor, in which case the pointer can be advanced another full step in the same direction and integration repeated. Values below the threshold indicate a stalled motor, home position is reached. See Figure 3-8. Advanced Motor Pointer Initialized SSD Start Blinking End of Start Blinking No Yes Start Integration End of Integration No Yes No Stall Detection Disabled SSD Figure 3-8. Stepper Stall Detection Flowchart Freescale Semiconductor 19

Stepper Motor Drive Theory Please refer to the firmware project (3. StepperStallDetection) for more detailed information. See Figure 3-9. Figure 3-9. StepperStallDetection Screen 20 Freescale Semiconductor

3.6 LCD Driver for LCD Display Panel LCD Driver for LCD Display Panel The S12HZ256 internal LCD driver module has 32 frontplane drivers and 4 backplane drivers. A maximum of 128 LCD segments are controllable. Each segment is controlled by a corresponding bit in the LCD RAM, located at address 0x120 0x137. Four multiplex modes (1/1, 1/2, 1/3, 1/4 duty) and three bias (1/1, 1/2, 1/3) methods are available. The voltage generator, connected to the VLCD pin, generates voltage levels for the timing and control logic to produce the frontplane and backplane waveforms. Please refer to InitLCD project. Please refer to the firmware project (4. InitLCD2) for more detailed information. See Figure 3-10 and Figure 3-12. Figure 3-10. InitLCD2 Screen Figure 3-11. Turn On All LCD Segments Freescale Semiconductor 21

Stepper Motor Drive Theory 3.7 LCD2 Panel Initialization and Checking In this reference design, the 4*18 segment LCD panel is selected. The LCD characters can be turned on/off by writing to the internal LCD registers, which are located at address 0x128 0x137. The LCD2.lib is also available for use. Users need to link to the LCD2.lib in their project. Please refer to the firmware project (5. LCD2DisplayCheck) for more detailed information. See Figure 3-12 and Figure 3-13. Figure 3-12. LCD2DisplayCheck Screen Figure 3-13. Verify LCD2 Segments and Their Connections 22 Freescale Semiconductor

3.8 LCD2 Panel Firmware (API) LCD2 Panel Firmware (API) Users can use the API to display clock and mileage in the LCD2 panel. Examples are shown in Figure 3-14 and Figure 3-15. Please refer to LCD2DisplayEx project. Please refer to the firmware project (6. LCD2DisplayEx) for more detailed information. Figure 3-14. LCD2DisplayEx Screen Figure 3-15. API Testing for LCD2 Freescale Semiconductor 23

Stepper Motor Drive Theory 24 Freescale Semiconductor

Chapter 4 Software Integration 4.1 Introduction The previous chapter explained several modules to drive individual application (stepper running in single step, micro-stepping control, LCD driver, motor stall detection, etc.). Now, we have to integrate those modules to implement a Cluster board application. It is a well-known fact that stepper motor vibration is commonly a drawback during motor running, although it only needs simple driving techniques. Thus, micro-stepping is a typical solution when a stepper motor is chosen in an application. In addition, we also need to overcome stepper motor inertia, which plays an important role in driving motor starting smoothly. 4.2 Micro-Stepping Control Using Internal Timer The gauge pointer is driven by a stepper motor, which can directly reflect how good the Cluster performance is. Thus, some control parameters may be beneficial when introduce in stepper motor control, such as acceleration and maximum velocity even in micro-stepping. The acceleration and maximum velocity parameters can be done by the S12HZ256 internal 16-bit timer module. In this reference design, the acceleration can be pre-calculated as a lookup table (StepProfileBase[]), which is stored in the internal Flash. It can also be retrieved from internal Flash to internal RAM for run time modification in different speed profiles. The maximum speed setting can also prevent the motor from running beyond the limit. Speed v = u + at Max Speed (v) Acceleration (a) Time Figure 4-1. Speed Profile Freescale Semiconductor 25

Software Integration Please refer to the firmware project (7. MicroStepRamp) for detail. Figure 4-2. MicroStepRamp Screen 26 Freescale Semiconductor

Motor Running and LCD2 Panel Display Demonstration 4.3 Motor Running and LCD2 Panel Display Demonstration The demonstration code for Stepper Stall Detection (SSD), micro-stepping moving, and LCD2 panel display were done for the user reference. Please refer to MotorLCD2Demo project for details. The software flowchart is shown Figure 4-3. Start Wake Up Motor to Move Invoke SSD (Step SSD) Stepper Stall? No Yes Move to Home Position System Initialization Motor Move Forward/Backward Blinking and Display Internal Clock with Mileage to LCD2 Figure 4-3. Flowchart of Motor Running and LCD2 Panel Display Freescale Semiconductor 27

Software Integration Please refer to the firmware project (8. MotorLCD2Demo) for more detailed information. 4.4 Cluster System Demonstration Figure 4-4. MotorLCD2Demo Screen This demonstration code is designed to show the following basic required features of a Cluster system application: Motors move and perform stall detection after power up Motors go back to the home position after a detected stall position Speedometer movement follows to tachometer movement Fuel and temperature meters move forward and backward Mileage updates according to the speedometer reading Lamp turns on (dimming) when fuel is close to empty (low fuel) Internal clock display Mileage can be stored to the internal EEPROM The software flowchart is shown in Figure 4-5. 28 Freescale Semiconductor

Cluster System Demonstration Start LCD2 Initialization for SSD Invoke SSD for 4 Motors Stepper Stall? No Yes Move to Home Position System Initialization Motors Movement Follow the Demo Sequence Display Mileage and Internal Clock to LCD2 No S1 Pressed? S2 Pressed? No S3 Pressed? No Power On Yes Yes Yes Demo On Store Trip Mileage to EEPROM Trip A/B selection Demo Off Power Off S2 Held Over 1 Second? No S3 Pressed? No No S1 Pressed? Yes Selected Trip Clear Yes Yes Figure 4-5. ClusterDemo Flowchart Freescale Semiconductor 29

Software Integration Please refer to the firmware project (9. ClusterDemo) for more detailed information. S1 S2 S3 S1 Toggle Switch for Power On / Off S2 Mileage Selection for Trip A, Trip B, and ODO S3 Toggle Switch for Demo Figure 4-6. Cluster Demonstration Board 30 Freescale Semiconductor

Chapter 5 Hardware Schematics Detailed schematics for this reference design and provided in this chapter. Freescale Semiconductor 31

Chapter 6 Bill of Materials Item Quantity Reference Part 1 3 C1, C10, C18 10UF/25V 2 23 C2, C4, C6, C7, C8, C15, C17, C19, C20, C21, C22, C23, C24, C25, C26, C27, C28, C29, C30, C31, 0U1 C32, C49, C50 3 3 C3, C9, C16 0U001 4 1 C5 47UF/25V 5 8 C11, C12, C13, C14, C45, C46, C47, C48 10UF 6 2 C34, C33 10P 7 1 C39 100P 8 1 C40 0U003 9 1 C41 0U033 10 1 C42 0U047 11 3 C43, C44, C51 0U01 12 1 D1 1N4001 13 10 D2, D7, D9, D11, D12, D13, D14, D15, D16, D17 LED3MM 14 1 D3 BZX84C16T 15 8 D20, D21, D22, D23, D24, D25, D26, D27 LED0603 16 14 JNC1, JNC2, JNC10, JNC11, JNC12, JNC13, JNC14, JNC15, JNC16, JNC17, JNC18, JNC19, JNC80, JNC82 17 20 M1, M2, JNO2, M3, JNO3, M4, JNO4, JNO5, JNO6, JNO7, JNO8, JNO9, JNO10, JNO11, JNO12, JNO JNO13, JNO14, JNO15, JNO83, JNO84 18 4 JP1, JP6, JP8, JP10 JP3_0 19 1 JP2 JP2 20 1 J1 tc18 21 5 J2, J11, J13, J14, J15 CON\1X2PS 22 1 J4 CON\2X4PS 23 2 J20, J5 CON\1X4PS 24 4 J6, J7, J8, J9 CON\2X14PS 25 1 J12 BDM CONNECTOR 26 1 LCD1 LCD DISPLAY (32*4) 27 1 LCD2 LCD DISPLAY (18*4) 28 4 L1, L2, L3, L4 10UH Continued on the next page JNC Freescale Semiconductor 37

Bill of Materials Item Quantity Reference Part 29 2 P2, P1 CON\DB9FR 30 18 R1, R28, R30, R62, R63, R64, R65, R66, R67, R68, R71, R72, R73, R74, R75, R76, R77, R78 330 31 2 R4, R2 510 32 1 R3 120 33 2 R18, R5 10K 34 14 R6, R7, R21, R29, R31, R32, R33, R34, R43, R46, R47, R48, R60, R61 47K 35 5 R9, R15, R23, R27, R59 1K 36 13 R19, R35, R36, R37, R38, R40, R41, R49, R50, R51, R52, R54, R55 4K7 37 1 R24 1K2 38 1 R25 100 39 4 R39, R42, R53, R56 1M 40 4 R44, R45, R57, R58 30K 41 5 S1, S2, S3, S4, S5 SW/6X6MM 42 1 U1 MC7805(DPAK) 43 1 U2 MC33388 44 1 U3 PCA82C250 45 1 U4 MC34X64_SM 46 1 U5 MC9S12HZ128/256-112LQFP 47 1 U6 XTALOSC_DIP_8_14 48 1 U7 MC145407 49 1 U8 74AC125 50 1 U9 LM2901 51 1 Y1 8MHZ 38 Freescale Semiconductor

How to Reach Us: Home Page: www.freescale.com E-mail: support@freescale.com USA/Europe or Locations Not Listed: Freescale Semiconductor Technical Information Center, CH370 1300 N. Alma School Road Chandler, Arizona 85224 +1-800-521-6274 or +1-480-768-2130 support@freescale.com Europe, Middle East, and Africa: Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen, Germany +44 1296 380 456 (English) +46 8 52200080 (English) +49 89 92103 559 (German) +33 1 69 35 48 48 (French) support@freescale.com Japan: Freescale Semiconductor Japan Ltd. Headquarters ARCO Tower 15F 1-8-1, Shimo-Meguro, Meguro-ku, Tokyo 153-0064 Japan 0120 191014 or +81 3 5437 9125 support.japan@freescale.com Asia/Pacific: Freescale Semiconductor Hong Kong Ltd. Technical Information Center 2 Dai King Street Tai Po Industrial Estate Tai Po, N.T., Hong Kong +800 2666 8080 support.asia@freescale.com For Literature Requests Only: Freescale Semiconductor Literature Distribution Center P.O. Box 5405 Denver, Colorado 80217 1-800-441-2447 or 303-675-2140 Fax: 303-675-2150 LDCForFreescaleSemiconductor@hibbertgroup.com Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including Typicals, must be validated for each customer application by customer s technical experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc. 2006. All rights reserved. RoHS-compliant and/or Pb-free versions of Freescale products have the functionality and electrical characteristics as their non-rohs-compliant and/or non-pb-free counterparts. For further information, see http://www.freescale.com or contact your Freescale sales representative. For information on Freescale s Environmental Products program, go to http://www.freescale.com/epp. Document Number: DRM084 Rev. 0 10/2006