Cluster for Motor Bikes and Four Wheelers using MC9S08LG32 Designer Reference Manual HCS08 Microcontrollers
DRM107 Rev. 0 04/2009
freescale.com
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32 Designer Reference Manual
by: Manish Kumar Sharma Applications and Reference Design Team Microcontroller Solutions Group, India Design Center 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
04/2009
0
Description Initial release.
Page Number(s) N/A
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
3
Revision History
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 4
Freescale Semiconductor
Contents Chapter 1 Preface 1.1 1.2 1.3
General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Suggested Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Chapter 2 Introduction 2.1 2.2 2.3 2.4
Intended Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . MC9S08LG32 MCU Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reference Design Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Design Benefits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 11 11 12
Chapter 3 Hardware Description 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 LG32 Cluster Reference Design Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1.1 Microcontroller and Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1.2 Power Supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1.3 LG32 Cluster Reference Design Board Connectors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1.4 Memory Map. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.2 LG32 Cluster Reference Design Interface Board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Cluster Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13 13 14 16 17 18 19 20 21
Chapter 4 Embedded Software Description 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Embedded Software Flow Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Embedded Software Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.1 Speedometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.2 Tachometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.3 Odometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.5 Temperature. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.6 Fuel Gauge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.7 Battery Power. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.8 Kilometer Left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.9 Mileage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.10 HVAC Controls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22 22 25 25 25 26 26 26 26 27 27 27 27
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
5
4.3.11 4.3.12
Miscellaneous Indications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Touch Sensor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Chapter 5 Development, Debugging, and Testing of the Embedded Software 5.1 5.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Application Reprogramming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Appendix A Bill of Material (BOM) Appendix B Schematics B.1 B.2
LG32 Cluster Reference Design Board Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 LG32 Cluster Reference Design Interface Board Schematic. . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Appendix C MC9S08LG32 Pin Connections on Cluster Reference Design Board Appendix D Digital Sensor Simulation on the Interface Board D.1 D.2
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Simulation Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Appendix E LCD Glass Data Sheet Appendix F Enabling Touch Sensor Application F.1 F.2
Hardware Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Software Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32 6
Freescale Semiconductor
Figures Figure 3-1 Figure 3-2 Figure 3-3 Figure 3-4 Figure 3-5 Figure 3-6 Figure 3-7 Figure 3-8 Figure 4-1 Figure 4-2 Figure 4-3 Figure 5-1 Figure 5-2 Figure B-1 Figure B-2 Figure B-3 Figure 5-3 Figure E-1 Figure F-1
Cluster for Motor Bikes and Four Wheelers Block Diagram . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Board Layout Top Layer . . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Board Layout Bottom Layer . . . . . . . . . . . . . . . . . . . . . Power Supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Interface Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Interface Board Layout Top Layer. . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Interface Board Layout Bottom Layer . . . . . . . . . . . . . . System Level Main Loop Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Control Switches Press Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SW1 and SW2 Switches Press Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Host PC to LG32 Cluster Reference Design Board via. PEMicro USB to BDM . . . . . . . . BDM Connector. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Board Schematic Page 1 . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Board Schematic Page 2 . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Interface Board Schematic . . . . . . . . . . . . . . . . . . . . . . PWM Output and Analog Input Graphs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LCD Glass Data Sheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Interface Board with Touch Pad Positions . . . . . . . . . .
14 15 15 16 17 20 20 20 23 24 25 29 29 34 35 36 40 41 43
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
7
Tables Table 3-1 Table 3-2 Table 3-3 Table 3-4 Table A-1 Table A-2 Table C-1
Power Connector (J1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . BDM Connector (J2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Signal Input Connector (J3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Module Statistic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Board BOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LG32 Cluster Reference Design Interface Board BOM . . . . . . . . . . . . . . . . . . . . . . . . . . MC9S08LG32 Pin Connections on Cluster Reference Design Board . . . . . . . . . . . . . . .
18 18 18 19 31 32 37
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
8
Chapter 1 Preface 1.1 General This designer reference manual provides all guidelines and considerations used in the development of the cluster for motor bikes and four wheelers reference design. It contains descriptions of the hardware and the application-specific software developed for creating the system.
1.2 Audience This document is intended for application developers who wish to learn how to set up the cluster for motor bikes and four wheelers reference design, as well as those who wish to use a specific part of this reference design and append it to their own application.
1.3 Suggested Reading • • • • • • • • • • • • •
MC9S08LG32 Reference Manual (document number MC9S08LG32RM) MC9S08LG32 Data Sheet (document number MC9S08LG32) MC9S08QD2 Data Sheet (document number MC9S08QD2) MPR084 Data Sheet (document number MPR084) VID29-05 Data Sheet (document number VID29-05) 74ACT125 Data Sheet (document number 74ACT125) Application note titled Interfacing an LCD with MC9S08LG32 (document AN3802) Application note titled Interfacing Stepper Motor with MC9S08LG32 (document AN3817) Application note titled How To Handle Dual Flash Architecture In MC9S08LG32 (document AN3821) Application note titled Emulated EEPROM Implementation in Dual Flash Architecture on MC9S08LG32 (document AN3822) Application note titled The LCD Driver for MC9S08LG32 (document AN3823) Application note titled The EEPROM Emulation Driver for MC9S08LG32 (document AN3824) Application note titled Stepper Motor Motion Control Driver for MC9S08LG32 (document AN3828)
Additional documentation may be found at http://www.freescale.com.
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
9
Preface
Cluster for Motor Bikes and Four Wheelers
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 10
Freescale Semiconductor
Chapter 2 Introduction 2.1 Intended Functionality This manual describes the reference design of a cluster board using MC9S08LG32. This design is an integrated solution for real world cluster applications like two wheelers, low-end four wheelers, and the industrial market. It provides an example of the speedometer, odometer, tachometer, fuel gauge functionality, and various indicators like left and right turn, check oil, side stand, fog light, head light high beam along with AC flow control indicators found in vehicle dash board applications. This design demonstrates the application of the LCD glass display and stepper motor together by using MC9S08LG32 microcontroller unit (MCU).
2.2 MC9S08LG32 MCU Features • • • • • • • • • • • • • • • • •
Up to 40 MHz high-performance HCS08 CPU core Up to 32 KB on-chip dual flash Up to 2 KB on-chip RAM 8-bit modulo timer (MTIM) with configurable clock inputs Up to 16-channel 12-bit resolution successive approximation analog-to-digital converter (ADC) One internal clock source (ICS): precision trimming of internal reference allows 0.2% resolution and 2% deviation over temperature and voltage Two serial communication interface (SCI) modules One serial peripheral interface (SPI) module One inter-integrated circuit (I2C) module LCD driver, configurable up to 8 × 37 or 4 × 41. Active in lowest power mode. All LCD pins are multiplexed with GPIOs One 2-channel and one 6-channel timer/pulse-width modulator (TPM) Real-time background debug mode (BDM) with ICE Up to 69 standard GPIOs Eight keyboard (KBI) and one IRQ interrupt with selectable polarity 8-bit real time counter (RTC) with low-power operation and wakeup Two temperate range options: –40 °C to +85 °C and –40 °C to +105 °C Available in 48 LQFP, 64 LQFP, and 80 LQFP packages
2.3 Reference Design Features • •
• •
Speedometer Odometer – Trip A – Trip B Digital clock Engine temperature Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0
Freescale Semiconductor
11
Introduction
• • • • • • • • • •
• •
Check oil indicator Fuel gauge Battery power Mileage calculation Kilometer left application Fan ON\OFF Heating, ventilating, and air conditioning (HVAC) control indications Tachometer indication through stepper motor Buzzer for generation of audio 2 key switch – For selecting different options – For programming the clock parameters System diagnostic at power up 6 LEDs for different feature indications – Fog light – Head light – Side stand – Neutral gear – Left turn – Right turn
2.4 Design Benefits The cluster uses a modular concept. The main board with the microcontroller is able to perform the entire cluster and display functionality. The interface board simulates various input signals to drive the main board for vehicle cluster dash board. In addition, this reference design can be used as a hardware platform for software development. For this purpose, the board is equipped with an interface for reprogramming, and the MCU is programmed with the 6-pin single-wire BDM interface for MC9S08 devices. This tool allows the MCU memory to be reprogrammed in-circuit, using the standard 6-pin BDM connector. The module is designed to be housed in a standard 9 × 5-inch case. The cluster for motor bikes and four wheelers demo kit is distributed with the following components: • Cluster demo module • CD-ROM • 12-V power supply
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 12
Freescale Semiconductor
Chapter 3 Hardware Description 3.1 Introduction The reference design is based on the MC9S08LG32 high-performance MCU for LCD display and current driver ICs 74125 that are analog products driven from the MCU and controlling one VID 29-05, the 2-phase instrumentation stepper motor. NOTE MC9S08LG32 cluster reference design is based on LG32_AH_V10_0409 hardware version.
3.2 Architecture The cluster for motor bikes and four wheelers is an integrated system designed to demonstrate the performance of the Freescale MC9S08LG32 device. This design uses a modular concept and consists of the following: • LG32 Cluster Reference Design Board — This contains the MC9S08LG32 MCU, VID29-05 stepper motor, LCD glass (28 × 4), LEDs, switches (SW1, SW2), and 20-pin connector. • LG32 Cluster Reference Design Interface Board — This contains MC9S08QD2, potentiometers, and switches to simulate various analog and digital sensors. Figure 3-1 provides the module block diagram.
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
13
Hardware Description
Figure 3-1. Cluster for Motor Bikes and Four Wheelers Block Diagram This design consists of two layer printed circuit boards (PCBs) for the LG32 cluster reference design and interface boards For schematics, refer to Appendix B, “Schematics.” The gerber for both the boards is distributed with the MC9S08LG32 Reference Design CD. Cadence SPB 16.01 Design Entry CIS is used for schematic design. The Cadence PCB editor tool is used for layout design and gerber generation.
3.2.1 LG32 Cluster Reference Design Board This board consists of the MC9S08LG32 MCU for controlling various peripherals and the power supply. Figure 3-2, Figure 3-3, and Figure 3-4 provides the layouts of LG32 cluster reference design board, top layer, and bottom layer.
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 14
Freescale Semiconductor
Architecture
20-pin connector for sensor inputs
6-pin BDM
Buzzer LED Indicators
Stepper Motor
LCD Glass 28 × 4
12-V Input
MC9S08LG32 MCU
SW1
SW2
Figure 3-2. LG32 Cluster Reference Design Board
Figure 3-3. LG32 Cluster Reference Design Board Layout Top Layer
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
15
Hardware Description
Figure 3-4. LG32 Cluster Reference Design Board Layout Bottom Layer 3.2.1.1 Microcontroller and Peripherals The Freescale 8-bit MC9S08LG32 high-performance microcontroller unit (MCU) controls the entire application and is the heart of the main board. The MCU (U1) uses enhanced central processor unit and embedded peripheral modules. The application occupies the following peripheral modules: • One 16-bit timer/PWM interface module (TPM2), 2 channels in the input capture mode and 1 channel in PWM mode • One 16-bit timer/PWM interface module (TPM1) in the PWM mode • Liquid crystal display driver (LCD) • General-purpose input/output pins (I/O) • Keyboard interrupts (KBI) • 12-bit successive approximation analog-to-digital converter (ADC) For pin muxing of MC9S08LG32 80-pin LQFP and its use in this design, refer to Appendix C, “MC9S08LG32 Pin Connections on Cluster Reference Design Board.” The MCU uses one channel (ADC4) of the ADC to perform fuel-level sensing, one channel (ADC5) for temperature sensing, and one channel (ADC11) for gear-number sensing. The resolution of the ADC is 12 bits. The ADC measures the corresponding voltage provided at its channel input through the header (J3). The MCU can drive a maximum of 41 front planes and 4 back planes of an LCD display. The application uses an LCD display with 28 front planes and 4 back planes. Because of the 4 back planes, a 1/4 duty of the output waveform is set. When the LCD driver is enabled, the back plane waveforms for the selected duty are driven out through the back plane pins. The back plane waveforms are periodic. The speed in km/h, odometer, trip A, and trip B data in km, mileage in kmpl, time in hour and minute, HVAC indicators, fuel levels, check oil, service mode, temperature, engine hot/cold, battery level, etc. are displayed on the 32-pin LCD glass (U5). The MCU uses one channel of TPM (TPM2CH3) for speed input and one channel of TPM (TPM2CH5) for rpm input in input capture mode and one channel of TPM (TPM2CH0) in edge-aligned PWM mode to drive the piezoelectric buzzer for left/right turn audio indication through one channel of 74AC125 tri-state quad buffer.
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 16
Freescale Semiconductor
Architecture
For speed and rpm sensor inputs, the appropriate pulse shaping circuit has been added. For the stepper motor application, the MCU drives the stepper motor through a 74AC125 Tri-stated Quad Buffer driver using two channels of TPM (TPM1CH0 and TPM1CH1) in edge-aligned PWM mode along with two GPIOs (PTA4 and PTA5). The KBI provides eight independently maskable external interrupts. The KBI pins are shared with standard I/O pins. The application uses all eight of them: • KBI7 for SW1 • KBI1 for SW2 • KBI2 for left turn input • KBI0 for right turn input • KBI3 for fog light input • KBI4 for head light input • KBI5 for touch sensor input • KBI6 for side stand input The MCU drives the following GPIOs for LED indicators through two 74AC125 ICs: • PTC4 for head light indication red LED • PTA0 for side stand indication red LED • PTA2 for fog light indication red LED • PTA1 for neutral gear indication green LED • PTG2 for right turn indication green LED • PTG3 for left turn indication green LED The MCU also controls the backlighting control of the cluster through one of its GPIO PTB0 and monitors the check oil at PTB1. The MCU is interfaced to a touch sensor on the interface board using I2C interface. The pin PTB1 is connected to the ATTN pin of touch sensor, MPR084, for the MCU to establish connection. For more details on touch sensor application, refer to Appendix F, “Enabling Touch Sensor Application.” The standard 6-pin BDM interface along with USB to BDM wiggler is used to communicate with the PC for reprogramming and debugging the application. The emulated EEPROM is used to store the trip and odometer data. 3.2.1.2 Power Supply The cluster is turned on from the 12-V DC. A simple linear voltage regulator 33269DT-5 is used to provide a 5-V power supply for the cluster devices. The schematic of the power supply can be seen in Figure 3-5.
Figure 3-5. Power Supply
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
17
Hardware Description
It is necessary to save odometer and trip meter data if the power supply from the battery is switched off. The resistor dividers, R1 and R2, monitor the battery power supply and generate an interrupt signal in case a power off occurs. The capacitors C5, C6, and C9 hold a voltage long enough for the microcontroller to perform an interrupt service routine to save the data. C9 can be replaced by a higher value for better discharge time. 3.2.1.3 LG32 Cluster Reference Design Board Connectors
Table 3-1, Table 3-2, and Table 3-3 describe the cluster board connector pin assignments and their description. Table 3-1. Power Connector (J1) Pin
Function
Description
1
VCC Supply
12 V supply I/P
2
GND
Power ground
3
GND
Power ground
Table 3-2. BDM Connector (J2) Pin
Name
Description
1
BKGD
Single wire BDM signal
2
GND
MCU ground
3
NC
Not connected
4
RESET
Reset In and Out from MCU
5
NC
Not connected
6
VDD
MCU supply
Table 3-3. Signal Input Connector (J3) Pin
Function
Description
1
ADC5
For temperature IP
2
ADC4
For fuel IP
3
ADC11
For gear IP
4
KBI0
Right turn IP
5
KBI5
Touch sensor IP
6
KBI2
Left turn IP
7
T2CH3
For speed IP
8
KBI4
For head light IP
9
KBI6
For side stand IP
10
PTI3
SDA
11
T2CH5
For rpm IP
12
PTI0
Check oil IP
13
KBI3
For fog light IP
14
PTI1
TX2
15
PTB1
GPIO
16
PTF4
SCL
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 18
Freescale Semiconductor
Architecture
Table 3-3. Signal Input Connector (J3) (continued) Pin
Function
Description
17
GND
Power ground
18
NC
Not connected
19
VDD
5V
20
NC
Not connected
3.2.1.4 Memory Map Table 3-4 shows the organization of cluster reference design software in various files for all tasks and drivers. It also shows the RAM (data) and the flash (code) area occupancy in bytes for running the software. Table 3-4. Module Statistic Name
Data
Code
Const
main.c
0
243
0
MC9S08LG32.c
228
0
0
Start08.c
0
132
0
RTSHC08.c (ansifs.lib)
0
3828
0
ref_design.c
60
2591
12
stepper_int.c
0
1308
0
stepper_data.c
9
0
864
stepper_driver.c
0
942
2
lcd_functions.c
0
1344
0
lcd.c
6
1375
224
EED_Para.asm
34
0
0
FlashErase.asm
0
46
0
FlashInit.asm
0
33
0
FlashProgram.asm
0
57
0
HighVoltage.asm
0
30
0
DataVerify.asm
0
67
0
EED_HighLevel.asm
0
852
0
EED_MidLevel.asm
0
811
0
eeprom_wrapper.c
0
57
0
touch_sensor.c
3
638
0
Other
112
12
2
Total
452
14366
1104
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
19
Hardware Description
3.2.2 LG32 Cluster Reference Design Interface Board This board consists of the MC9S08QD2 MCU for simulating speed and rpm sensors, potentiometer, and switches for simulating other analog and digital sensors. Figure 3-6, Figure 3-7, and Figure 3-8 provides the layouts of LG32 cluster reference design interface board, top layer, and bottom layer.
Figure 3-6. LG32 Cluster Reference Design Interface Board
Figure 3-7. LG32 Cluster Reference Design Interface Board Layout Top Layer
Figure 3-8. LG32 Cluster Reference Design Interface Board Layout Bottom Layer The interface board simulates various analog and digital sensor inputs to the main board. The interface board consists of a MC9S08QD2 MCU that accepts varying analog input through the potentiometers and generates two PWM signals at its output. The frequency of these PWM signals depends on the ADC input through the potentiometer and these PWM signals work as speed and rpm input to the reference design board. Three additional potentiometers are directly connected to the reference design board to simulate
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 20
Freescale Semiconductor
Cluster Setup
fuel level, temperature, and gear number. In addition five push button switches simulate fog light, head light, side stand, left turn, right turn, and check oil signals to the reference design board. Also there is a feature of MPR084 touch sensor that can be mounted and interfaced to MC9S08LG32 using I2C protocol. For details on using touch sensor, refer to Appendix F, “Enabling Touch Sensor Application.” The reference design board is connected to the interface board using a 20-pin FR cable. This interface board can be used to see the cluster functionality in absence of real cluster input signals. Refer to Appendix D, “Digital Sensor Simulation on the Interface Board,” for digital sensor simulation details.
3.3 Cluster Setup The cluster for motor bikes and four wheelers is distributed with embedded software. No additional software is required to run the cluster. To turn on this cluster, cable from the 12-V DC adapter must be plugged in.
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
21
Chapter 4 Embedded Software Description 4.1 Introduction Software on MC9S08LG32 based cluster reference design is the demonstration of all functions available in a two-wheeler and a low-end four-wheeler. The functionality includes integrated cluster features like LEDs for head light, fog light, side stand, neutral gear, left turn, and right turn indications, LCD display for fuel-level, speedometer, odometer, trip A, and trip B distances, mileage, kilometers (km) left, clock, engine temperature, oil change, battery power, service due, HVAC controls, and stepper motor for tachometer display. Speedometer, tachometer, fuel level, neutral gear, engine temperature, and battery meter work on inputs from external sensors (analog or digital). In this reference design, the sensor outputs are simulated using ADC (for analog sensors) and ADC-to-PWM conversion (for digital sensors). Fog light, head light, side stand, left turn, right turn, and check oil indications, the input is provided through switches. An interface board is used for all sensor simulations, switches, and touch panel inputs. NOTE MC9S08LG32 cluster reference design is based on LG32_AS_V10_0409 software version.
4.2 Embedded Software Flow Charts The embedded software consists of the flow charts provided in Figure 4-1, Figure 4-3, and Figure 4-3.
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
22
Embedded Software Description
Start
Initialize all the blocks like TPM, GPIOs, RTC, etc. and peripherals like drive stepper motor to 0 position Run a diagnostic routine to check all the peripherals like rotate the stepper motor and turn on all LCD segments
Update LCD indicators
No
Is quantum time out?
Yes Reset timer and update clock
Capture sensor outputs that is, speedometer, tachometer, fuel gauge, engine temperature, etc.
Update trip A and trip B and odometer distances
Update tachometer that is, rotate stepper motor accordingly
Update LED indicators like right turn, left turn, check oil, etc.
Figure 4-1. System Level Main Loop Flow
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 23
Freescale Semiconductor
Embedded Software Flow Charts
No
No
Yes Switch pressed?
Fog light switch? Yes
No High beam switch?
No Side stand switch? Yes
Yes
Enable fog light indicator LED
Enable high beam indicator LED
Enable side stand indicator LED
Enable right turn signal
Enable left turn signal
No Turn off left turn signal
Yes
Left turn signal active? Yes
No Turn off right turn sSignal
No
Yes
Right turn signal active? Yes
No Right turn switch?
Left turn switch?
Figure 4-2. Control Switches Press Flow
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
24
Embedded Software Description
set_hour=0 set_min=1
set_hour=1 set_min=0
No Yes Is set_hour=0?
Rotate through functions
Rotate through functions
Yes No
Clock set mode active? No
No
SW1 Switch?
Clear Trip B
Yes
Yes
Yes
Yes
Yes Switch Pressed?
Clear Trip A
Held for 3 Secs.?
No Is Trip A?
Go to set clock mode No Yes
No Is Trip B?
No
Is clock displayed?
Clock set Yes mode active?
Exit clock set mode
No SW2 Switch?
No
Yes
Yes Yes Clock set Is mode active? set_hour=0?
No
Increment minute
No Increment hour
Figure 4-3. SW1 and SW2 Switches Press Flow
4.3 Embedded Software Functionality Software on MC9S08LG32 based cluster design performs the integration of tasks described below.
4.3.1 Speedometer The speedometer is a task to capture and calculate the speed of the vehicle through a digital sensor. In the MC9S08LG32 reference design vehicle, speed is displayed on LCD screen. The unit is kmph. The speed is calculated using the frequency of the pulses, input (from the sensor) from the TPM channel dedicated for speed input. Refer to Appendix D, “Digital Sensor Simulation on the Interface Board,” for details of how sensor output is simulated in the interface board.
4.3.2 Tachometer The tachometer is a task to capture and calculate the rate of rotation of the engine's crankshaft through a digital sensor. In the MC9S08LG32 reference design, engine rpm is displayed through a dedicated stepper motor. The rpm displayed is the multiple of 1000 that is, in thousand rotations per minute.
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 25
Freescale Semiconductor
Embedded Software Functionality
The rpm is calculated using the frequency of the pulses, input (from the sensor) from the TPM channel dedicated for rpm input. Refer to Appendix D, “Digital Sensor Simulation on the Interface Board,” for details of how sensor output is simulated in the interface board.
4.3.3 Odometer The odometer is a task to calculate the distance travelled by the vehicle using the vehicle speed and time utilized. In the MC9S08LG32 reference design, odometer is displayed on LCD. The odometer counts every kilometer (km) covered by the vehicle. There are two trip meters (called trip A and trip B) installed in this reference design that keeps the distance count every 100 m (0.1 km). The vehicle driver uses trip meters to see the distance between source and destination; the driver may reset the trips to zero at source.
4.3.4 Clock The real-time clock feature is provided on the LCD display. Each time the vehicle starts, the clock needs to be set by the vehicle driver. The procedure for setting the clock includes the following steps: 1. If the clock is not shown, display the clock by pressing SW1, until the clock is displayed on LCD. 2. If the clock is shown, hold down SW1 for 3 seconds, until the LCD starts blinking. 3. Now clock set mode is entered, press SW2 to increase hours until the desired value. 4. Press SW1 to go to set minutes value. 5. Press SW2 to increase minutes until the desired value. 6. Hold down SW1 for 3 seconds, until the LCD stops blinking. 7. Clock is set and running. NOTE The clock can keep on running even when vehicle is switched off, provided the battery power is supplied to the microcontroller (low-power consumption mode), to avoid setting the clock each time the vehicle is turned on. All the peripherals like LCD, stepper motor will be off in this period.
4.3.5 Temperature Engine temperature is displayed on the LCD by measuring the analog sensor output and converting it to a digital value. This temperature input is used to show the engine hot/cold indication as well as the engine temperature. The unit of engine temperature is degrees celsius (ºC).
4.3.6 Fuel Gauge The fuel gauge is displayed on the LCD. It measures analog sensor output and converts it to a particular level in the fuel meter. The fuel display starts blinking if fuel goes below the critical level defined in the application. NOTE The fuel level value is also used in calculation of mileage and kilometers (km) left. Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
26
Embedded Software Description
4.3.7 Battery Power Battery power is displayed on the LCD. It measures the voltage level of the analog output from the battery. NOTE This output also triggers the low-voltage circuitry of the MC9S08LG32 to result in an interrupt that is used to program critical data like the odometer etc. on emulated EEPROM before power down.
4.3.8 Kilometer Left This feature allows the driver to check the distance that can be covered with respect to remaining fuel. It is calculated based on variation in inputs from the fuel gauge sensor, the speed, and the odometer.
4.3.9 Mileage This function calculates and displays the vehicle mileage while the vehicle is moving. It takes fuel sensor, current speed, and distance travelled readings as inputs.
4.3.10 HVAC Controls Heating, ventilation, and air conditioning controls are displayed on LCD.
4.3.11 Miscellaneous Indications The following indications are often found in a contemporary automotive: 1. Check oil indication is used as a warning to the driver for indicating the critical level of engine oil. In this reference design this is monitored using a GPIO. 2. Engine hot/cold indication is used as a warning to the driver for indicating engine temperature too cool or too hot to be started. This is controlled through the engine temperature output. 3. Service due indication is to inform the driver that the automotive needs to be serviced. It is based on various factors including the kilometers (km) travelled recommended value. 4. Fog light and head light are the LED indications for the driver notification that fog light and head light are turned on, respectively. These indications are based on switch presses. 5. Side stand is the warning for side-stand pulled out that may obstruct the driving. This LED indication is based on switch presses. 6. Left, right turn indicators are provided for signaling the left and right turn of the vehicle to other vehicles. Also a buzzer is associated with these signals for sound indication. These indications are based on switch presses. 7. Neutral gear indication is for driver assistance that vehicle is in neutral gear. This is based on an analog sensor output voltage that is converted to digital value through ADC inside the MC9S08LG32 MCU.
4.3.12 Touch Sensor The touch sensor pads are provided on the Interface board. The finger touches are sensed that work similar to pressing a switch. The MPR084 touch sensor IC is used on interface board for this purpose. NOTE For further details about how to configure the touch panel in software and hardware, refer to Appendix F, “Enabling Touch Sensor Application.” Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 27
Freescale Semiconductor
Chapter 5 Development, Debugging, and Testing of the Embedded Software 5.1 Introduction For additional changes in features or the parameters of the application, you have an option to reprogram the cluster application. The MCU of the cluster application is programmed with the BDM for the HCS08 MCU family that means the MCU memory can be reprogrammed in-circuit using the standard 6-pin BDM connector. The new software can be developed and debugged using Code Warrior 6.2 IDE. The developed software can be tested on the LG32 cluster reference design board. The sensor inputs can be taken from the LG32 cluster reference design interface board in absence of real sensors. NOTE LG32 service pack must be installed along with the fix for ICE.
5.2 Application Reprogramming To reprogram the embedded application using the BDM, you need to have Code Warrior 6.2 installed on the host computer. To use this software, the standard PE micro USB-to-BDM multilink cable must be connected to the BDM connector on board, see Figure 5-1.
Figure 5-1. Host PC to LG32 Cluster Reference Design Board via. PEMicro USB to BDM BKGD
1
2
GND
3
4
RESET
5
6
VDD
Figure 5-2. BDM Connector
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
29
Development, Debugging, and Testing of the Embedded Software
The following steps describe the procedure for reprogramming the application: 1. Browse to location Software/Ref1.zip in the LG32 Cluster Reference Design CD and save it to c:\ of your PC. 2. Extract the Ref1.zip. 3. Open CodeWarrior 6.2. 4. Select File>Open. 5. Browse to c:/Ref1/Ref1.mcp 6. In the Code Warrior window, click to make. 7. Click to debug. 8. When the debugger is launched, click to run. The Code Warrior makes connections and enables the application to run.
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 30
Freescale Semiconductor
Appendix A Bill of Material (BOM) Table A-1. LG32 Cluster Reference Design Board BOM Item
Quantity Reference
Part
Description
MFG Name
MFG PN
MOUNTING HOLE CIRC DRILL 125 CIRC PAD 175 PLATED TRHU HOLE
FOOTPRINT ONLY
FOOTPRINT ONLY
4
BH1,BH2,B Mounting Hole H3,BH4
2
11
C1,C4,C7, C12,C13,C 14,C15,C1 6,C17,C18, C19
0.1UF
CAP CER 0.1UF 50V 5% X7R 0805
KEMET
C0805C104J5RA CTU
3
2
C2,C3
1UF
CAP CER 1UF 25V 10% X5R 0805
Panasonic
ECJ2FB1E105K
4
2
C5,C6
220UF
CAP ALEL 220UF 25V 20% -RADIAL
NICHICON
UPW1E221MPD
5
1
C8
0.47UF
CAP CER 0.47UF 50V 20% Z5U RADIAL
KEMET
C320C474M5U5T A
6
1
C9
10UF
CAP TANT 10UF 10V 10% -3216-18
7
2
C10,C11
22PF
CAP CER 22PF 50V 5% C0G 0805
KEMET
8
1
D1
MURA160T3G
DIODE PWR RECT 1A 600V SMT 403D-01
ON SEMICONDUCTOR
MURA160T3G
9
5
D2,D3,D4, D13,D18
RED
LED RED SGL 20MA SMT
OSRAM
LS M67K-H2L1-1-0-2 -R18-Z
10
3
D5,D6,D7
LGR971
LED GRN SGL 25MA 0805
OSRAM
Q62702P5179
11
10
D8,D9,D10 ,D11,D12, D14,D15,D 16,D17,D1 9
WHITE
LED WHITE DIFFUSED 4-PLCC 30MA SMT
OSRAM
LW E67C-T1V2-5K8L1-Z
12
1
J1
CON_1_PWR
CON 1 PWR PLUG DIAM 2.49MM RA TH -- 430H NI
SWITCHCRAFT
RAPC712X
13
1
J2
HDR_2X3
HDR 2X3 TH 100MIL CTR 330H SN 115L
Samtec
TSW-103-23-T-D
14
1
J3
CON_2X10
CON 2X10 PLUG SHRD TH 100MIL CTR 380H AU
3M
N2520-6002RB
15
1
LS1
PKLCS1212E4 001
BUZZER PIEZO AUDIO 4KHZ 75DB 25VP-P SMT
MURATA
PKLCS1212E400 1-R1
1
VISHAY 293D106X9010A2 INTERTECHNOLOGY TE3 C0805C220J5GA C
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
31
Table A-1. LG32 Cluster Reference Design Board BOM (continued) Item
Quantity Reference
Part
Description
MFG Name
MFG PN
TRAN N CHNL MOSFET PWR 20V 750MA SOT23
ON SEMICONDUCTOR
MGSF1N02LT1
panasonic
EXB28VR000X
16
1
Q1
MGSF1N02EL T
17
1
RN1
ZERO
RNET ISO 4 ZERO OHM 1/32W 0% 0402
18
4
RN2,RN3, RN4,RN5
1k
RNET ISO 4 1K 1/10W 5% SMT
VISHAY CRA12E0831K00 INTERTECHNOLOGY JTR
19
1
R1
2.2K
RES MF 2.20K 1/4W 1% 1206
VISHAY CRCW12062K20F INTERTECHNOLOGY KEA
20
1
R2
1.0K
RES MF 1.00K 1/4W 1% 1206
VISHAY CRCW12061K00F INTERTECHNOLOGY KEA
21
1
R3
10M
RES CF 10M 1/4W 5% AXL
Stackpole Electronics Inc
CF 1/4 10M 5% R
22
5
R4,R5,R6, R20,R21
5.1K
RES MF 5.1K OHM 1/8W 5% 0805
PANASONIC
ERJ-6GEYJ512V
23
12
R7,R8,R9, R10,R11,R 12,R13,R1 4,R15,R16, R17,R23
220
RES MF 220 OHM 1/8W 5% 0805
YAGEO AMERICA
RC0805JR-07220 RL
24
2
R18,R19
0
RES TF 0 OHM 1/8W 1% RC0805
Footprint Only
Footprint Only
25
1
R22
1M
RES MF 1M OHM 1/8W 5% 0805
PANASONIC
ERJ-6GEYJ105V
26
2
SW1,SW2
SPST PB NO
SW SPST PB MOM NO SMT 50MA@50V AG, ROHS
E SWITCH
TL3301NF160QG
27
1
U1
MC9S08LG32 CLK
IC MCU 8BIT HCS08 32K FLASH 2K RAM 2.7-5.5V LQFP80
FREESCALE SEMICONDUCTOR
MC9S08LG32CLK
28
1
U2
33269DT-5
IC VREG LDO 5V 0.8A 0-20V DPAK 3
ON SEMICONDUCTOR
MC33269DT-5.0G
29
3
U3,U4,U6
74ACT125
IC BUF QUAD TS 4.5-5.5V SOIC14
FAIRCHILD
74ACT125SC
30
1
U5
ER47024
LCD DISPLAY 5V TH
GOOD LCD
ER47024
Hong Kong VID Company Limited
VID29-05
ABRACON CORP
31
1
U7
VID29-05
STEPPER MOTOR BIPOLAR 5-10V TH
32
1
Y1
AB26T-32.768 KHZ
XTAL 32.768KHZ RSN -- TH
AB26T-32.768KH Z
Table A-2. LG32 Cluster Reference Design Interface Board BOM Item 1
Quantity 4
Reference BH1,BH2,BH3,BH4
Part
Description
MFG Name
MFG PN
Mounting Hole
MOUNTING HOLE CIRC DRILL 125 CIRC PAD 175 PLATED TRHU HOLE
FOOTPRINT ONLY
FOOTPRINT ONLY
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 32
Freescale Semiconductor
Table A-2. LG32 Cluster Reference Design Interface Board BOM (continued) Item
Quantity
Reference
Part
Description
MFG Name
MFG PN
2
3
C1,C3,C4
0.1UF
CAP CER 0.1UF 50V 5% X7R 0805
KEMET
C0805C104J5 RACTU
3
1
C2
10UF
CAP TANT 10UF 10V 10% -3216-18
4
1
C5
1UF
CAP CER 1UF 25V 10% X5R 0805
Panasonic
ECJ2FB1E105 K
5
8
E1,E2,E3,E4,E5,E 6,E7,E8
touchpad
10mm x 10mm
FOOTPRINT ONLY
FOOTPRINT ONLY
6
1
J1
CON_2X10
CON 2X10 PLUG SHRD TH 100MIL CTR 380H AU
3M
N2520-6002R B
7
1
J2
HDR_2X3
HDR 2X3 TH 100MIL CTR 330H SN 115L
Samtec
TSW-103-23-T -D
8
1
LS1
PKLCS1212E4001
BUZZER PIEZO AUDIO 4KHZ 75DB 25VP-P SMT
MURATA
PKLCS1212E 4001-R1
9
9
R1,R2,R4,R5,R7,R 8,R22,R23,R27
5.1K
RES MF 5.1K OHM 1/8W 5% 0805
10
5
R3,R6,R24,R25,R2 6
3.0K
RES POT 3.0K 1/2W 20% TH
11
1
R9
220
RES MF 220 OHM 1/8W 5% 0805
12
4
R10,R11,R12,R13
4.7K
RES MF 4.7K OHM 1/8W 5% 0805
13
8
R14,R15,R16,R17, R18,R19,R20,R21
1M
RES MF 1M 1/8W 5% 0805
14
6
SW1,SW2,SW3,S W4,SW5,SW6
SPST PB NO
SW SPST PB MOM NO SMT 50MA@50V AG, ROHS
15
1
U1
MC9S08QD2
8 bit MCU SOIC 8
16
1
U2
MPR084Q
IC CTLR 8-PAD TOUCH CAPACITIVE SENSOR 1.8-3.6V QFN16
17
1
Z1
VISHAY INTERTECH 293D106X901 NOLOGY 0A2TE3
PANASONIC ERJ-6GEYJ51 2V
YAGEO AMERICA
RC0805JR-07 220RL
PANASONIC ERJ-6GEYJ47 2V PANASONIC ERJ-6GEYJ10 5V E SWITCH
TL3301NF160 QG
FREESCALE MC9S08QD2S SEMICOND C UCTOR FREESCALE SEMICOND UCTOR
MPR084Q
DIODE ZENER 225MW 3.3V TH
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
33
Appendix B Schematics B.1 LG32 Cluster Reference Design Board Schematic
Figure B-1. LG32 Cluster Reference Design Board Schematic Page 1
Figure B-2. LG32 Cluster Reference Design Board Schematic Page 2
B.2 LG32 Cluster Reference Design Interface Board Schematic
Figure B-3. LG32 Cluster Reference Design Interface Board Schematic
Appendix C MC9S08LG32 Pin Connections on Cluster Reference Design Board Table C-1. MC9S08LG32 Pin Connections on Cluster Reference Design Board Pin No.
MCU Pin Name
Schematic Signal
Function
1
LCD7/PTD7
LCD7
LCD Glass pin 8
2
LCD6/PTD6
LCD6
LCD Glass pin 7
3
LCD5/PTD5
LCD5
LCD Glass pin 6
4
LCD4/PTD4
LCD4
LCD Glass pin 5
5
LCD3/PTD3
LCD3
LCD Glass pin 4
6
LCD2/PTD2
LCD2
LCD Glass pin 3
7
LCD32/PTB3
LCD32
LCD Glass pin 27
8
LCD31/PTB2
LCD31
LCD Glass pin 28
9
LCD40/PTB7
LCD40
LCD Glass pin 29
10
LCD39/PTB6
LCD39
LCD Glass pin 30
11
LCD38/PTB5
LCD38
LCD Glass pin 31
12
LCD37/PTB4
LCD37
LCD Glass pin 32
13
LCD30/PTB1
PTB1
Attn pin of MPR084
14
LCD29/PTB0
PTB0
Backlight
15
LCD1/PTD1
LCD1
LCD Glass pin 2
16
LCD0/PTD0
LCD0
LCD Glass pin 1
17
Vcap1
NC
NC
18
Vcap2
NC
NC
19
VLL1
NC
NC
20
VLL2
NC
NC
21
VLL3
5V
5V
22
PTF5/MOSI/KBI2/T2CH3
KBI2
Left turn input
23
PTF4 /MISO/KBI1/T2CH4
T2CH4
Buzzer
24
PTI5/T2CH0 /SCL /SSB
SCL
SCL
25
PTI4/SPSCK/SDA/T2CH1
SDA
SDA
26
PTI3 I/T2CH2/MOS
PTI3
Stepper select
27
PTI2/T2CH3/MISO
T2CH3
Speed input
28
PTI1 /TMRCLK/TX2
TX2
TX2
29
PTI0/RX2
PTI0
Check oil input
30
PTH7/KBI1/T2CH4
KBI1
SW2 input (clock)
31
VSS2
GND
GND
32
VDD
5V
5V
33
PTF7/EXTAL
Crystal EXTAL
Crystal EXTAL
34
PTF6/XTAL
Crystal XTAL
Crystal XTAL
35
VDDA/ VREFH
5V
5V
36
VSSA/ VREFL
GND
GND
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
37
Table C-1. MC9S08LG32 Pin Connections on Cluster Reference Design Board Pin No.
MCU Pin Name
Schematic Signal
Function
37
PTH6 /T2CH5/ KBI0/ADC15
KBI0
Right turn input
38
PTF2/SPSCK /T1CH1/IRQ/ADC14
ADC14
Battery input
39
PTF1/RX1/T1CH0/ADC13
T1CH0
Stepper channel 1
40
PTF0 /TX1/KBI3 /T2CH2 /ADC12
KBI3
Fog light input
41
PTF3 /SSB/KBI0/T2CH5
T2CH5
rpm input
42
PTH5/TX1/KBI3 /T1CH0/ADC11
ADC11
Gear input
43
PTH4/RX1/KBI2 /T1CH1/ADC10
T1CH1
Stepper channel 4
44
PTH3/KBI7/ADC9
KBI7
SW1(trip input)
45
PTH2/ KBI6/ADC8
KBI6
Side stand input
46
PTH1/KBI5/ADC7
KBI5
Touch pad input
47
PTH0 /KBI4/ADC6
KBI4
Head light input
48
PTC6/RESET_B
RESET
Reset
49
PTC5/ BKGD/MS
BKGD
BKGD
50
PTA7/TCLK /ADC5/LCD28
ADC5
Temperature input
51
PTA6/T2CH1/KBI7 /ADC4 /LCD27
ADC4
Fuel input
52
PTA5/KBI6 /T2CH0/ADC3/LCD26
PTA5
Stepper channel 3
53
PTA4/KBI5 /RX2 /ADC2/LCD25
PTA4
Stepper channel 2
54
PTA3/KBI4 /TX2 /ADC1 /LCD24
PTA3
Indicator chip select
55
PTA2 /SDA/ADC0/LCD23
PTA2
Fog light
56
PTA1 /SCL/LCD22
PTA1
Neutral gear
57
PTG3/LCD36
PTG3
Left turn
58
PTG2/LCD35
PTG2
Right turn
59
PTA0/LCD21
PTA0
Side stand
60
PTC4/LCD20
PTC4
Head light
61
PTC3/LCD19
LCD19
LCD Glass pin 20
62
PTC2/LCD18
LCD18
LCD Glass pin 19
63
PTC1/LCD17
LCD17
LCD Glass pin 18
64
PTC0/LCD16
LCD16
LCD Glass pin 17
65
PTE7/LCD15
LCD15
LCD Glass pin 16
66
PTE6/LCD14
LCD14
LCD Glass pin 15
67
VSS1
GND
GND
68
VLL3_2
5V
5V
69
PTG7/LCD44
LCD44
LCD Glass pin 21
70
PTG6/LCD43
LCD43
LCD Glass pin 22
71
PTG5/LCD42
LCD42
LCD Glass pin 23
72
PTG4/LCD41
LCD41
LCD Glass pin 24
73
PTG1/LCD34
LCD34
LCD Glass pin 25
74
PTG0/LCD33
LCD33
LCD Glass pin 26
75
PTE5/LCD13
LCD13
LCD Glass pin 14
76
PTE4/LCD12
LCD12
LCD Glass pin 13
77
PTE3/LCD11
LCD11
LCD Glass pin 12
78
PTE2/LCD10
LCD10
LCD Glass pin 11
79
PTE1/LCD9
LCD9
LCD Glass pin 10
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 38
Freescale Semiconductor
Table C-1. MC9S08LG32 Pin Connections on Cluster Reference Design Board Pin No.
MCU Pin Name
Schematic Signal
Function
80
PTE0/LCD8
LCD8
LCD Glass pin 9
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
39
Appendix D Digital Sensor Simulation on the Interface Board D.1 Overview The method of conversion of analog output to vary digital pulse frequency is used for simulating the digital pulse of sensor for speed and rpm. The MC9S08QD2 is used for this purpose.
D.2 Simulation Details The software running in MC9S08QD2 samples the analog input and accordingly outputs a frequency varying PWM output that is supplied to the MC9S08LG32 to simulate digital sensing.
Analog input to MC9S08QD2
Digital Varying Frequency PWM output to MC9S08LG32
Figure 5-3. PWM Output and Analog Input Graphs
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
40
Appendix E LCD Glass Data Sheet
Figure E-1. LCD Glass Data Sheet
Appendix F Enabling Touch Sensor Application The touch pads and the touch sensor IC MPR084 have been provided on the Interface board. To enable this application, you must follow the steps provided in the hardware and software configuration sections.
F.1 Hardware Configuration •
For LG32 cluster reference design board: a. Check that RN5 pin 4 and 5 are shorted and pin 1 and 8 are shorted. b. Add pull up resistor of 4.7 kΩ between pin 10 (SDA) and VDD (pin 19) of J3. c. Add pull up resistor of 4.7 kΩ between pin 16 (SCL) and VDD (pin 19) of J3.
•
For LG32 cluster reference design interface board: a. Mount components R9, Z1,C5, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, and U2 as per the interface board BOM in Appendix A, “Bill of Material (BOM).”
F.2 Software Configuration 1. Make TOUCH_SENSOR_ENABLE=1 in ref_design.h of Ref1.mcp. By default, TOUCH_SENSOR_ENABLE is disabled in software. 2. While in km left mode on LCD, push down SW1 for 3 seconds to enter diagnostic mode. 3. In diagnostic mode, touching pad 1–8 display their respective numbers on the LCD glass. 4. To exit diagnostic mode, turn on/off the board again. Refer Figure F-1 for touch pad positions.
Touch Pads
1
2
3
4
5
6
7
8
Figure F-1. LG32 Cluster Reference Design Interface Board with Touch Pad Positions
Cluster for Motor Bikes and Four Wheelers using MC9S08LG32, Rev. 0 Freescale Semiconductor
42
How to Reach Us: Home Page: www.freescale.com E-mail:
[email protected] 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
[email protected] 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)
[email protected] 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
[email protected] Asia/Pacific: Freescale Semiconductor China Ltd. Exchange Building 23F No. 118 Jianguo Road Chaoyang District Beijing 100022 China +86 10 5879 8000
[email protected] 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
[email protected]
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. The ARM POWERED logo is a registered trademark of ARM Limited. ARM7TDMI-S is a trademark of ARM Limited. Java and all other Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. The Bluetooth trademarks are owned by their proprietor and used by Freescale Semiconductor, Inc. under license. © Freescale Semiconductor, Inc. 2004. All rights reserved. DRM107 Rev. 0 04/2009