Freescale Semiconductor M68HC08 series Designer Reference Manual

Page 1
Freescale Semiconductor, Inc.
LIN-bus HID Lamp
nc...
I
cale Semiconductor,
Frees
M68HC08
Microcontrollers
Motor Control Using
Motorola 908E625
Designer Reference Manual
DRM047 Rev. 0, 12/2003
MOTOROLA.COM/SEMICONDUCTORS
For More Information On This Product,
Go to: www.freescale.com
Page 2
Freescale Semiconductor, Inc.
nc...
I
cale Semiconductor,
Frees
For More Information On This Product,
Go to: www.freescale.com
Page 3
Freescale Semiconductor, Inc.
LIN-bus HID Lamp Levelling Stepper Motor Control Using
nc...
I
cale Semiconductor,
Frees
Motorola 908E625 Reference Design
Designer Reference Manual — Rev 0
by: Libor Prokop, Petr Cholasta
MCSL, Rosnov
Motorola and the Motorola logo are registered trademarks of Motorola, Inc.
®
Metrowerks of Metrowerks, Inc., a wholly owned subsidiary of Motorola, Inc.
and the Metrowerks logo are registered trademarks
CodeWarrior wholly owned subsidiary of Motorola, Inc.
Microsoft® is a registered trademark of Microsoft Corporation in the U.S. and other countries
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA 1
For More Information On This Product,
Go to: www.freescale.com
®
is a registered trademark of Metrowerks, Inc., a
Page 4
Freescale Semiconductor, Inc.
nc...
I
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
2 MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 5
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047
Section 1. Introduction
1.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
1.2 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
Table of Contents
nc...
I
cale Semiconductor,
Frees
1.3 HID Headlamp Levelling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 LIN-bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.5 Definitions and Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Section 2. System Concept
2.1 System Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
2.2 LIN Stepper Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3 LIN Master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.4 Personal Computer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
Section 3. Hardware Description
3.1 Master Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.2 Slave Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Section 4. Messaging Scheme Description
4.1 Axis and Signal Providers and Acceptors. . . . . . . . . . . . . . . . .35
4.2 LIN Leveller Basic Messaging . . . . . . . . . . . . . . . . . . . . . . . . .36
4.3 LIN Leveller Configuration Messaging . . . . . . . . . . . . . . . . . . .37
Section 5. LIN Master Software Description
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA 5
For More Information On This Product,
Go to: www.freescale.com
Page 6
Freescale Semiconductor, Inc.
5.1 State Machine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39
5.2 Data Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42
Section 6. LIN Stepper Software Description
6.1 LIN Stepper Software Data Flow . . . . . . . . . . . . . . . . . . . . . . . 51
6.2 LIN Stepper Software Application State Diagram. . . . . . . . . . .62
6.3 LIN Stepper Software Implementation . . . . . . . . . . . . . . . . . . .65
Section 7. User Interface Description
nc...
I
cale Semiconductor,
Frees
7.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7.2 PC Master Software General Overview . . . . . . . . . . . . . . . . . .71
7.3 LIN-bus Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73
7.4 Slave Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.5 Recorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.6 Oscilloscope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78
7.7 Programming and Configuration. . . . . . . . . . . . . . . . . . . . . . . .83
Section 8. Conclusion
Section 9. References
Appendix A. Hardware Schematics
A.1 LIN Master Board Schematic . . . . . . . . . . . . . . . . . . . . . . . . . .93
A.2 LIN Stepper Board Schematic . . . . . . . . . . . . . . . . . . . . . . . . . 94
Appendix B. 908E625 Advantages and Features
Appendix C. LIN Frames and Signals
C.1 LIN Leveller Basic Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . .97
C.2 Node ID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Designer Reference Manual DRM047 — Rev 0
6 MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 7
Freescale Semiconductor, Inc.
C.3 LIN Leveller Configuration Frames. . . . . . . . . . . . . . . . . . . . .101
C.4 Possible Software Extension Programming via LIN . . . . . . . .108
Appendix D. LIN Stepper Software Data Variables
Appendix E. System Setup
E.1 Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115
E.2 Jumper Settings of Master and Slave Boards . . . . . . . . . . . .117
E.3 Required Software Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
E.4 Building and Uploading the Application . . . . . . . . . . . . . . . . . 118
nc...
I
E.5 Executing the LIN HID Demo Application . . . . . . . . . . . . . . . .120
cale Semiconductor,
Frees
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA 7
For More Information On This Product,
Go to: www.freescale.com
Page 8
Freescale Semiconductor, Inc.
nc...
I
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
8 MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 9
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047
Figure Title Page
1-1 System Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
2-1 System Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
2-2 PC Master Software Principle. . . . . . . . . . . . . . . . . . . . . . . . . . 25
nc...
I
cale Semiconductor,
Frees
3-1 Master Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3-2 Master Board Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3-3 LIN Stepper (Slave) Board . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
3-4 LIN Stepper Controller (Slave) Board Schematic . . . . . . . . . . .30
3-5 908E625 Blocks Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31
5-1 Software State Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41
5-2 PC Master Mode Data Flow Chart - Part1 . . . . . . . . . . . . . . . . 44
5-3 PC Master Mode Data Flow Chart - Part2 . . . . . . . . . . . . . . . . 46
5-4 Master Mode Data Flow Chart . . . . . . . . . . . . . . . . . . . . . . . . . 47
5-5 Debug Mode Data Flow Chart . . . . . . . . . . . . . . . . . . . . . . . . .49
5-6 Pass Mode Data Flow Chart. . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6-1 LIN Stepper Software - Data Flow 1. . . . . . . . . . . . . . . . . . . . . 53
6-2 Motor Position and Speed Control - Service
Updated Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6-3 Motor Position and Speed Control - Service
Updated Actual Position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57
6-4 Frequency Acceleration and Deceleration - Flow Chart . . . . . . 58
6-5 LIN Stepper Software - Data Flow 2 - Configuration . . . . . . . .61
6-6 LIN Stepper Software Application State Diagram. . . . . . . . . . . 63
7-1 PC Master Software Main Page . . . . . . . . . . . . . . . . . . . . . . . .72
7-2 LIN-bus Control Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75
7-3 Recorder Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78
7-4 Oscilloscope Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
7-5 Programming and Configuration Page . . . . . . . . . . . . . . . . . . .84
8-1 Slow-Fast Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
8-2 Low-High (Amplitude) Signal . . . . . . . . . . . . . . . . . . . . . . . . . . 88
List of Figures
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA 9
For More Information On This Product,
Go to: www.freescale.com
Page 10
Freescale Semiconductor, Inc.
8-3 Road1 Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
A-1 LIN Master Board Schematic . . . . . . . . . . . . . . . . . . . . . . . . . .93
A-2 LIN Enhanced Stepper Board Schematic. . . . . . . . . . . . . . . . .94
B-1 908E625 Simplified Block Diagram . . . . . . . . . . . . . . . . . . . . . 95
C-1 Configuration Parameters Addressing . . . . . . . . . . . . . . . . . .108
E-1 LIN HID Demo Application . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
E-2 Programming and Debugging Application - Detail . . . . . . . . .117
E-3 Metrowerks Compiler with lin_stepper.mcp . . . . . . . . . . . . . . 119
E-4 Bootloader Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120
E-5 Communication Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121
E-6 Variables Source page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122
nc...
I
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
10 MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 11
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047
Table Title Page
3-1 Connector J2 Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32
3-2 Connector J3 Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
3-3 Connector J4 Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
nc...
I
5-1 Debug Line Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
6-1 Stepper Controller Software Memory Utilization. . . . . . . . . . . .70
7-1 LIN-bus Control Page and Variable Watch Variables
Comparison - Loop1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
7-2 LIN-bus Control Page and Variable Watch Variables
Comparison - Loop2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7-3 LIN-bus Control Page and Variable Watch Variables
Comparison - Status Notes and State Buttons . . . . . . . . . . . . .83
C-1 LIN Leveller Messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
C-2 LIN Leveller Configuration Frames . . . . . . . . . . . . . . . . . . . . .103
D-1 Stepper Controller Software Data Variables. . . . . . . . . . . . . .111
E-1 Master and Slave Boards Jumper Settings . . . . . . . . . . . . . .117
cale Semiconductor,
List of Tables
Frees
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA 11
For More Information On This Product,
Go to: www.freescale.com
Page 12
Freescale Semiconductor, Inc.
nc...
I
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
12 MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 13
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047

1.1 Overview

This reference design describes the development of a LIN based High Intensity Discharge (HID) headlamp levelling system, which controls the stepper motors in the lamp module to compensate for the motion of the
nc...
I
vehicle. (In this implementation, the vehicle’s movement is simulated on a PC). The design consists of a master control board that is based on a 16-bit HCS12 MCU, a PC with graphical user interface (GUI) and slave nodes that control the levelling stepper motors (see Section 2. System Concept for a full description). The slave nodes are driven by an innovative dual-die product (908E625) that contains an industry-standard FLASH based, M68HC08 MCU and an SMOS power die that includes VReg, LIN interface, Hall Sensor interface and high-side and low-side drivers. (See appendices and data sheet for additional information.)
cale Semiconductor,

Section 1. Introduction

.
Frees
Figure 1-1. System Concept
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Introduction 13
For More Information On This Product,
Go to: www.freescale.com
Page 14
Introduction

1.2 Summary

nc...
I

1.3 HID Headlamp Levelling

cale Semiconductor,
Frees
Freescale Semiconductor, Inc.
The concept of HID lighting levelling, the LIN-bus protocol, and the general system concept are given to provide the reader with some valuable background information. The hardware and software (for both master and slave) are described in detail to allow the design and implementation to be fully understood. Finally, a description of the user interface is provided to demonstrate the ease of use and flexibility of the system.
The reference design demonstrates that the HID lamp levelling system can be controlled over the LIN-bus, and that several system benefits can be achieved using this method, compared with the conventional wired implementation. These benefits include system configuration, as the software and parameters can be updated over the LIN-bus, and scalability, as it is easier to add functions to a bus-based application. In addition, using the 908E625 dual-die device offers a low-cost implementation, as the system cost is reduced due to the minimal external hardware required. The 908E625 provides all the functions necessary to implement the slave nodes, and its small footprint and on-board FLASH make this device ideal for many stepper motor control applications.
At the present time, car front lighting systems are changing rapidly. There are many techniques that can improve visibility under low light conditions. One of the requirements is automatic vertical beam control. This is necessary for headlamps based on discharge lamps.
Other systems are Bi-Xenon headlamps. Today’s Bi-Xenon headlamp operates with one single Xenon bulb and creates both low beam and high beam. The cut-off is generated via a special shield, which can be flipped. The shield control is provided by means of an actuator, which can be a motor or a solenoid.
Designer Reference Manual DRM047 — Rev 0
14 Introduction MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 15
Freescale Semiconductor, Inc.
The low beam of today’s headlamps is characterized by a specific shape and distribution regulated by ECE regulations. Independent of the speed, the type of road, and the weather conditions, the headlamps of today are always constant. But we will have next generations Advanced Front Lighting (AFS) systems soon. A new lighting system can be adopted to this various conditions. The target is to achieve better visibility at night, when directing the lights according to the steering wheel angle or due to the speed. To see where the car is going, rather than putting the light always straight, is the background of this idea. So we have horizontal beam control. Other systems use an auxiliary bending lamp. See Section 9. References: 3, 4, 5, 6, 7, and 8.
Introduction
LIN-bus
nc...
I

1.4 LIN-bus

cale Semiconductor,
Frees
Advanced headlamp systems are quite complex. They need sophisticated optics, sensors and actuators. So, today the system costs targets their implementation to high-end car segments. If we lower the cost, we spread them to all car segments. A key factor in lowering the system cost is integration and the use of reasonable components and protocols.
This reference design describes a good solution for headlamp levelling systems based on stepper motor actuators with a possibility of vertical and also horizontal beam control. The system can benefit from a single chip solution and communication via low-cost LIN-bus protocol.
All modern car electronic communication is based on serial bus protocols. These have many advantages over classical wired systems. For example, a control system with stepper motor actuators can be split into distributed controllers connected with a single-wire bus. There is no doubt that this bus system saves on wiring and connectors, so the system cost is significantly reduced.
The LIN-bus serial communication protocol (see Section 9.
References, 2) was designed for automotive applications, but it can also
be used for other devices (white-goods, printers, and copiers, for example). In the case of car-body electronics, it is used for air-conditioning, mirror control, seat control, and light levelling. The
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Introduction 15
For More Information On This Product,
Go to: www.freescale.com
Page 16
Introduction
nc...
I
Freescale Semiconductor, Inc.
advantage of LIN-bus over other bus protocols (like CAN) is low system cost. This is because the LIN-bus protocol is based on standard and cost-effective serial SCI (UART compatible) hardware modules. These are implemented on most Motorola MCU/DSP devices. An enhanced SCI is called ESCI.
Other serial bus protocols like CAN require a specialized hardware module. They can have higher communication speed than LIN-bus. But the overall system cost of such systems is much higher. Therefore many of car electronics systems should be based on LIN-bus protocol.
This reference design shows that the LIN-bus protocol speed is fully sufficient for a headlamp leveller with a stepper motor actuators. The advantage versus other bus protocols, such as CAN-bus, is low system cost.

1.5 Definitions and Acronyms

The definitions and acronyms used in this reference design are listed below.
(signal) Acceptor the device which receives and responses to
AFS Advanced Front Lighting System
Cairone see Power Die
cale Semiconductor,
ESCI Enhanced Serial Communication Interface
DSP Digital Signal Processor
Frees
ECT Enhanced Capture Timer
HID Lamp High Intensity Density headlamp
LIN Leveller the system described in this reference
a bus signal
design. It consists of the LIN master and LIN stepper controllers
LIN-bus a local interface network standard for serial
asynchronous communication (see Section 9. References, 2)
Designer Reference Manual DRM047 — Rev 0
16 Introduction MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 17
Freescale Semiconductor, Inc.
LIN Master master board with LIN master software
LIN Master Software the LIN-bus master software for stepper
LIN SIO Wire LIN-bus signal (Serial Input Output) wire
LIN Stepper Controller LIN-bus slave board with General Purpose
LIN Stepper Software the LIN-bus slave stepper motor control
LIN Stepper Board slave stepper board hardware for LIN slave
nc...
I
Introduction
Definitions and Acronyms
motors control and communication
IC 908E625 with LIN Stepper software
software for 908E625 described in this AN
stepper controller. The PCB layout is same as LIN Enhanced Stepper Board. Some parts are not populated.
cale Semiconductor,
Frees
LIN Enhanced Stepper Board
LIN Master Board master board hardware for LIN Master
MCU microcomputer unit
PCB printed circuit board
Power Die part of 908E625 with H-bridges LIN
SCI Serial Communication Interface module
(signal) provider the device which send the slave task of the
slave stepper board hardware for LIN Master with sensor connector and other components
physical layer high-side switch connected to the MCU part with SPI interface. In some references, the Power Die chip is called Cairone
(outside Motorola called also UART)
bus signal
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Introduction 17
For More Information On This Product,
Go to: www.freescale.com
Page 18
Introduction
nc...
I
Freescale Semiconductor, Inc.
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
18 Introduction MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 19
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047
The system application was designed to control stepper motor actuators from a GUI running on a PC. The PC is connected to the LIN Master board via RS232 serial ports and they form the master controller. The LIN Master board is then connected to the LIN Stepper Controller slaves via a serial single-wire LIN-bus. The master controller can handle
nc...
I
several stepper motor actuators, so it can demonstrate levelling of two headlamps around vertical and horizontal axes. Each actuator consists of one stepper motor and LIN Stepper Controller slave node. The actuators control positioning around a dedicated axis.

Section 2. System Concept

cale Semiconductor,
Frees
The control system consists of the following modules:
Personal Computer
LIN Master – LIN master node
LIN Stepper Controller – LIN slave node
Each module is programmed with dedicated software.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA System Concept 19
For More Information On This Product,
Go to: www.freescale.com
Page 20
System Concept
Freescale Semiconductor, Inc.
RS232
RS232
LIN Master Board
LIN Master Board
LIN physical
LIN physical
interface
interface
HC12 CPU
HC12 CPU
RS-232
RS-232
Application Control GUI
Application Control GUI
pc master s/w
pc master s/w
Master HC12 S/W
Master HC12 S/W
LIN Stepper
LIN Stepper
Slave HC08 S/W
Slave HC08 S/W
LIN bus
LIN bus
Stepper
Stepper
LIN Stepper Controller
LIN Stepper Controller
Axis 2
Axis 2
LIN Stepper Board
LIN Stepper Board
PM908E625
PM908E625
Stepper
Stepper
Axis 3
Axis 3
nc...
I

2.1 System Features

cale Semiconductor,
Frees
Program/
Program/
Debugging
Debugging
Interface
Interface
Stepper
Stepper
Axis 1_1
Axis 1_1
Head Lamp R Head Lamp L
Head Lamp R Head Lamp L
Stepper
Stepper
Axis 1_2
Axis 1_2
Figure 2-1. System Concept
LIN-bus Interface rev 1.2
Bus speed 19.2 kbps
Slave IC without external crystal or resonator
Slave node clock synchronization ±15%
Each LIN slave controls one biphase bipolar stepper motor
Motor phase current limitation up to 700 mA
Supply voltage 12 V d.c.
Stepper motor control with stepping acceleration and deceleration ramp
Stepping frequency up to 2500 Hz
Slave parameters configuration via LIN-bus
Slave LIN signals reconfiguration via LIN-bus
LIN signals defined for 2D control with 3 (and “half”) axes
Embedded code written in C-language
Designer Reference Manual DRM047 — Rev 0
20 System Concept MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 21

2.2 LIN Stepper Controller

nc...
I
Freescale Semiconductor, Inc.
The LIN Stepper Controller is the LIN-bus slave node. It does the following:
controls bi-phase bipolar stepper motors to a required position
communicates with the master node via LIN-bus
provides LIN-bus clock synchronization (the slave node uses
provides parameters configuration/programming via LIN-bus
provides LIN signals reconfiguration via LIN-bus to a required axis
System Concept
LIN Stepper Controller
with automatic speed acceleration and deceleration
internal on-chip oscillator with no external components)
when requested by LIN-bus configuration signals
when requested by LIN-bus configuration signals
cale Semiconductor,
Frees
All the necessary hardware of this LIN-bus slave node is comprised in one SOIC 54-lead packaged 908E625, with some external connectors and capacitors. The 908E625 includes the Motorola M68HC08 core, and its functionality is determined by the LIN Stepper software.
The software provides all control functionality for stepper positioning control. The absolute required position and maximum speed are determined by LIN signals from the master.
The LIN Stepper Controller clock is based on an internal RC on-chip oscillator. Therefore, the LIN-bus driver (using the ESCI module on 908E625) can handle the LIN-bus clock synchronization range according to the LIN-bus specification 1.2. (see Section 9. References,
2)
The LIN stepper controller has the capability to change some configuration parameters via the LIN-bus. These parameters can be stored in FLASH memory. For this purpose, there are LIN-bus configuration signals (Master Request and Slave Response frames — see Section 5. LIN Master Software Description) defined for the system.
node ID number (0 to 255)
uAppConfigByte1
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA System Concept 21
For More Information On This Product,
Go to: www.freescale.com
Page 22
System Concept
nc...
I
Freescale Semiconductor, Inc.
motor block and run current limitation
motor stepping start frequency
motor stepping acceleration
period motor stop time-out
motor stall position
motor parking position
motor position correction
Four groups of LIN signal frames are defined to control the dedicated axis:
Axis 1_1 (to be used as horizontal axis, right lamp) signals group
cale Semiconductor,

2.3 LIN Master

Frees
Axis 1_2 (to be used as horizontal axis, left lamp) signals group
Axis 2 (to be used as vertical axis, right lamp) signals group
Axis 3 (to be used as vertical axis, left lamp) signals group
The reconfiguration of the LIN signals (see above) means that the slave can be programmed to be active only on one of the four signal groups (so it ignores signals for other actuators). This signal group can also be chosen from the LIN-bus master with the LIN-bus configuration signals (Master Request and Slave Response frames). The benefit of this solution is that there can be one universal controller software for any axis actuator. It can then be configured via LIN-bus for any axis, as required.
The function of the master board depends on the selected mode, chosen by means of a jumper on the board (see Section 3.1. Master Board).
The modes are as follows:
PC master mode (PCM)
Master mode (M)
Debug mode (D)
Pass mode (P)
Designer Reference Manual DRM047 — Rev 0
22 System Concept MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 23
2.3.1 PC Master Mode
nc...
I
Freescale Semiconductor, Inc.
The master board is connected via an RS232 line to the PC (with installed PC master software), and acts as a LIN Master node controlled by the user interface (HTML page).
The LIN Master performs the following functions:
LIN-bus Run/Stop/Sleep/Wake-up control
Periodical sending/receiving of up to 2*3 LIN-bus frames within
Possibly fully control the position of up to two independent LIN
Manual or automatic generation of the required position of LIN
System Concept
LIN Master
two timing loops
steppers
stepper. In the case of automatic generation, a read-out of a predefined signal curve (simulation of real application) is provided
2.3.2 Master Mode
cale Semiconductor,
2.3.3 Debug Mode
Frees
LIN Stepper configuration and programing (using master request, slave response frames defined for this application)
The master board acts as a an autonomous LIN Master node (without using a personal computer). It is similar to the PC master mode in automatic mode (automatic generation of the required position of the LIN Stepper).
In this mode it is possible to program and debug any LIN Stepper controller via a special 10-pin connector. The LIN Master performs the following two functions:
it gives some defined signals to the 10-pin connector to put the LIN Stepper controller into MON08 debugging mode (see Section 9.
References, 10, Section 10. Monitor ROM).
it provides a serial communication gateway between the personal computer (using RS232 line) and the 10 pin connector
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA System Concept 23
For More Information On This Product,
Go to: www.freescale.com
Page 24
System Concept
2.3.4 Pass Mode

2.4 Personal Computer

nc...
I
Freescale Semiconductor, Inc.
The personal computer provides software download or debugging with a dedicated programming (e.g. Pemicro) or debugging software (e.g. Metrowerks Hiwave Debugger)
Master board acts as a gateway between RS232 and LIN-bus (copy signals between RS232 and LIN-bus). The mode can be used, if LIN-bus protocol is implemented in the personal computer.
The personal computer is used for application control using a graphical user interface. The PC host computer communicates with the LIN Master via the RS232 serial port.
cale Semiconductor,
Frees
The graphical user interface is implemented as an HTML script running on PC master software (see Section 9. References, 1). The PC master software is a universal software tool for communication between the personal computer and embedded applications based on an MCU or DSP. The principle of the PC master software is shown in Figure 2-2.
Designer Reference Manual DRM047 — Rev 0
24 System Concept MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 25
Freescale Semiconductor, Inc.
nc...
I
System Concept
Personal Computer
Personal Computer
GUI Control Page - html
LIN Master API
transferred LIN Master variables (any)
PC master software
RS232
LIN Master
LIN Master software
PC master software Driver
cale Semiconductor,
Frees
LIN Master variables
Master Application
Figure 2-2. PC Master Software Principle
It consists of a PC master software running on a PC and a PC master software driver with protocol implementation running on the LIN Master. The driver is implemented as a resident software routine (interrupt based) included in the LIN Master software. The communication medium is RS232 in this headlamp levelling application.
The basic feature of the PC master software is that all the MCU/DSP variables can be easily transferred to the personal computer for reading or modification. The user can simply specify which of them will be read/modified and the period of each variable reading.
NOTE: The PC master software provides a communication layer between any
LIN Master software variables and the graphical interface control page, which is written in HTML language.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA System Concept 25
For More Information On This Product,
Go to: www.freescale.com
Page 26
System Concept
nc...
I
Freescale Semiconductor, Inc.
The LIN Master application interface (API) is then a defined set of LIN Master variables. The GUI is then realized as an HTML script file, which reads/modifies the variables in the API. The graphical user interface is described in Section 7. User Interface Description.
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
26 System Concept MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 27
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047

3.1 Master Board

The master board (Figure 3-1) is supplied with 12 V from an external source and can switch LIN supply currents up to 5 A. It can be used in four different modes, as described in Section 2.3. LIN Master,
nc...
I
depending on position of the jumper on the MODE SELECTION header (currently PCM -> PC master mode). After each change of mode, the RESET button must be pressed.

Section 3. Hardware Description

cale Semiconductor,
Frees
MODE SELECTION
RS232
MONs
Figure 3-1. Master Board
BUTTON
DEBUG
+12V
LINRESET
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Hardware Description 27
For More Information On This Product,
Go to: www.freescale.com
Page 28
Hardware Description
The heart of the system (see Figure 3-2) is the 16-bit MC9S12DP256B MCU (see Section 9. References, 12), which is supported by the bus drivers and power stage. The MC33399 (see Section 9. References,
11) is used as the LIN interface, and can drive up to 16 slaves.
Freescale Semiconductor, Inc.
nc...
I

3.2 Slave Board

cale Semiconductor,
Frees
RS232 physical interface
RS232
+12V
This board is protected against incorrect supply voltage polarity and provides this feature to all LIN Stepper Controllers supplied by the Master Board.
The LIN Stepper Controller hardware is based on the 908E625 device. The hardware consists only of few components as shown in Figure 3-3. It is due to the fact that all the functionality is provided by the 908E625 device.
Power stage
Figure 3-2. Master Board Concept
Microcontroller
MC9S12DP256B
Debug physical interface
LIN physical interface
Debug
LIN
Designer Reference Manual DRM047 — Rev 0
28 Hardware Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 29
Freescale Semiconductor, Inc.
J2 - Debugging
J2 - LIN
Hardware Description
Slave Board
J3 - Motor
nc...
I
cale Semiconductor,
Frees
Figure 3-3. LIN Stepper (Slave) Board
CAUTION: A slave board based on 908E625 can be even smaller than the LIN
Enhanced Stepper Board. The PCB from Figure 3-3 is universal. The sensor support - connector J4 and resistors R2, R1 from Figure A-2 are not populated. It ‘s because they are not used for current LIN Stepper Controller with the LIN Stepper software. Also the LED diode D1, R4 and headers J5, J6 are not necessary for system functionality.
The PCB layout was designed as an universal LIN Enhanced Stepper Board according the schematics in Figure A-2. It has some additional sensor inputs. This could be used for some applications with a Hall sensor or analog signal feedback.
The LIN Stepper Controller does not use any sensor feedback. The schematics of the LIN Stepper Board s displayed in Figure 3-4. It uses the LIN Enhanced Stepper Board PCB layout, but some components are not populated.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Hardware Description 29
For More Information On This Product,
Go to: www.freescale.com
Page 30
Hardware Description
J1
VSUP_LIN
1
3
2
4
POWER_HDR4
J2
10 9 8 7 6 5 4 3 2
JP1
HDR 2X1
1
IRQ_IN
1
IRQ_RQ
2
nc...
I
CON/10MICROMATCH
cale Semiconductor,
1
J5 HDR 1
PTB4/AD4 PTB3/AD3 PTA1/KBD1 PTA0/KBD0 RST IRQ_RQ IRQ_IN VDD VSS PTC4/OSC
Freescale Semiconductor, Inc.
+
C2 330u/35
C1 100p
GND
VDD
BEMF FGEN
VDD_A
C4 100n
VDD_A
VSS_A VSS
C3 100n
SSB
SensorA1 SensorA2
RST
U1
20
LIN
42
PTE1/RxD
41
RxD
54
PTA0/KBD0
53
PTA1/KBD1
52
PTA2/KBD2
50
PTA3/KBD3
49
PTA4/KBD4
14
PTA6/SSB
11
PTB1/AD1
8
PTB3/AD3
7
PTB4/AD4
6
PTB5/AD5
2
PTB6/AD6/TBCH0
1
PTB7/AD7/TBCH1
5
PTC2/MCLK
4
PTC3/OSC2
3
PTC4/OSC1
12
PTD0/TACH0/BEMF
13
PTD1/TACH1
10
RSTB_MCU
17
RSTB_SMOS
9
IRQB_MCU/FLSEPGMN
51
FLSVPP
48
VREFH
47
VDDA
46
EVDD
43
VREFL
44
VSSA
45
EVSS
VSUP
27
24
VSUP
VSUP
GND
GND
30
25
PM908E625ACDWB
GND
31
VSUP
IRQB_SMOS
GC3 CON
HVDD
VDD
FGEN
BEMF
HB1
HB2
HB3
HB4
PA1
VSS
SSB
23
26
29
32
28
HS
39
37
H1
36
H2
35
H3
34
38
+
40
18
19
15
16
33
NC
22
NC
21
NC
C5
2u2/10
IRQ_RQ
SSB
FGEN
BEMF
GC2 CON
GC1 CON
VDD_A
VDD
VSS
VSS_A
Figure 3-4. LIN Stepper Controller (Slave) Board Schematic
The 908E625 schematics with the LIN Stepper Controller functional blocks is in Figure 3-5. The he functional blocks are described below.
VDD_A
1
2
3
4
5
6
VDD
J3
HDR 6X1
R4 1k5
D1
LED_YELL
Frees
3.2.1 MCU and Power Die with SPI
MCU 908EY16 chip and Power Die chip (Cairone) forms the 908E625 device in one package. These two chips are connected with SPI signals and some other signals. So the control of the Power Die (like Half-bridges control) is provided with SPI communication. The SPI communication pins MISC, MOS, SPCLK are connected inside of the 908E625 package (see Section 9. References, 9).
Designer Reference Manual DRM047 — Rev 0
30 Hardware Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 31
Freescale Semiconductor, Inc.
MCU 908EY16 Power Die
nc...
I
SPI
Hardware Description
Slave Board
Stepper Motor
3.2.2 LIN-bus
cale Semiconductor,
Frees
H-bridge
LIN-bus
Figure 3-5. 908E625 Blocks Usage
The LIN-bus is connected to the connector J1. The capacitor C1 filters the bus and the signal is connected to the pin LIN (20) of the physical layer. The physical layer is internally connected to the PT0/TXD pin of the MCU chip. The PTE1/RXD pin 40 is connected to RxD pin 41 externally. The IRQB_SMOS pin 18 from the Power Die module and IRQB_MCU pin 9 are used to initiate MCU interrupt from the Power Die chip. In LIN Stepper Controller this is used for MCU wake up from the sleep via wake-up. Therefore jumper JP1 must be connected for user (standard operational) mode.
Sensors
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Hardware Description 31
For More Information On This Product,
Go to: www.freescale.com
Page 32
Freescale Semiconductor, Inc.
Hardware Description
3.2.3 Software Download and Debugging
Connector J2 is used for software download or debugging. This is based on so called MON08 mode (see Section 9. References, 10, Section 10 Monitor ROM)
The signals PTB4/AD4, PTB3/AD3, PTA1/KB1, PTA0/KB0, IRQ_IN must be set according to Table 3-1 to put the MCU into MON08 mode for software download or debugging (see Section 9. References, 10). RST is the MCU reset pin. The MON08 mode must be timed with external clock - PTC4/OSC.
There must be 9V for debugging on the IRQ_IN pin. Therefore the
nc...
I
jumper JP1 must be open. In user (standard operational) mode the IRQ_IN must be attached to the IRQ_OUT from the Power Die module. This is used for some operations like wake-up condition, where the Power Die module. Therefore JP1 must be closed for user (standard operational) mode.
cale Semiconductor,
Frees
external clock source for the software download and debugging.
Table 3-1. Connector J2 Signals
Pin1 PTC4/OSC is precise clock input for MON08 mode. There must be
Pin No
1 PTC4/OSC 19,6608kHz
2 VSS Ground GND
3 VDD 5V supply 5V
4 In IRQ_IN MCU IRQ Input 9V
5 Out IRQ_RQ
6 In RST MCU Reset input falling edge
7In/Out
8In
Input/
Output
Pin Name Description MON08 mode
PTA0/KB0
PTA1/KB1
Power Die IRQ
output
MON08 mode
MON08 mode GND
jumper JP1 open
serial
communication
19.200 kBaud
9In
Designer Reference Manual DRM047 — Rev 0
32 Hardware Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
PTB3/AD3
MON08 mode GND
Page 33
Freescale Semiconductor, Inc.
Table 3-1. Connector J2 Signals
Hardware Description
Slave Board
Pin No
10 In
Input/
Output
Pin Name Description MON08 mode
PTB4/AD4
3.2.4 Stepper Motor Dual H-bridge and High Side Switch
The bi-phase bipolar stepper motor is powered with four half-bridges. They are attached to the connector J3. The connector pin 6 is high side switch which can possibly be used for lamp on/off control
nc...
I
Table 3-2. Connector J3 Signals
Pin No Input/Output Signal range
1GND GND GND
2Out
3Out
4Out
5In
6 In High Side 0-5V
cale Semiconductor,
3.2.5 Power Supply and Decoupling
Frees
The LIN Stepper Controller is powered from LIN-bus connector. The Power Die has internal voltage regulator with the outputs VDD(pin30) and VSS (pin 40). This is used to power the analog VDDA,VSSA and digital part EVDD,EVSS of the MCU chip. The connections and capacitors C5, C4 were used for decoupling VDD,VSS_A from VDD_A,VSS_A
MON08 mode
HB1
motor phase 1-1
HB2
motor phase 1-2
HB3
motor phase 2-1
HB4
motor phase 2-1
Vdd = 5V
(via 10k resistor)
0-5V
0-5V
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Hardware Description 33
For More Information On This Product,
Go to: www.freescale.com
Page 34
Freescale Semiconductor, Inc.
Hardware Description
3.2.6 Hall Port and Sensor
The LIN Stepper Controller does not use any sensors. Therefore the connector J4 is not displayed in Figure 3-4. However the LIN Enhanced Stepper Board (Figure A-2) was designed for possible use of Hall sensors or analog signals. There is a place for connector J4, resistors R2, R1.
Table 3-3. Connector J4 Signals
Pin No Input/Output Signal range
1 GND VSS_A GND
nc...
I
cale Semiconductor,
Frees
2 In Sensor Analog 1 0-5V
3 In Sensor Hall 1
4 In Sensor Analog 1 0-5V
5 In Sensor Hall 2
6 In Sensor Power Analog 1 0-5V
7 In Sensor Hall 3
8 Output
HVDD Switchable 5V
output to power sensors
5V
Designer Reference Manual DRM047 — Rev 0
34 Hardware Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 35
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047

Section 4. Messaging Scheme Description

This section describes LIN messaging.

4.1 Axis and Signal Providers and Acceptors

nc...
I
cale Semiconductor,
Frees
As shown in Figure 2-1, each LIN Stepper Controller node has a relation to the concrete controlled axis. The LIN messaging scheme was designed to support this concept. Most of the signal in Table C-1 has 3 or 4 modification, which differs only with the identifier byte. Each node is programmed to be an acceptor (acts upon) and providers (sends the response fields) for one exclusive signal set. The signal sets are marked according to the controlled axis:
•A1_1
•A1_2
•A2
•A3
The signal provider and acceptor is determined by the preprogrammed axis.
A special meaning is given to the horizontal Axis1. It is expected that one control signal is sufficient for both right and left headlamp. Therefore two nodes with signal sets Axis1_1 and Axis1_2 are acceptors for Axis1 signals. This uses and demonstrates the LIN-bus multicast concept.
There are two ways to program the LIN Stepper Controller node to a dedicated axis:
1. Setting appropriate target Axis1_1, Axis1_2, Axis2, Axis3 in the lin_stepper.mcp file. This will create the compiled code with the required setting.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Messaging Scheme Description 35
For More Information On This Product,
Go to: www.freescale.com
Page 36
Freescale Semiconductor, Inc.
Messaging Scheme Description
2. using LIN reconfiguration as described in Appendix C.3. LIN
NOTE: The user must guarantee that there will be no other nodes with the same
axis connected to one LIN-bus.

4.2 LIN Leveller Basic Messaging

The basic message frames are used for standard control operation. The frame provided by master node is:
frmPosCmd
nc...
I
The frames provided by slave nodes are:
Leveller Configuration Frames or Section 6.1.9. Reconfig LIN.
cale Semiconductor,
Frees
frmPosStatus
frmAppStatus
A detailed description of the basic messaging frames and signals is in Appendix C.1. LIN Leveller Basic Frames.
The scheduling of the signals is determined by the LIN Master. The LIN Master setting is provided from the PC computer control page and is described in the Section 7. User Interface Description. The master serves two messaging loops. Each loop can handle up to three signal frames (frmPosCmd, frmPosStatus, frmAppStatus). Each of the three signal frames can be chosen according to a required axis. Any of the three frames can be disabled.
Loop1 sends signals with period periodeSend_Loop1. This period can be modified by the control page (see Figure 7-2). If all three frames are enabled, the LIN Master controls consecutive sending of Loop1 frames frmPosCmd, frmPosStatus, frmAppStatus immediately after each other. Then it waits to get the periodeSend_Loop1 between sending. If Loop2 is also enabled, the three frames of Loop2 are sent after Loop1. The details are described in the Section 7. User Interface Description. The default value of the periodeSend_Loop1 is 30 ms.
Designer Reference Manual DRM047 — Rev 0
36 Messaging Scheme Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 37
Freescale Semiconductor, Inc.

4.3 LIN Leveller Configuration Messaging

The Master Request and Slave Response frames are used for the LIN Stepper Controller configuration. The configuration allows adaptation of the LIN Stepper software. Each configuration frames is used to configure the LIN Stepper Controller with node ID equal to the l_u8_rd_nodeID signal (see Appendix C.3. LIN Leveller Configuration Frames).
The configuration process covers two functions:
Parameters Configuration
provides upload and download of the control parameter.
nc...
I
LIN Reconfiguration
Messaging Scheme Description
LIN Leveller Configuration Messaging
cale Semiconductor,
Frees
changes the dedicated LIN Stepper Controller configuration. It sets its LIN driver to select the frames and signals according to the defined axis.
A detailed description of the configuration messaging frames and signals is in Appendix C.1. LIN Leveller Basic Frames, Appendix C.3. LIN Leveller Configuration Frames.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Messaging Scheme Description 37
For More Information On This Product,
Go to: www.freescale.com
Page 38
Freescale Semiconductor, Inc.
Messaging Scheme Description
nc...
I
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
38 Messaging Scheme Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 39
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047

Section 5. LIN Master Software Description

The software is described in terms of:
General State machine diagram
Data flow chart for each Master Board mode
nc...
I

5.1 State Machine

5.1.1 MCU Initialization
cale Semiconductor,
Frees
5.1.2 Mode Selection
Figure 5-1 presents a general description of the implemented software.
The main routine consists of MCU Initialization and Mode selection procedures.
Provides initialization of the microcontroller:
Ports A, H (pull-up/pull-down), M (wired-or), P (pull-up), S initialization
Phase Locked Loop setup (Core is running on 48MHz)
Enable global interrupt mask bit
Act as a device mode selection module. It tests the Port A (MODE SELECTION header, see Section 3.1. Master Board) as long as one out of four possible values (each of them is corresponding to one mode) is recognized. The corresponding subroutine is initialized. In that routine the program is running until reset or power die event. The modes were described in Section 2.3. LIN Master.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Master Software Description 39
For More Information On This Product,
Go to: www.freescale.com
Page 40
Freescale Semiconductor, Inc.
LIN Master Software Description
5.1.3 PC Master Mode Initialization
The actions are following:
Turn on LIN supply voltage
Initialize SCI1 and PC master software driver
Initialize LIN driver (including initialization of SCI0 and ECT
Set up ECT (each channels acts as an output compare and
nc...
I
channel0)
causes the corresponding interrupt):
channel1 (Loop1 timing)
channel2 (Loop2 timing)
cale Semiconductor,
Frees
channel3 (PC master software recorder)
Set all program flow control and state variables
Designer Reference Manual DRM047 — Rev 0
40 LIN Master Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 41
Freescale Semiconductor, Inc.
LIN Master Software Description
State Machine
Timer Channel 3 Interrupt
Run
PC master
Recorder
PC master Interrupt
Reload
nc...
I
variables
Programming and Configuration request
Send/Receive
Programming and
Configuration
frames
5.1.4 Master Mode Initialize
cale Semiconductor,
Frees
Reset
Mode Init
Control LIN communication
according to change of variables
by means of PC master
Run request
Enable
Periode timing
interrupts
Wait for
Periode timing
interrupts
MCU Init
Sleep/Wake request
Send/Receive
LIN frames
PC master mode
Send
Sleep/Wake-up
LIN frames
Mode
Selection
Master mode
Mode Init
Debug mode
Wait for
Periode timing
interrupt
Send/Receive
LIN frames
Pass mode
between RS232 and LIN
Mode
Init
Exchange data
between RS232 and
Debug line
Figure 5-1. Software State Diagram
Performs:
Turn on LIN supply voltage
Initialize LIN driver (including initialization of SCI0 and ECT channel0)
Mode
Init
Exchange data
Set up ECT channel1 (Loop1 timing) as an output compare
Enable ECT channel1 output compare interrupt
Set all program flow control and state variables
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Master Software Description 41
For More Information On This Product,
Go to: www.freescale.com
Page 42
Freescale Semiconductor, Inc.
LIN Master Software Description
5.1.5 Debug Mode Initialization
Sets:
MONs according to pin states on Port P (see Figure 3-1)
All program flow control and state variables
5.1.6 Pass Mode Initialization
Turns on LIN supply voltage
nc...

5.2 Data Flow

I
Four possible modes of the Master Board are discussed below. Each mode is described with its dedicated flow charts. General overview is possible gain over Figure 5-1.
5.2.1 PC Master Mode Program Flow
After initialization, the Master Board performs the actions described in Section 2.3.1. PC Master Mode. The data flow charts are on Figure 5-2 and Figure 5-3. The meanings of the bubbles (states) are explained below.
cale Semiconductor,
5.2.2 Slave Sleep/Wake-up, Programming and Configuration
Replaces a function that is able to send and receive the frames below
Frees
according to the states of the control variables (displayed above the bubble) by the LIN-bus:
Sleep frame
Wake-up frame
Frames for configuration of the LIN-bus network
Programing parameters (displayed below the bubble) of LIN Stepper Controller
Designer Reference Manual DRM047 — Rev 0
42 LIN Master Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 43
The meanings of the variables above and below the bubbles are described in Section 7.7. Programming and Configuration excluding
LIN_SleepWakeReq, that is an element of Section 7.3. LIN-bus Control.
5.2.3 Loop1/Loop2 Priority Selector
If there is a request to communicate via the LIN-bus (LIN_RunStopReq), the Loop1 timer (ECT channel1 output compare register) is set according to the value of periodeSend_Loop1. That determinates the next LIN communication time. The Loop2 timer (ECT channel2 output
nc...
I
cale Semiconductor,
Frees
compare register) is set in the same way (periodeSend_Loop2) but only if the Loop2 is enabled (enableLoop2). Whenever the ECT channel1 or channel2 interrupt arises, the priority of the service routine executing (Send and Receive LIN messages) is resolved. Loop1 has the main priority. If a Loop2 interrupt arises, the time remaining to the Loop1 timer interrupt request is calculated. If it is recognized that the remaining time is greater or equal to the time needed to service the Loop2 service routine, then this process is enabled. In the opposite event, the task is deferred. Then, as soon as the Loop1 request is satisfied, it immediately services the Loop2 communication request. Note that there is one exception to this rule; i.e. when the time between Loop1 timer interrupts is always shorter than the time needed to service communication initialized by Loop2. Then the frames of both loops follow each other with minimal distances between them. The distance is determined by the program flow delay, and the distance is negligible in comparison to the time needed to transmit one LIN frame. Those states are indicated by a note on the LIN-bus Control page. The page and the variables mentioned in this subsection are described in Section 7.3. LIN-bus Control.
Freescale Semiconductor, Inc.
LIN Master Software Description
Data Flow
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Master Software Description 43
For More Information On This Product,
Go to: www.freescale.com
Page 44
Freescale Semiconductor, Inc.
LIN Master Software Description
UploadParam DownloadParam StoreParam MCUReset LINReconfig SendPositionCorrection
LIN_SleepWakeReq
No
Yes
Slave Sleep/Wake up,
nc...
I
Programming and
Configuration
LIN_RunStopReq
Loop1/Loop2
priority
LIN_Status
No
Yes
selector
SynchMode_Loop1
LOOP1_TIMER_Interrupt LOOP2_TIMER_Interrupt
enableLoop2
None
cale Semiconductor,
Frees
enableTxPosition_Loop1 enableRxPosStatus_Loop1
paramArray nodeID uAppConfiByte1 data0_3 currentBlockRun frequencyStart acceleration periodStopTimeout positionStall positionResetReq
positionReqManual_Loop1
configProgramError
enableRxStatus_Loop1
periodeSendMin_Loop1 periodeSend_Loop1
modeAutMan_Loop1
No
positionReq_Loop1
Loop1
Yes
autCurveSelect autReset_Loop1
Send and Receive
LIN messages
positionReqSent_Loop1 positionAct_Loop1 frequencyAct_Loop1 uAppFlags_Loop1 uAppErrFlags_Loop1 analogValue_Loop1
TxPositionError_Loop1
RxPosStatusError_Loop1 RxStatusError_Loop1
Loop2 Control
(Next page)
FieldOfPositions
frequencyReq_Loop1
ctrlFlag_Loop1
Figure 5-2. PC Master Mode Data Flow Chart - Part1
Designer Reference Manual DRM047 — Rev 0
44 LIN Master Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 45
Freescale Semiconductor, Inc.
5.2.4 Loop1/Loop2 Send and Receive LIN Messages
Replaces function that provides (see Section 5. LIN Master Software Description):
Send frmPosCmd
Receive frmPosStatus and frmAppStatus
All variables surrounding this bubble are described in Section 7.3.
LIN-bus Control.
5.2.5 Error Handling
nc...
I
Modules providing communication by the LIN-bus have incorporated error handling in terms of recognizing the presence or absence of the LIN Stepper Controller, and of no possibility of transmission (the LIN SIO wire is held by the supply source, e.g. shorted to ground or to supply wire).
cale Semiconductor,
LIN Master Software Description
Data Flow
Frees
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Master Software Description 45
For More Information On This Product,
Go to: www.freescale.com
Page 46
Freescale Semiconductor, Inc.
LIN Master Software Description
enableTxPosition_Loop2 enableRxPosStatus_Loop2 enableRxStatus_Loop2
periodeSendMin_Loop2 periodeSendReq_Loop2
Loop2 Control
nc...
I
cale Semiconductor,
5.2.6 Master Mode Program Flow
positionReq_Loop2 positionReqSent_Loop2 positionAct_Loop2
frequencyAct_Loop2 uAppFlags_Loop2
uAppErrFlags_Loop2 analogValue_Loop2
Figure 5-3. PC Master Mode Data Flow Chart - Part2
Frees
Loop2
Send and Receive
LIN messages
periodeSend_Loop2
positionReqManual_Loop2
frequencyReq_Loop2
ctrlFlag_Loop2
TxPositionError_Loop2
RxPosStatusError_Loop2 RxStatusError_Loop2
Provides actions described in Section 2.3.2. Master Mode. From
Figure 5-4, it can be seen that in this mode the functions dedicated to
Loop1 (Timing and Send and Receive LIN messages) are successfully applied. These are used in PC master mode.
Designer Reference Manual DRM047 — Rev 0
46 LIN Master Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 47
Freescale Semiconductor, Inc.
5.2.7 Loop1 Timing
Sets ECT channel1 output compare register and waits for interrupt; set by means of periodeMasterMode variable to 20ms.
5.2.8 Loop1 Send and Receive LIN Messages
Send frmPosCmd, receive frmPosStatus and frmAppStatus (see Section 5. LIN Master Software Description). All data in transmitted frames are predefined in MCU memory, including the required position of the LIN Stepper Controller HID lamp, which is the read-out from FieldOfPossition array - curve SLOW-FAST.
nc...
I
LIN Master Software Description
Data Flow
5.2.9 Error Handling
cale Semiconductor,
Frees
positionReqSent_Loop1 positionAct_Loop1 frequencyAct_Loop1 uAppFlags_Loop1 uAppErrFlags_Loop1 analogValue_Loop1
See Section 5.2.5. Error Handling
periodeMasterMode
Loop1
timing
Loop1
Send and Receive
LIN messages
LOOP1_TIMER_Interrupt
FieldOfPositions
frequencyReq_Loop1
ctrlFlag_Loop1
TxPositionError_Loop1
RxPosStatusError_Loop1 RxStatusError_Loop1
Figure 5-4. Master Mode Data Flow Chart
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Master Software Description 47
For More Information On This Product,
Go to: www.freescale.com
Page 48
Freescale Semiconductor, Inc.
LIN Master Software Description
5.2.10 Debug Mode Program Flow
A general overview may be gained from Section 2.3.3. Debug Mode and Figure 5-5.
5.2.11 Debug/Programming Control
The Master Board hardware (see Appendix A. Hardware Schematics) is prepared for using RxD, TxD, DTR and RTS RS232 signals, but software implementation is based on RxD, TxD, and DTR signals, where the DTR state is the determining function, i.e. either Debugging / Programming (DTR - low level, LIN supply voltage on) or Reset (DTR -
nc...
I
high level, LIN supply voltage off). Similarly, on the Debug line output, where the RSTB signal is not used, hardware allows it. Table 5-1 shows the Debug line pin assignments and the relationship to the RS232 line signals.
cale Semiconductor,
Frees
Pin number Pin name Pin type
1 CLOCK Output High impedance state 19,6608MHz clock
2 GND Power Ground Ground
3 VDD Output
4 \IRQOUT Output
5 \IRQIN Input +5V (pull-up) +5V (pull-up)
6RSTB
7 DATA Bidirectional TxD signal is held in low level
Table 5-1. Debug Line Output
DTR - High level
(Reset)
Connected to ground
(discharging capacitors of
Slave Board -> push supply
voltage line to 0V)
\IRQIN low level -> 0V
\IRQIN high level -> +5V
Input
(not used)
0V (pull-down) 0V (pull-down)
Master Board signals
DTR - Low level (Debugging and
programming)
Open collector output
(transistor is turned off)
\IRQIN low level -> 0V
\IRQIN high level -> +9V
Communication is opened,
RxD and TxD signals are
held in TTL levels
8 MON1 Output High impedance state
Designer Reference Manual DRM047 — Rev 0
48 LIN Master Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
(Set by JP1 on Master Board)
0V
Page 49
Freescale Semiconductor, Inc.
LIN Master Software Description
Table 5-1. Debug Line Output
Master Board signals
Data Flow
Pin number Pin name Pin type
9 MON2 Output High impedance state
10 MON3 Output High impedance state
DTR - High level
(Reset)
DTR - Low level (Debugging and
programming)
0V
(Set by JP2 on Master Board)
+5V
(Set by JP3 on Master Board)
Debug mode functionality was successfully tested at frequencies up to
nc...
I
cale Semiconductor,
20 kHz on the DATA pin.
MONs
PTP
Debug/Programming
Control
PTH
RS232
PTS
PTMPTA
LIN
Frees
Debug line
Figure 5-5. Debug Mode Data Flow Chart
5.2.12 Pass Mode Program Flow
Is based on an endless software loop, that copies the RxD signal (RS232) to the LIN SIO wire and then copies the LIN SIO wire signal back to TxD (RS232) (see Figure 5-6). Functionality of the Exchange
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Master Software Description 49
For More Information On This Product,
Go to: www.freescale.com
Page 50
Freescale Semiconductor, Inc.
LIN Master Software Description
data procedure was successfully tested with data speeds up to 20 kBaud.
nc...
I
RS232
PTS
Exchange
data
cale Semiconductor,
Frees
PTS
LIN
Figure 5-6. Pass Mode Data Flow Chart
Designer Reference Manual DRM047 — Rev 0
50 LIN Master Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 51
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047

Section 6. LIN Stepper Software Description

LIN Stepper Software is described in terms of:
LIN Stepper Software Data Flow
LIN Stepper Software Application State Diagram
nc...
I
Flow Charts
LIN Stepper Software Implementation
on the following pages

6.1 LIN Stepper Software Data Flow

Figure 6-1 and Figure 6-5 show the slave software data flow. It consists
of the processes described in following subsections.
The slave application control is processed according to LIN messages from the LIN driver. According to received messages x_rd_y, the application variables and states are set. The LIN messages are described in Section 5. LIN Master Software Description.
cale Semiconductor,
Detailed descriptions of the data variables are in Appendix D. LIN
Stepper Software Data Variables. A description of the application
processes starts here.
Frees
6.1.1 Slave Application Control
The Slave Application Control is the software top level which determines other processes states. It controls the application states according to
Figure 6-6. The eAppState variable reflects the application control
state. The Slave Application control process also interprets the LIN signals and sets some Power Die variables using the SPI Driver.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 51
For More Information On This Product,
Go to: www.freescale.com
Page 52
Freescale Semiconductor, Inc.
LIN Stepper Software Description
The other process’s states are controlled by functional calls from the Slave Application control process and by dedicated variables. Variables uAppFlags1 and uAppErrFlags reflect the system status and are set and read by the three essential processes. The structure sParameterRAM includes the system parameters that determine the application behavior. The components of the sParameterRAM structure can be changed using parameter configuration (see Section 6.1.8.
Config Param). Required position positionReq is derived from
l_u16_rd_positionReq signal and is used for Position and Speed control process. Similarly, frequencyReq is created from l_u8_rd_frequencyReq. Actual position positionAct from the Position Sensing process is passed to the LIN message l_u16_wr_positionAct
nc...
I
signal. Similarly, for frequencyActLowHigh and l_u16_wr_frequencyAct.
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
52 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 53
Freescale Semiconductor, Inc.
LIN Stepper Software Description
LIN Stepper Software Data Flow
LIN Messages
LIN
Driver
nc...
I
cale Semiconductor,
Frees
l_u8_wr_AppFlags1, l_u8_wr_AppErrFlags
eAppState
positionAct
erPOUT, erIFR, erIMR, erSYSCTL, erSYSSTAT
SPI
Driver
l_bool_rd_ClrFlag,
l_bool_rd_PosResetFlag,
l_bool_rd_LightOnFlag
sParameterRAM.curentBlockRun
sParameterRAM.uAppConfigByte1
fun. calls
fun. calls
Motor Stepping
erHBOU,
erHBCTL
l_u16_rd_positionReq
l_u16_wr_positionAct
Slave App.
Control
uAppFlags1, uAppErrFlags
Control
uMotStepControlFlags
fun. calls
fun. calls
sParameterRAM
positionReq
Position and
Speed Control
positionAct
l_u8_rd_frequencyReql_bool_rd_AppInitFlag,
l_u8_wr_frequencyAct
frequencyActLowHigh
frequencyReq
periodStep
timeMotStep
fun. calls
POUT, IFR, IMR, SYSCTL, SYSSTAT, HBOUT, erHBCTL
Position Sensing
Timer
Motor Step
Figure 6-1. LIN Stepper Software - Data Flow 1
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 53
For More Information On This Product,
Go to: www.freescale.com
Page 54
Freescale Semiconductor, Inc.
LIN Stepper Software Description
6.1.2 Position and Speed Control
The Position and Speed Control provides stepper motor control to a defined absolute position positionReq with the following functions:
linear acceleration and deceleration ramps from frequencyStart to frequencyReq with ramp steepness acceleration = deceleration
handles changes after required positionReq position update
handles changes after actual position positionAct update
handles changes after required frequency frequencyReq update
nc...
I
cale Semiconductor,
Frees
ads time instant PERIOD_STOP_TIMEOUT_MS after deceleration ramp
The functionality of the Position and Speed Control Processes can be explained using Figure 6-2, Figure 6-3, and Figure 6-4.
NOTE: Speed (frequency) control is based on the fact that identical constant
acceleration is used for acceleration as for deceleration. Therefore, the number of steps for speed acceleration is almost the same as for speed deceleration.
1. Before the motor stops, the speed must be at frequencyStart, in order not to lose the position.
In addition, according to dynamic behavior (oscillation), the motor is better stabilized at stop if it provides few steps with the frequencyStart speed.
2. Therefore we apply the reserve constant DECEL_AFTERRAMP_RESERVE.
The last issue is a numerical reserve DECEL_NUMERICAL_RESERVE. Because acceleration and deceleration ramps are calculated from previous commutation step reserve, the number of steps for acceleration ramp is higher than deceleration ramps steps. In order to fulfil condition
1, there is
3. DECEL_NUMERICAL_RESERVE
Designer Reference Manual DRM047 — Rev 0
54 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 55
Freescale Semiconductor, Inc.
The variable positionDecelDistance is incremented during speed acceleration. The actual and required position difference is compared with the positionDecelDistance (with the DECEL_RESERVE) to find the point where the speed deceleration ramp must start down to frequencyStart.
DECEL_RESERVE DECEL_AFTERRAMP_RESERVE 2 DECEL_NUMERICAL_RESERVE++=
where:
LIN Stepper Software Description
LIN Stepper Software Data Flow
nc...
I
cale Semiconductor,
Frees
DECEL_RESERVE overall deceleration ramp reserve
[steps]
DECEL_AFTERRAMP_RESERVE number of steps with starting
frequency after deceleration ramp [steps]
2 reserve for following acceleration
requires1 acceleration step and 1 deceleration step [steps]
DECEL_NUMERICAL_RESERVE deceleration reserve to cover the
difference between acceleration and deceleration ramps caused by numerical rounding [steps]
Service of the Updated Requests is shown in Figure 6-2. It provides the necessary Position and Speed control functionality when the position request value is updated (by LIN message).
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 55
For More Information On This Product,
Go to: www.freescale.com
Page 56
Freescale Semiconductor, Inc.
LIN Stepper Software Description
nc...
I
Updated Requests
StepRun |
StopTimeout?
No
positionDif =
positionReq -positionAct
positionDif != 0
Yes
Yes
No
cale Semiconductor,
Frees
Step Start
Return
Figure 6-2. Motor Position and Speed Control - Service Updated
Requests
Service of the Updated Actual Position is shown in Figure 6-3. It provides the necessary Position and Speed control functionality when the actual position value is updated (step done) or when stop timeout is scheduled.
Designer Reference Manual DRM047 — Rev 0
56 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 57
Freescale Semiconductor, Inc.
LIN Stepper Software Description
LIN Stepper Software Data Flow
nc...
I
cale Semiconductor,
Frees
Updated Actuals
positionDif =
positionReq -positionAct
positionDif != 0
Yes
StepRun flag?
Yes
positionDif > 0
Yes
positive rotation
direction?
Yes
decelDistance+
+DECEL_RESERVE
<positionDif
Yes
frequencyReq >=
frequencyActLowHigh
Yes
frequencyActLowHig=
Frequency
Acceleration
No
No
StopTimeout flag?
Yes
Step Start
Return
No
No
No
frequencyActLowHigh=
Frequency
Deceleration
StepRun flag?
Yes
positionDecelAfterRamp <= 0?
No
frequencyAct =
Frequency Deceleration
1
No
Return
No
positionDecelAfterRamp <= 0?
No
frequencyActLowHig=
Frequency
Deceleration
frequencyActLowHig=
Deceleration
Yes
Reverse Timeout
Frequency
No
Yes
Stop Timeout
Begin
Return
Yes
Begin
Return
No
No
StopTimeout flag?
Yes
Stop Block
Set
Return
negative rotation
direction?
No
decelDistance+
+DECEL_RESERVE
< - positionDif
Yes
frequencyReq >=
frequencyActLowHigh
Yes
frequencyActLowHig=
Frequency
Acceleration
1
periodStep= 1/
frequencyAct
timeMotStep +=
periodStep
Return
Figure 6-3. Motor Position and Speed Control - Service Updated Actual Position
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 57
For More Information On This Product,
Go to: www.freescale.com
Page 58
Freescale Semiconductor, Inc.
LIN Stepper Software Description
NOTE: To stop or reverse the motor, the motor must slow down to
frequencyStart and provides DECEL_AFTERRAMP_RESERVE steps with frequencyStart. This is provided by the condition positiondecelAfterRamp =< 0. When positiondecelAfterRamp is initialized to DECEL_AFTERRAMP_RESERVE by FrequencyAcceleration routine (see Figure 6-4).
The speed acceleration and deceleration subroutines are used for linear acceleration and deceleration ramping. They are shown in Figure 6-4.
nc...
I
cale Semiconductor,
Frees
frequencyActLowHigh= Frequency Acceleration (frequencyActLowHigh, acceleration, positionDecelDistance,
= DECEL_AFTERRAMP_RESERVE
frequencyReq)
frequencyReq >
frequencyActLowHigh.Byte.Hi
gh
Yes
frequencyActLowHigh +=
periodStep*acceleration
positionDecelDistance++
positionDecelAfterRamp =
frequencyReq <=
frequencyActLowHigh.Byte.Hi
gh
No
No
frequencyActLowHigh= Frequency Deceleration (frequencyActLowHigh, acceleration, positionDecelDistance,
frequencyStart)
frequencyActLowHigh -=
periodStep*acceleration
frequencyStart >
frequencyActLowHigh.Byte.Hi
gh
Yes
frequencyActLowHigh =
frequencyStart
positionDecelAfterRamp--
(limited to 0)
positionDecelDistance--
(limited to 0)
No
Yes
frequencyActLowHigh =
frequencyReq
Return
Return
Figure 6-4. Frequency Acceleration and Deceleration - Flow Chart
Designer Reference Manual DRM047 — Rev 0
58 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 59
Freescale Semiconductor, Inc.
The frequency acceleration subroutine provides the actual frequency
frequencyActLowHigh ramp with the maximum frequency limit at frequencyReq. If the actual frequency is lower than the required, the
new actual frequency is calculated from the last actual frequency frequencyActLowHigh, last stepping period periodStep and acceleration constant ParametersRAM.acceleration. After that the positionDecelDistance is incremented. (This value is used in the Position and Speed Control Process to determine the point where the speed deceleration starts). Then the positionDecelAfterRamp variable is initialized. (positionDecelAfterRamp is used to guarantee that the motor stop after ramp down to frequencyActLowHigh as shown in
Figure 6-3). Finally frequencyActLowHigh is limited to
nc...
I
frequencyReq.
LIN Stepper Software Description
LIN Stepper Software Data Flow
cale Semiconductor,
6.1.3 Motor Stepping Control
Frees
The frequency deceleration subroutine provides the actual frequency frequencyActLowHigh deceleration ramp with the minimum frequency limit at ParametersRAM.frequencyStart. First new decreased actual frequency is calculated from the last actual frequency frequencyActLowHigh, last stepping period periodStep and acceleration constant ParametersRAM.acceleration. If after the deceleration the actual frequency frequencyActLowHigh is below minimum starting frequency ParametersRAM.frequencyStart, then it is limited to ParametersRAM.frequencyStart and variable positionDecelAfterRamp is decremented as shown in Figure 6-3, the motor is allowed to stop after the variable is zero). Finally positionDecelDistance is incremented (the speed deceleration start point changes with the actual speed).
The process controls the motor stepping. It prepares the erHBOUT variable and, using the SPI Driver calls, provides the Power Die H-bridge setting to energize the stepper motor coils. The process also controls current limitation via erHBCTL. The motor stepping control is provided according to the control flags in registers uMotStepControlFlags, sParameterRAM.uAppConfigByte1, and using the stepIndex as a pointer to tables fullStepTable or halfStepTable.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 59
For More Information On This Product,
Go to: www.freescale.com
Page 60
Freescale Semiconductor, Inc.
LIN Stepper Software Description
6.1.4 Position Sensing
Position sensing handles the actual position variable positionAct. The process should guarantee that the actual position is actualized (increment/decrement) each motor step provided by the Motor Stepping Control Process.
The process also handles position initialization and correction.
NOTE: The stepper motor is controlled as an open loop system in the
application described in this document. So the position is updated each motor step according to the motor stepping direction. If any kind of position sensing or position initialization (e.g. a Hall sensor with a
nc...
I
defined position) is used, the current software could be adapted simply by changing of the Position Sensing process.
6.1.5 LIN Driver
6.1.6 SPI Driver
cale Semiconductor,
Frees
6.1.7 Timer Motor Step
LIN drivers provide all the processes for the LIN-bus protocol, which handles the transmitting/receiving of LIN frames. The application software communicates with the drivers using LIN API as shown in
Figure 6-1. The LIN messages are described in the Section 5. LIN Master Software Description.
The MCU part of the 908E625 device communicates with the Power Die using the SPI module (See Section 9. References, 9, 10).
The Timer Motor Step sets the timer for the The Motor Stepping Control and Motor Position and Speed Control processes.
Designer Reference Manual DRM047 — Rev 0
60 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 61
Freescale Semiconductor, Inc.
LIN Stepper Software Description
LIN Stepper Software Data Flow
LIN Messages
LIN
Driver
nc...
I
6.1.8 Config Param
cale Semiconductor,
Frees
l_u8_rd_configLINAxis
fun.
Reconfig
LIN
calls
eAppState
l_u8_rd_service
l_u8_rd_nodeIDCurrent
Slave App.
Control
Position
Sensing
positionAct
l_u8_rd_paramArray
l_u8_rd_dataX
fun. calls
sParameterRAM
Config Param
Figure 6-5. LIN Stepper Software - Data Flow 2 - Configuration
The process includes the functions necessary for parameter configuration. The functions are:
parameter transfer from FLASH ROM to parameter RAM
parameter upload from parameters RAM to LIN l_u8_wr_dataX signals according to l_u8_rd_paramArray
sParameterROM
parameters download from l_u8_rd_dataX signals to parameter RAM according to l_u8_rd_paramArray
FLASH programming parameters from RAM to FLASH ROM
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 61
For More Information On This Product,
Go to: www.freescale.com
Page 62
Freescale Semiconductor, Inc.
LIN Stepper Software Description
6.1.9 Reconfig LIN
The process includes the functions necessary for LIN signal reconfiguration.
As shown in Section 5. LIN Master Software Description, each LIN Stepper Controller node is programmed as an acceptor for one set of the LIN signals according to the controlled Axis. The LIN-bus signalling scheme can be reconfigured to a different Axis
The Reconfig LIN process automatically provides reconfiguration with the following steps:
nc...
I
Initializes the LIN reconfiguration RAM buffer fLINReconfigBufRAM
Presets the LIN reconfiguration RAM buffer according to l_u8_rd_configLINAxis message
Finally the LIN reconfiguration RAM buffer fLINReconfigBufRAM is programmed into the LIN configuration tables in FLASH ROM

6.2 LIN Stepper Software Application State Diagram

Figure 6-6 shows the application states. After an MCU reset, the MCU
Initialization states provide the initialization of all processes.
cale Semiconductor,
6.2.1 MCU Init
In this state, the application provides all system module initialization after
Frees
reset:
sets CONFIG2 register
sets clock module to 4.9152 MHz bus frequency
copies configuration parameters from FLASH memory sParameterRAM = sParameterROM
initializes uAppFlags1.Byte = 0; uAppErrFlags.Byte = 0
initializes SPI
Designer Reference Manual DRM047 — Rev 0
62 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 63
nc...
I
cale Semiconductor,
Frees
Freescale Semiconductor, Inc.
initializes LIN drivers
initializes stepIndex = STEP_INDEX_INIT_DEFAULT
initializes actual position positionAct = sParameterRAM.positionPark
App
Configuration
NO Position Correction
Position Correction Done
App Prepare
Config
l_u8_rd_nodeIDCurent()==sParameterRAM.nodeID &
(SysMasterRequest_Download OR
SysMasterRequest_Store OR
SysMasterRequest_LINReconfig)
l_bool_rd_ClrFlag & AppState != App Init
App Run
App Clear
Errors
Figure 6-6. LIN Stepper Software Application State Diagram
Done
MCU_Reset
MCU Init
App Init
Done
l_bool_rd_AppInitFlag
PositResetDone
l_bool_rd_PosResetFlag
SysMasterRequest_Sleep
return
LIN Stepper Software Description
LIN Stepper Software Application State Diagram
Done
Done
Reset Set Stall
positionAct = positionResetRqValue
App Position
App Prepare
App Wake-up
App Position
Reset
Sleep
LIN Wake-up Request
App Sleep
Done
6.2.2 iApp.Init
The Application Initialization state is a defined state which the application enters after MCU Init, or can be forced by the l_bool_rd_AppInitFlag message. The application performs the following:
initializes timers
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 63
For More Information On This Product,
Go to: www.freescale.com
Page 64
Freescale Semiconductor, Inc.
LIN Stepper Software Description
clears system errors
provides position and speed control application initialization
NOTE: The application initialization state App. Init. does not set actual motor
position positionAct.
6.2.3 App.Run
In the Application Run state, the application controls the actual position positionAct to the required position positionReq with current limited to the Run or Block current. The positionReq is set according to the to
nc...
I
l_u16_rd_positionReq signal. The motor is in the block state if the positionAct = positionReq after stop timeout. The LIN signals are also
tested in this state. If there are any of the requests shown in Figure 6-6, the state is left.
6.2.4 App.Position Reset
Functionality of the Position Reset state is very similar to the App Run state, but in this state the application controls the motor to the motor down to positionReq = sParameterRAM.positionResetRqValue. So the positionReq is not set according to the l_u16_rd_positionReq.
This state is used with the App Position Reset Set Stall for position initialization.
cale Semiconductor,
6.2.5 App.Position Reset Set Stall
Frees
6.2.6 App. Prepare Sleep
Provides setting positionAct = sParameterRAM.positionStall and so provides the actual position reset.
Application prepares for sleep. In case the motor is spinning it is decelerated and stopped. This is provided in order not to lose position by going to sleep.
Designer Reference Manual DRM047 — Rev 0
64 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 65
6.2.7 App. Prepare Sleep
6.2.8 App. Wake-Up
nc...
6.2.9 App. Configuration
I
Freescale Semiconductor, Inc.
Application prepares all MCU modules for minimal consumption and provides Stop instruction. It also sets the Power Die to be able to generate IRQ pin signal for LIN-bus wake-up.
After wake-up message from the bus, the MCU is wakened by the IRQ pin signal from Power Die.
LIN Stepper Software Description
LIN Stepper Software Implementation
Application Configuration is described in Section 6.1.8. Config Param,
Section 6.1.9. Reconfig LIN or Appendix C.3. LIN Leveller Configuration Frames.
6.2.10 App. Clear Errors
Application clears Power Die errors and uAppErrFlags.Byte = 0

6.3 LIN Stepper Software Implementation

cale Semiconductor,
6.3.1 Scaling of Quantities
The LIN Leveller application uses signed 16-bit type SWord16,
Frees
unsigned 16-bit type UWord16, signed 8-bit type SByte, and unsigned 8-bit type UByte variables.
Any defined Real Variable constant must be recalculated to the system representation (UWord16 Value, SWord16 Value, UWord8 Value, SWord8 Value)
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 65
For More Information On This Product,
Go to: www.freescale.com
Page 66
Freescale Semiconductor, Inc.
LIN Stepper Software Description
The following equation shows the relationship between system (raw value range) and real (physical or normalized range) representation
UWord16 Value MAX_U16 1+()
SWord16 Value MAX_S16 1+()
UB yte Value MAX_U8 1+()
SB yte Value MAX_S8 1+()
where:
Real Value
=
-------------------------------------------------------------­Real Quantity Range Max
Real Value
--------------------------------------------------------------
=
Real Quantity Range Max
Real Value
--------------------------------------------------------------
=
Real Quantity Range Max
Real Value
--------------------------------------------------------------
=
Real Quantity Range Max
(EQ 1.)
(EQ 2.)
(EQ 3.)
(EQ 4.)
nc...
I
cale Semiconductor,
Frees
UWord16 Value is the unsigned 16-bit system representation of the real value,
SWord16 Value is the signed 16-bit system representation of the real value,
UWord8 Value is the unsigned 8-bit system representation of the real value,
SWord8 Value is the signed 8-bit system representation of the real value,
Real Value is the real value of the quantity [V, A, RPM, etc.],
Real Quantity Range Max is the maximum of the quantity range,
defined in the application [V, A, RPM, etc.],
MAX_U16 = 65535 is the maximum of the unsigned 16-bit variable,
MAX_S16 = 32768 is the maximum of the signed 16-bit variable,
MAX_U8 = 255 is the maximum of the unsigned 8-bit variable,
MAX_S8 = 127 is the maximum of the signed 8-bit variable.
Designer Reference Manual DRM047 — Rev 0
66 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 67
Freescale Semiconductor, Inc.
LIN Stepper Software Description
LIN Stepper Software Implementation
From the above equations for the Real Value:
Real Value
Real Value
Real Value
Real Value
UWord16 Value* Real Quantity Range Max
----------------------------------------------------------------------------------------------------------=
SWord16 Value*Real Quantity Range Max
---------------------------------------------------------------------------------------------------------=
UB yte Value*Real Quantity Range Max
---------------------------------------------------------------------------------------------------=
SB yte Value*Real Quantity Range Max
--------------------------------------------------------------------------------------------------=
MAX_U16 1+()
MAX_S16 1+()
MAX_U8 1+()
MAXSU8 1+()
(EQ 5.)
(EQ 6.)
(EQ 7.)
(EQ 8.)
According to the variable type, the equations EQ1 to EQ8 also can be converted to the EQ9 and EQ11
nc...
I
System Variable X
Real Value X
------------------------------------------------------= Resolution Quantity X
(EQ 9.)
where:
Resolution Quantity X
where:
System Variable X - is the system variable
Real Value X - is the physical value of the quantity represented by
Variable X
Resolution Quantity X - resolution of the system variable X in real. (It represents the physical value represented by LSB bit of the Variable X)
cale Semiconductor,
Max Type Variable X - system Variable X maximum according to the Variable Type:
Real Quantity X Range Max
--------------------------------------------------------------------= MAX Type Variable X
(EQ 10.)
Frees
Type UWord16 MAX_U16 = 65535 Type SWord16 MAX_S16 = 32768 Type UByte MAX_U8 = 255 Type SByte MAX_S8 = 127
And hence the Real Value:
Real Value X Resolution Quantity X*System Variable X=
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 67
For More Information On This Product,
Go to: www.freescale.com
(EQ 11.)
Page 68
n
Freescale Semiconductor, Inc.
LIN Stepper Software Description
6.3.2 Scaling of Time
Scaling of time variables is according to EQ12,13
Resolution Period
ResolutionPeriod defines the time of
Real Step Period periodStep*R esolu tion Period=
6.3.3 Acceleration Scaling and Arithmetic Operations
nc...
I
Some of the arithmetic operations used in the LIN Stepper software impact the calling.
A good example is umul_16x8_macro
UWord16 Variable3
which is used for acceleration ramp calculation:
Frequency Difference Stepping Perio d*Acceleration=
And EQ15 can be rewritten to
cale Semiconductor,
Resolution Frequency*(UWord16) frequencyDif Resolution Period*(UWord16) periodStep* Resolution Acceleration *acceleratio
if we use the umul_16x8_macro
Timer Prescaller Division
--------------------------------------------------------------= Bus Frequency
UWord16 Variable1*UByte Variable2
---------------------------------------------------------------------------------------------=
=
256
(EQ 12.)
(EQ 13.)
(EQ 14.)
(EQ 15.)
(EQ 16.)
Frees
(UWord16)Frequency Dif
(UWord16)periodStep*(UByte)Acceleration
-----------------------------------------------------------------------------------------------------------= 256
Then according to EQ16, EQ17 the Resolution Acceleration is:
RESOLUTION_ACCEL_DECEL_S_S2
RESOLUTION_FREQUENCY_LOW_HIGH
----------------------------------------------------------------------------------------------------------------------------------=
256.0*(RESOLUTION_PERIOD_NS/1000000000.0)
NOTE: The actual frequency variable frequencyActLowHigh is represented as
an union. Then for the acceleration calculations it can be accessed as
Designer Reference Manual DRM047 — Rev 0
68 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
(EQ 17.)
(EQ 18.)
Page 69
Freescale Semiconductor, Inc.
UWord16 variable frequencyActLowHigh.Word. This will guarantee the low resolution (necessary to create low steepness frequency ramps). For the frequency-to-period calculation and comparison with required frequency frequencyReq, it is sufficient to use 8-bit information. This allows to use fast calculations like frequency to speed conversion using udiv16_8to16. Then the high byte frequencyActLowHigh.Byte.High is accessed.
6.3.4 Actual Frequency to Period Conversion
The conversion from frequency to period requires division.
LIN Stepper Software Description
LIN Stepper Software Implementation
nc...
I
cale Semiconductor,
Frees
Period
1
----------------------------= Frequency
(EQ 19.)
For software execution optimized calculation we wrote a special arithmetic function:
UWord16 udiv16_8to16(UWord16 x, UByte y)
with UWord16 output and UWord16 x, UByte y inputs. It is written in assembler and provides the following calculation:
UWord16 Variable3
UWord16 Variable1
-------------------------------------------------= UByte Variable3
(EQ 20.)
The conversion must take into account the variables scaling:
Resolution Period*(UWord16) periodStep
(UWord16) periodStep
UWord16()Resolution Frequency/ResolutionPeriod()
------------------------------------------------------------------------------------------------------------------------------------=
---------------------------------------------------------------------------------------------------------= Resolution Frequency*(UByte8) Frequency
(UByte8) Frequency
1
(EQ 21.)
(EQ 22.)
So the final calculation using the udiv16_8to16 function is:
(UWord16) periodStep
UWord16()CONVERSION_CONST_PERIOD_FERQ()
--------------------------------------------------------------------------------------------------------------------------------------------= (UByte8) frequencyActLowHigh.Byte.High
(EQ 23.)
where:
Resolution Period [s] is
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Stepper Software Description 69
For More Information On This Product,
Go to: www.freescale.com
RESOLUTION_PERIOD_NS*1000000000.0
Page 70
Freescale Semiconductor, Inc.
LIN Stepper Software Description
Resolution Frequency [Hz] is RESOLUTION_FREQUENCY_HZ
CONVERSION_CONST_PERIOD_FREQ = (1000000000.0/RESOLUTION_FREQUENCY_HZ/RESOLUTION_PE RIOD_NS)
6.3.5 LIN Stepper Software Memory Utilization
Table 6-1 shows how much memory is required to run the LIN Stepper
Controller with code compiled with Metrowerks CodeWarrior v 2.1.
nc...
I
cale Semiconductor,
Frees
Table 6-1. Stepper Controller Software Memory Utilization
Memory
FLASH ROM 4039 Bytes
RAM 278 Bytes
Used by
Software
Important Sections Size
Parameter ROM 16B
LIN Reconfig ROM 128B
Stack 64B
LIN Reconfig RAM 96B
Parameter RAM 16B
Designer Reference Manual DRM047 — Rev 0
70 LIN Stepper Software Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 71
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047

Section 7. User Interface Description

7.1 Introduction

This section describes the Control pages used for LIN-bus control (see Section 2.3.1. PC Master Mode) in terms of:
nc...
I
PC master software general overview
detailed description of each control page

7.2 PC Master Software General Overview

The principle is briefly shown in Section 2.4. Personal Computer.
In Figure 7-1 it is possible to see whole PC master software page, which is comprised of four main boxes.
cale Semiconductor,
Frees
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA User Interface Description 71
For More Information On This Product,
Go to: www.freescale.com
Page 72
Freescale Semiconductor, Inc.
User Interface Description
.
nc...
I
cale Semiconductor,
7.2.1 Project Tree
Frees
View Tabs
Project Tree
Variable Watch
Figure 7-1. PC Master Software Main Page
Clicking the mouse on the legend selects what is displayed in the remaining boxes.
View Area
7.2.2 Variable Watch
Here some selected variables from the Master Board are located, and the Value (Number or Expression) and Period of reloading is assigned to them.
Designer Reference Manual DRM047 — Rev 0
72 User Interface Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 73
7.2.3 View Tabs
7.2.4 View Area
Freescale Semiconductor, Inc.
The View tabs select what is displayed in the View area.
Shows one of following items:
HTML Control page (LIN-bus Control page or Programming and
Oscilloscope page
User Interface Description
LIN-bus Control
Configuration page)
nc...
I

7.3 LIN-bus Control

cale Semiconductor,
Frees
Recorder page
Because some variables on the HTML control page have write status, it is necessary to reload them to Variable Watch by pressing the F5 key on the keyboard (recommended after a change). Reloading of the read variables is done automatically.
More information about the PC master software can be gained from the PC Master Software User Manual (Section 9. References, 1).
The pages dedicated to LIN slave control are (see Project Tree):
Slave control - LIN-bus control page
Oscilloscope - real time variables watching
Recorder - recorded variables watching

7.4 Slave Control

Via this HTML page (Figure 7-2), it is possible to fully control up to two LIN Stepper Controllers. The page comprises three main areas: Control Loop1, Control Loop2, and an area containing Status notes and State buttons on a yellow background.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA User Interface Description 73
For More Information On This Product,
Go to: www.freescale.com
Page 74
User Interface Description
7.4.1 Control Loop1
nc...
I
Freescale Semiconductor, Inc.
The steps for setting this page are as follows:
1. Chose LIN frames (see Section 5. LIN Master Software
2. Select Axis (LIN Stepper Controller)
3. The periodeSendMin box displays the automatically calculated
Description) for communication via checking of Send or Receive
boxes.
minimum time necessary for transmitting and receiving selected LIN frames. Set time distances in periodeSend box between two communication events greater than or equal to that minimum time (displayed in milliseconds; maximum value = 255).
cale Semiconductor,
Frees
4. All LIN frames data are displayed in the Frame Data box. In FramePosCmd it is necessary to choose the source for positionReq 16-bit data. Either it will be driven manually or will be
automatically generated from predefined curves in LIN Master memory. In the first case, choose Manual in the Mode combo box,
There are four predefined curves and one special choice called SQUARE.
and positionReq is driven by positionReqManual. The actual value can be seen either in the box below the slide bar or in the
positionReq box. In the second case, choose Automatic in the Mode combo box, select curve and set “if generate data still” or
“read out curve data only once and then stop” (Send combo box). The Reset button causes shifting in curve data to beginning.
Designer Reference Manual DRM047 — Rev 0
74 User Interface Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 75
Freescale Semiconductor, Inc.
nc...
I
User Interface Description
Slave Control
cale Semiconductor,
7.4.2 Control Loop2
Frees
Figure 7-2. LIN-bus Control Page
The setting is the same as for Control Loop1 except:
If there are communication requests of both loops at the same time, Loop1 always has the main priority. This means that a request from Loop2 is shifted until the request of Loop1 is satisfied. That is why there is a delay between two following satisfied communication requests from Loop2, measured and displayed via periodeSend. The periodeSendReq box is used to set the desired time periods between two communication events of Loop2.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA User Interface Description 75
For More Information On This Product,
Go to: www.freescale.com
Page 76
Freescale Semiconductor, Inc.
User Interface Description
FramePosCmd 16-bit data source (positionReq) is set only manually, by means of the positionReqManual box.
7.4.3 Status Notes and State Buttons
On the yellow background can be seen two Status notes and three State buttons:
Status - displays current status of LIN communication and can be:
nc...
I
Idle - LIN is activated, but communication is not started
Run - communication is running
Sleep - LIN-bus is in Sleep state
7.4.4 Error Handling
cale Semiconductor,
Frees
Error - global error label, which accumulates all error warnings.
Sleep/Wake up - sends sleep or wake-up frame.
Run/Stop - runs or stops communication via LIN-bus. Park Position - after button click is positionReq variable of both loops forced to zero and the mode of Loop1 is set to Manual.
The Error notes can be:
None - communication without errors
No Response - Slave is not responding (wrong selected Axis or Slave is missing). In case, when is Slave responding, this note reflects checksum error.
Transmitter Issue - more than one LIN device is transmitting or LIN SIO wire is shorted to the supply source wires.
7.4.5 Low Time Cases
If the time dedicated to Loop1 communication requests is always shorter than the time necessary for Loop2 communication, the priority rule of Loop1 is dismissed and loop requests are satisfied in order following each other. This state is signalled by the note Frames are not
Designer Reference Manual DRM047 — Rev 0
76 User Interface Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 77

7.5 Recorder

nc...
I
Freescale Semiconductor, Inc.
synchronized with periodeSend, that is situated beside Loop1 periodeSend variable.
This page is shown in Figure 7-3. It is possible to reach it in two ways. Either click on the Display Graphical Recorder button (Slave Control page) or click on the legend Recorder in the Project tree.
The Recorder is working as a standalone oscilloscope running directly on the Master Board. Each cycle is started by the Run button on the Recorder page. Then data in predefined time distances are sampled and stored to Master Board RAM. After ten seconds from start, data are reloaded to the PC master tool and displayed via the graphical interface. The dvantage of this way of watching variables is the recording of fast changing events.
User Interface Description
Recorder
cale Semiconductor,
Frees
In this case, three variables of Loop1 are watched and displayed (because of finite size of RAM):
1. positonReq - desired position of HID lamp (LIN Stepper Controller) before FramePosCmd transmitting
2. positionReqSent - desired position of HID lamp (LIN Stepper Controller) immediately after FramePosCmd transmitting
3. positionAct - actual position of HID lamp (LIN Stepper Controller) after receiving FramePosStatus
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA User Interface Description 77
For More Information On This Product,
Go to: www.freescale.com
Page 78
User Interface Description
nc...
I
Freescale Semiconductor, Inc.
cale Semiconductor,
Frees

7.6 Oscilloscope

Figure 7-3. Recorder Page
By comparing 1) and 2) it is possible to watch the delay caused by transmitting FramePosCmd on LIN-bus; by comparing 1) and 3) it is possible to watch the delay caused by the mechanical parts of the LIN Stepper Controller that are driving the lamp position (LIN communication delays can be in the most of this cases neglected).
Figure 7-4 shows the Oscilloscope page.
Designer Reference Manual DRM047 — Rev 0
78 User Interface Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 79
Freescale Semiconductor, Inc.
The Oscilloscope works as a real time recorder and displays the current state of the variables. In comparison to the Recorder, the data for Oscilloscope are loaded to PC master software immediately and individually, whereas, in the case of the Recorder, this is done by group. This causes the Oscilloscope to be slower than the Recorder, so when the event is faster than the Oscilloscope data flow, data triggering that event are missing. The advantage of this tool is that it does not use the Master Board RAM as Recorder, so triggered events can be infinite.
nc...
I
User Interface Description
Oscilloscope
cale Semiconductor,
Frees
Figure 7-4. Oscilloscope Page
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA User Interface Description 79
For More Information On This Product,
Go to: www.freescale.com
Page 80
Freescale Semiconductor, Inc.
User Interface Description
The same variables as in Recorder are displayed on the Oscilloscope page, but for both loops.
This section is finished by the comparison tables of variables between LIN-bus Control page and Variable Watch:
Loop1 (Table 7-1)
Loop2 (Table 7-2)
Status notes and State buttons (Table 7-3)
nc...
I
cale Semiconductor,
Frees
Table 7-1. LIN-bus Control Page and Variable Watch Variables Comparison - Loop1
LIN-bus Control page variable
name
Send enableTxPosition_Loop1 Enable transmit frame PosCmd
Receive
Error
Select Axis
periodeSendMin periodeSendMin_Loop1
Name of representative from
Watch variable
enableRxPosStatus_Loop1 Enable receive frame PosStatus
enableRxStatus_Loop1 Enable receive frame AppStatus
TxPositionError_Loop1
RxPosStatusError_Loop1
RxStatusError_Loop1
axisTxPosition_Loop1 Target device of PosCmd frame
axisRxPosStatus_Loop1 Target device of PosStatus frame
axisRxStatus_Loop1 Target device of AppStatus frame
Error during frame PosCmd
Error during frame PosStatus
Error during frame AppStatus
value in milliseconds
Note
transmitting
receiving
receiving
Calculated period,
range <0 - 255>,
Real period,
periodeSend periodeSend_Loop1
Mode modeAutMan_Loop1 Select Manual or Automatic mode
Curve autCurveSelect_Loop1 Select one predefined curve
Send autSendOnesStill_Loop1 Send curve Ones or Still
Designer Reference Manual DRM047 — Rev 0
80 User Interface Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
range <0 - 255>,
value in milliseconds
Page 81
Freescale Semiconductor, Inc.
User Interface Description
Oscilloscope
Table 7-1. LIN-bus Control Page and Variable Watch Variables Comparison - Loop1
LIN-bus Control page variable
name
Reset autReset_Loop1
positionReq positionReq_Loop1
frequencyReq frequencyReq_Loop1
ClrFlag ClrFlag_Loop1
nc...
I
cale Semiconductor,
AppInitFlag AppInitFlag_Loop1
PosResetFlag PosResetFlag_Loop1
LightOnFlag LightOnFlag_Loop1
positionAct positionAct_Loop1
frequencyAct frequencyAct_Loop1
AppFlags uAppFlags_Loop1
analogValue analogValue_Loop1
AppErrFlags uAppErrFlags_Loop1
positionReqManual positionReqManual_Loop1
Name of representative from
Watch variable
Note
Shift pointer in selected
Curve to begin
Included in frame PosCmd,
data field, length 16 bits
Included in frame PosCmd,
data field, length 8 bits,
page range <0Hz - 2500 Hz>
Included in frame PosCmd, data field, length 1 bit each
Included in frame PosStatus,
data field, length 16 bits
Included in frame PosStatus,
data field, length 8 bits
Included in frame PosStatus,
data field, length 8 bits
Included in frame AppStatus,
data field, length 8 bits
Included in frame AppStatus,
data field, length 8 bits
If is Mode manual, sets value of
positionReq variable
Frees
Table 7-2. LIN-bus Control Page and Variable Watch Variables Comparison - Loop2
LIN-bus Control page variable
name
Send enableTxPosition_Loop2 Enable transmit frame PosCmd
Receive
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA User Interface Description 81
For More Information On This Product,
Name of representative from
Watch variable
enableRxPosStatus_Loop2 Enable receive frame PosStatus
enableRxStatus_Loop2 Enable receive frame AppStatus
Go to: www.freescale.com
Note
Page 82
Freescale Semiconductor, Inc.
User Interface Description
Table 7-2. LIN-bus Control Page and Variable Watch Variables Comparison - Loop2
nc...
I
cale Semiconductor,
Frees
LIN-bus Control page variable
name
Error
Select Axis
periodeSendMin periodeSendMin_Loop2
periodeSendReq periodeSendReq_Loop2
periodeSend periodeSend_Loop2
positionReq positionReq_Loop2
frequencyReq frequencyReq_Loop2
ClrFlag ClrFlag_Loop2
AppInitFlag AppInitFlag_Loop2
PosResetFlag PosResetFlag_Loop2
Name of representative from
Watch variable
TxPositionError_Loop2
RxPosStatusError_Loop2
RxStatusError_Loop2
axisTxPosition_Loop2 Target device of PosCmd frame
axisRxPosStatus_Loop2 Target device of PosStatus frame
axisRxStatus_Loop2 Target device of AppStatus frame
Error during frame PosCmd
Error during frame PosStatus
Error during frame AppStatus
value in milliseconds
value in milliseconds
value in milliseconds
Included in frame PosCmd, data
field, length 16 bits
Included in frame PosCmd,
data field, length 8 bits,
page range <0Hz - 2500 Hz>
Included in frame PosCmd, data field, length 1 bit each
Note
transmitting
receiving
receiving
Calculated period,
range <0 - 255>,
Desired period,
range <0 - 255>,
Real period,
range <0 - 255>,
LightOnFlag LightOnFlag_Loop2
positionAct positionAct_Loop2
frequencyAct frequencyAct_Loop2
AppFlags uAppFlags_Loop2
Designer Reference Manual DRM047 — Rev 0
82 User Interface Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Included in frame PosStatus,
data field, length 16 bits
Included in frame PosStatus,
data field, length 8 bits
Included in frame PosStatus,
data field, length 8 bits
Page 83
Freescale Semiconductor, Inc.
User Interface Description
Programming and Configuration
Table 7-2. LIN-bus Control Page and Variable Watch Variables Comparison - Loop2
LIN-bus Control page variable
name
analogValue analogValue_Loop2
AppErrFlags uAppErrFlags_Loop2
positionReqManual positionReqManual_Loop2 Value for positionReq variable
nc...
I
cale Semiconductor,
Table 7-3. LIN-bus Control Page and Variable Watch Variables Comparison - Status Notes
LIN-bus Control page variable
name
Status LIN_Status
Error Created as OR function of all error messages in HTML page code
Sleep/Wake-up LIN_SleepWakeReq
Run/Stop LIN_RunStopReq
Park Position Park Sets lamp system to initial position
Note:
Frames are (not)
synchronized with periodeSend

7.7 Programming and Configuration

Frees
Name of representative from
Watch variable
and State Buttons
Name of representative from
Watch variable
SynchMode_Loop1
Note
Included in frame AppStatus,
data field, length 8 bits
Included in frame AppStatus,
data field, length 8 bits
Note
Display LIN status:
IDLE/RUN/SLEEP
Change current LIN Status
Sleep/Wake-up
Change current LIN Status
Run/Stop
Display relationship between real
and desired communication timing
By the means of this page (see Figure 7-5) it is possible to program and configure the LIN Stepper Controller via LIN-bus. The services are following:
LIN Reconfiguration - assign Axis number
Upload Parameters - read parameters
Download Parameters - write parameters
Store Parameters - store parameters to program MCU memory
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA User Interface Description 83
For More Information On This Product,
Go to: www.freescale.com
Page 84
User Interface Description
nc...
I
Freescale Semiconductor, Inc.
MCU Reset - reset MCU
Send Position Correction - set new position
All variables included in the parameters array are described in Section 5. LIN Master Software Description.
cale Semiconductor,
Frees
7.7.1 LIN Reconfiguration
Figure 7-5. Programming and Configuration Page
If is necessary to change or program new Axis number of LIN Stepper Controller, select the desired Axis number in configLINAxis combo box and click on LIN Reconfig button. The target device will now have the chosen Axis number.
Designer Reference Manual DRM047 — Rev 0
84 User Interface Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 85
7.7.2 Upload Parameters
Steps are as follows:
Freescale Semiconductor, Inc.
1. Select nodeID (node identity) - for an uninitialized device (by the
2. In the paramArray combo box, set which parameters are to be
3. Click on the UPLOAD button
User Interface Description
Programming and Configuration
nodeID item in parameters array) the nodeID is 255
uploaded (a dedicated box will appear just like the box selected by paramArray PARAMS_CONFIG vote on Figure 7-5 - in the middle of left side).
nc...
I
7.7.3 Download Parameters
cale Semiconductor,
Frees
4. Parameters are now reloaded from the selected Node, and in service box is displayed the name of action that was provided by Node (in this case it must be UPLOAD, otherwise the Node reaction was wrong).
For this choice:
1. Select nodeID (node identification) - for an uninitialized device (by the nodeID item in parameters array) the nodeIDis 255
2. In the paramArray combo box, set which parameters are to be downloaded (a dedicated box will appear just like box selected by paramArray PARAMS_CONFIG vote on Figure 7-5 - in the middle of left side). Then change those parameters.
3. After clicking on the DOWNLOAD button, the parameters are written and immediately read back for verifying. If the parameter values are the same as were determined, in the RecvData box will be “Ok”. In the opposite case, “Different” will be displayed. In the service box must be “DOWNLOAD”, otherwise the Node reaction was wrong.
7.7.4 Store Parameters
Choose Node (nodeID) and click on the STORE button. All parameters are stored in the Node program memory.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA User Interface Description 85
For More Information On This Product,
Go to: www.freescale.com
Page 86
User Interface Description
7.7.5 MCU Reset
7.7.6 Send Position Correction
nc...
I
Freescale Semiconductor, Inc.
For all Nodes, nodeID is zero; for uninitialized devices, it is 255.
Select Node via nodeID combo box and click on MCU Reset button.
For all Nodes, nodeID is zero; for uninitialized devices, it is 255.
Set nodeID and variable positionCorrection. Then click on the Send Position Correction button.
For uninitialized device, nodeID is 255.
7.7.7 Error Handling
cale Semiconductor,
Frees
Error (corresponding variable in Variable Watch - configProgramError) box notes can be:
None - communication without errors
No Response - Slave is not responding (wrong selected Axis or Slave is missing). In case, when Slave is responding, this note reflects checksum error.
Transmitter Issue - more than one LIN device is transmitting or LIN SIO wire is shorted to the supply source wires.
Designer Reference Manual DRM047 — Rev 0
86 User Interface Description MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 87
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047
One of the aims of this reference design was to show that the LIN-bus is suitable for HID headlamp levelling control and its communication speed is fully sufficient for this application.
The dynamic behavior of the HID lamp levelling system has some
nc...
I
limitations due to mechanical parts. The bus communication system (LIN-bus) should not be the limitation for the system dynamic.

Section 8. Conclusion

cale Semiconductor,
Frees
This is demonstrated below using the PC master recorder (see
Section 7.5. Recorder). The figures below are measured using the PC
master software. Control Loop1 controls automatically the levelling of a standard HID lamp according to signals pre-programmed in LIN Master. The horizontal levelling is set for Axis1.
All Axis1 frames are being sent. Control Loop2 is also enabled and controls Axis2. All Axis2 frames are being sent (see Section 7.4. Slave
Control). All frames are sent with constant period periodeSend = 30ms.
According with the stepper motor and mechanical parts of the HID lamp, the following setting is provided:
start speed = 200rpm
max. speed frequencyReq = 700rpm
and position range positionReq +/-128steps
Figure 8-1 shows that a slow sinusoidal signal of required position
positionReq can be followed by the actualPosition signal. If the signal
frequency increases, the HID lamp mechanics are not able to copy the required position. The LIN-bus is able to provide enough samples.
The system mechanics are the limiting factor.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Conclusion 87
For More Information On This Product,
Go to: www.freescale.com
Page 88
Conclusion
nc...
I
Freescale Semiconductor, Inc.
cale Semiconductor,
Frees
Figure 8-1. Slow-Fast Signal
Figure 8-2. Low-High (Amplitude) Signal
The Figure 8-2 shows that the required position positionReq with a sinusoidal signal of small amplitude can be followed by actualPosition
Designer Reference Manual DRM047 — Rev 0
88 Conclusion MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 89
Freescale Semiconductor, Inc.
signal. If the signal amplitude increases, the stepper motor with its maximum speed is not able to follow the required position.
The LIN-bus is able to provide enough samples.
The system mechanics are the limiting factor.
nc...
I
Conclusion
Programming and Configuration
cale Semiconductor,
Frees
Figure 8-3. Road1 Signal
Figure 8-3 shows a non-sinusoidal signal of required position
positionReq be followed by the actualPosition signal. It can simulate
a HID levelling system on a road.
Therefore, we can say that the LIN Leveller described in this reference design could be an advanced solution for HID headlamp levelling control with a very competitive system cost thanks to:
LIN-bus communication protocol
which is a cost-effective bus system based on standard SCI (UART) communication and:
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Conclusion 89
For More Information On This Product,
Go to: www.freescale.com
Page 90
Conclusion
nc...
I
Freescale Semiconductor, Inc.
908E625 device
as an integrated solution, which makes the slave nodes easy with a low number of components.
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
90 Conclusion MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 91
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047
1. PC Master Software User Manual
2. LIN Specification Package, Revision 1.2

Section 9. References

nc...
I
cale Semiconductor,
Frees
3. System Integration in Automotive Lighting - Improvements in Visibility at Night, Rainer Neumann, Visteon Deutschland GmbH, SAE 2002-01-1989
4. Bending Light, Kevin Jost, SAE 1-110-12-26
5. Adaptive front lightning, Stuart Birch, SAE 1-109-12-39
6. Bifunction HID Headlamp Systems - Reflection and Projection Type, Doris Boebel, Heike Eichler and Verena Hebler, Automotive Lighting GmbH, Automotive Lighting Research (SP–1531)
7. HID System: Function Integration, Christophe Cros, Valeo Lighting System
8. Innovations in Lighting with Adaptive Headlamp Technology, Michael Hamm and Ernst-Olaf Rosenhahn, Automotive Lighting Reutlingen, SAE 2001-01-3392
9. LIN General Purpose IC 908E625ACDWB/D
10. MC68HC908EY16 Data Sheet MC68HC908EY16/D
11. LIN Physical Interface MC33399
12. 16-bit MCU MC9S12DP256B
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA References 91
For More Information On This Product,
Go to: www.freescale.com
Page 92
References
nc...
I
Freescale Semiconductor, Inc.
cale Semiconductor,
Frees
Designer Reference Manual DRM047 — Rev 0
92 References MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 93
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047

Appendix A. Hardware Schematics

A.1 LIN Master Board Schematic

nc...
I
cale Semiconductor,
Frees
5
D D
+5V
C C
C12
C12
100nF
100nF
B B
R20
R20 10k
10k
A A
MONx JPx
High Low ON
ON - JUMPER PINS ARE SHORT - CIRCUIT OFF - JUMPER PINS AREN'T SHORT- CIRCUIT
C10
C10 100nF
100nF
8
VCC
OUT
4
GND
NC
QG1
QG1 19,6608MHz
19,6608MHz
SW1
SW1
PUSHBUTTON-2/SM
PUSHBUTTON-2/SM
12 34 56
J6
HEADER3X2J6HEADER3X2
5
5
1
OFF
CLOCK
4
VCC5GND
MON2 MON3
\EN_CLOCK
1
OUT
IN
2
+
+
JP1JP1 JP2JP2 JP3JP3 JP4JP4 JP5JP5 JP6JP6
U5
U5 74HCT1G125GW
74HCT1G125GW
OE
3
C11
C11 15pF
15pF
R13
R13 1k2
1k2
C15
C15 10uF/6,3V
10uF/6,3V
R21
R21 10k
10k
C26
C26 100nF
100nF
R141kR14 1k
C16
C16 100nF
100nF
C27
C27 10nF
10nF
109
SCK2/PW7/KWP7/PP7
110
SS2/PW6/KWP6/PP6
111
MOSI2/PW5/KWP5/PP5
112
MISO2/PW4/KWP4/PP4
1
SS1/PW3/KWP3/PP3
2
SCK1/PW2/KWP2/PP2
3
MOSI1/PW1/KWP1/PP1
4
MISO1/PW0/KWP0/PP0
18
IOC7/PT7
17
IOC6/PT6
16
IOC5/PT5
15
IOC4/PT4
12
IOC3/PT3
11
IOC2/PT2
10
IOC1/PT1
9
IOC0/PT0
31
PB7/AD7
30
PB6/AD6
29
PB5/AD5
28
PB4/AD4
27
PB3/AD3
26
PB2/AD2
25
PB1/AD1
24
PB0/AD0
36
PE7/XCLKSn/NOACC
37
PE6/MODB/IPIPE1
38
PE5/MODA/IPIPE0
39
PE4/ECLK
53
PE3/LSTRBN/TAGLOn
54
PE2/RWn
55
PE1/IRQn
56
PE0/XIRQn
46
EXTAL
47
XTAL
83
VDDA
84
VRH
85
VRL
97
VREGEN
42
RESETn
82
PAD15/AN15
80
PAD14/AN14
78
PAD13/AN13
76
PAD12/AN12
74
PAD11/AN11
72
PAD10/AN10
70
PAD09/AN09
68
PAD08/AN08
48
TEST
23
MODC/TAGHIn/BKGD
43
VDDPLL
R22
R22 5k6
5k6
4
C28
C28 1nF
1nF
4
PA4/AD12/TMOD1
PA6/AD14/TMOD2
PS4//SDI/MISO0
PM0/RXB/RXCAN0 PM1/TXB/TXCAN0
PM2/RXCAN1
PM3/TXCAN1
PM4/RXCAN2
PM5/TXCAN2
PM6/RXCAN3
PM7/TXCAN3
PJ6/KWJ6/SDA/RXCAN4 PJ7/KWJ7/SCL/TXCAN4
XFC
44
U2
U2 MC9S12DP256
MC9S12DP256
PA0/AD8
PA1/AD9 PA2/AD10 PA3/AD11
PA5/AD13
PA7/AD15
PAD07/AN07 PAD06/AN06 PAD05/AN05 PAD04/AN04 PAD03/AN03 PAD02/AN02 PAD01/AN01 PAD00/AN00
PS7/SS0
PS6/SCK0
PS5/MOSI0
PS1/TXD0
PS0/RXD0
PS3/TXD1
PS2/RXD1
KWH0/PH0 KWH1/PH1 KWH2/PH2 KWH3/PH3 KWH4/PH4 KWH5/PH5 KWH6/PH6 KWH7/PH7
PK0/PIX0
PK1/PIX1
PK2/PIX2
PK3/PIX3
PK4/PIX4
PK5/PIX5
PK7/ECSn
KWJ0/PJ0 KWJ1/PJ1
VSSPLL
VDD1 VDD2 VDDX VDDR
VSS1 VSS2 VSSX VSSR VSSA
57 58 59 60 61 62 63 64
81 79 77 75 73 71 69 67
96 95 94 93 90 89 92 91
105 104 103 102 101 100 88 87
99 98
52 51 50 49 35 34 33 32
8 7 6 5 20 19
108
22 21
13 65 107 41
14 66 106 40 86 45
RTS DTR
DATA
\EN_CLOCK
RSTB \IRQIN LIN_SUP
+5V
DATA MON1 MON2 MON3
C24
C24 100nF
100nF
R1 10kR110k
R6 10kR610k
R7 10kR710k
R8 10kR810k
R9 10kR910k
8 7
HEADER4X2J2HEADER4X2
C20
C20
10uF/6,3V
10uF/6,3V
3
+5V
+
+
C1
C1
100uF/6,3V
100uF/6,3V
12 34 56
J2
Q3 BSS138Q3BSS138
VDD
R1810R18 10
Q6 BSS138Q6BSS138
+
+
C25
C25
10uF/6,3V
10uF/6,3V
100nF
100nF
3
L1
10uHL110uH
100uF/6,3V
100uF/6,3V
SELECT MODE
PASS DEBUG MASTER PC MASTER
+
+
C21
C21
L2
100uHL2100uH
R2
+
+
3k6R23k6
R5
1%
1k2R51k2
1%
C2
C2
+9V
C6 100nFC6100nF
+9V
C9
C9
R12
R12
10uF/10V
10uF/10V
10k
10k
+
+
Q2 BSS84PQ2BSS84P
+5V
R15
R15
R16
R16
220
220
10k
10k
\IRQOUT
Q5 BSS138Q5BSS138
C23
C23 100nF
100nF
C22
C22 100nF
100nF
D1 MBRS140T3D1 MBRS140T3
2
SWE
5
COMP
TCAP3VCC
C3 220pFC3220pF
MBRS140T3D4MBRS140T3
U3 MC78L09U3 MC78L09
1
D4
GND
2
GND SWC
DC
PK
U1 MC33063A/DU1MC33063A/D
IN3OUT
C17
C17
100nF
100nF
DTR
C19
C19 100nF
100nF
2
4 1
R3 1RR3 1R
8 7 6
R4 1RR4 1R
+
+
C4
C4
33uF/25V
33uF/25V
C7 100nFC7100nF
C8
+5V
100nFC8100nF
R10
R10 10k
10k
2
EN
3
Wake
8
INH
4
TxD
1
RxD
+5V
C13
C13 100nF
100nF
R17
R17
C14
C14
10k
10k
100nF
100nF
16
2
V+
1
VDD
C1+
C2+
3
C2-
C1-
11
R1in
T1in
12
T1out
R1out
10
T2in
R2in
9
R2out
T2out
6
V-
GND
U6
15
MAX202ECSEU6MAX202ECSE
Title
Title
Title
RS232_ LIN Inter face
RS232_ LIN Inter face
RS232_ LIN Inter face
Author:
Author:
Author: Size
Size
Size
Schematic Name:
Schematic Name:
Schematic Name:
B
B
B
Design File Name:
Design File Name:
Design File Name:
Modify Date: Sheet
Modify Date: Sheet
Modify Date: Sheet Copyright Motorola POPI Status:
Copyright Motorola POPI Status:
Copyright Motorola POPI Status:
2
MBRS140T3D5MBRS140T3
7
VSUP
GND
5
RTS
4 5
13 14 8 7
Petr Cholasta
Petr Cholasta
Petr Cholasta
C5
C5
100uF/25V
100uF/25V
LIN_SUP
D5
LIN
U4 MC33399/DU4MC33399/D
C18
C18
100nF
100nF
2001
2001
2001
+
+
BSS138Q1BSS138
6
Q4 BSS138Q4BSS138
MBRS140T3D3MBRS140T3
Q1
R19
R19 10k
10k
1
D2
D3
MBRS140T3D2MBRS140T3
1
+V
2 1
4
3
5
K1
PE014012K1PE014012
R111kR11 1k
+5V
D6
BAV99D6BAV99
MCSL Roznov
MCSL Roznov
MCSL Roznov
1. maje 1009
1. maje 1009
1. maje 1009 756 61 Roznov p.R., Czech Republic, Europe
756 61 Roznov p.R., Czech Republic, Europe
756 61 Roznov p.R., Czech Republic, Europe
00177_01
00177_01
00177_01
D:\R30322_MC159VIEW\MC\MC159\HW\LIN_MASTER\00177_01\00177_01.DSN
D:\R30322_MC159VIEW\MC\MC159\HW\LIN_MASTER\00177_01\00177_01.DSN
D:\R30322_MC159VIEW\MC\MC159\HW\LIN_MASTER\00177_01\00177_01.DSN
JP7JP7
JP8JP8
3
SIO
4
MON3
10
MON2 MON1 DATA RSTB \IRQIN \IRQOUT VDD
GND
CLOCK
MICROMATCH10/FEMALE
MICROMATCH10/FEMALE
DTR RTS
CTS
DSR
CANNON9/FEMALE
CANNON9/FEMALE
11Tuesday, August 26, 2003
11Tuesday, August 26, 2003
11Tuesday, August 26, 2003
General Business
General Business
General Business
1
9 8 7 6 5 4 3 2 1
5 9 4 8 3 7 2 6 1
3
-V1
-V2
2
LIN_HDR4J3LIN_HDR4
of
of
of
Power JackJ1Power Jack
12V/5AmaxMON1
J3
J4
J4
J5
J5
J1
1 2
TX
RX
Rev
Rev
Rev
0.1
0.1
0.1
Figure A-1. LIN Master Board Schematic
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA Hardware Schematics 93
For More Information On This Product,
Go to: www.freescale.com
Page 94
Freescale Semiconductor, Inc.
Hardware Schematics

A.2 LIN Stepper Board Schematic

5
+
C1 100pC1100p
+
GND
VDD
C2
C2 330u/35
330u/35
J1
J1
D D
nc...
I
C C
CON/10MICROMATCH
CON/10MICROMATCH
B B
1
2
POWER_HDR4
POWER_HDR4
J2
J2
VSUP_LIN
3
4
10 9 8 7 6 5 4 3 2 1
1
PTB4/AD4 PTB3/AD3 PTA1/KBD1 PTA0/KBD0 RST IRQ_RQ IRQ_IN VDD VSS PTC4/OSC
J6 HDR 1J6HDR 1
J5 HDR 1J5HDR 1
1
JP1
JP1
IRQ_IN
1
IRQ_RQ
2
HDR 2X1
HDR 2X1
A A
cale Semiconductor,
5
Figure A-2. LIN Enhanced Stepper Board Schematic
4
C3 100nC3100n
U1
U1
20
LIN
42
PTE1/RxD
41
RxD
54
PTA0/KBD0
53
PTA1/KBD1
52
PTA2/KBD2
50
PTA3/KBD3
49
PTA4/KBD4
14
PTA6/SSB
SSB
11
PTB1/AD1
8
PTB3/AD3
7
PTB4/AD4
SensorA1 SensorPA1
6
PTB5/AD5
SensorA2
2
PTB6/AD6/TBCH0
1
PTB7/AD7/TBCH1
5
PTC2/MCLK
4
PTC3/OSC2
3
PTC4/OSC1
BEMF
VDD_A
C4 100nC4100n
4
VDD_A
VSS_A VSS
RST
12
PTD0/TACH0/BEMF
13
PTD1/TACH1
10
RSTB_MCU
17
RSTB_SMOS
9
IRQB_MCU/FLSEPGMN
51
FLSVPP
48
VREFH
47
VDDA
46
EVDD
43
VREFL
44
VSSA
45
EVSS
VSUP
27
24
VSUP
VSUP
GND
GND
30
25
PM908E625ACDWB
PM908E625ACDWB
GND
3
31
VSUP
IRQB_SMOS
3
GC3
GC3 CON
CON
HVDD
FGEN
BEMF
HB1
HB2
HB3
HB4
PA1
VDD
VSS
SSB
2
J3
1
2
3
4
VSS_A
VDD_A VDD
VDD
VSS
VSS_A
Monday, October 06, 2003
Monday, October 06, 2003
Monday, October 06, 2003
2003
2003
2003
00166_03
00166_03
00166_03
5
6
HDR 6X1J3HDR 6X1
J4
J4
1 2 3 4
65
7 8
HDR 4X2 RA
HDR 4X2 RA
LED_YELLD1LED_YELL
Motorola MCSL Roznov
Motorola MCSL Roznov
Motorola MCSL Roznov
1. maje 1009
1. maje 1009
1. maje 1009 756 61 Roznov p. R., Czech Republic, Europe
756 61 Roznov p. R., Czech Republic, Europe
756 61 Roznov p. R., Czech Republic, Europe
D:\R30322_MC159VIEW\MC\MC159\HW\00166_03\00166_03.DSN
D:\R30322_MC159VIEW\MC\MC159\HW\00166_03\00166_03.DSN
D:\R30322_MC159VIEW\MC\MC159\HW\00166_03\00166_03.DSN
23
26
29
32
28
HS
39
SensorH1
37
H1
SensorH2
36
H2
SensorH3
35
H3
34
38
+
+
C5
C5
2u2/10
40
18
19
15
16
33
NC
22
NC
21
NC
2u2/10
IRQ_RQ
SSB
FGEN
BEMF
VDD_AFGEN
GC2
GC2 CON
CON
GC1
GC1 CON
CON
Title
Title
Title
LIN H ID Lamp A ctuato r
LIN H ID Lamp A ctuato r
LIN H ID Lamp A ctuato r
Author:
Author:
Author:
Libor Prokop
Libor Prokop
Libor Prokop
Size
Size
Size
Schematic Name:
Schematic Name:
Schematic Name:
Custom
Custom
Custom
Design File Name:
Design File Name:
Design File Name:
Modify Date: Sheet
Modify Date: Sheet
Modify Date: Sheet Copyright Motorola POPI Status:
Copyright Motorola POPI Status:
Copyright Motorola POPI Status:
2
1
R2
R1
470R2470
470R1470
SensorA2
SensorA1
R4 1k5R41k5
D1
Rev
Rev
Rev
1.0
1.0
1.0
of
of
of
11
11
11
General Business
General Business
General Business
1
Frees
Designer Reference Manual DRM047 — Rev 0
94 Hardware Schematics MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 95
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047

Appendix B. 908E625 Advantages and Features

This general purpose IC from Motorola has been developed as a highly integrated and cost-effective solution for load driving within intelligent LIN distributed architectures. It is especially suited to the control of automotive mirror, door-lock, and light-levelling applications.
nc...
I
cale Semiconductor,
Frees
Figure B-1. 908E625 Simplified Block Diagram
This device is a multi-chip combination within a 54-lead Small Outline Integrated Circuit (SOIC) package. It consists of a standard HC08 MCU chip with SCI, SPI, internal oscillator, and FLASH memory, plus a Power
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA 908E625 Advantages and Features 95
For More Information On This Product,
Go to: www.freescale.com
Page 96
Freescale Semiconductor, Inc.
908E625 Advantages and Features
Die with four half-bridges and one high-side switch with diagnostic functions combined with Hall sensor and analog inputs, a LIN physical layer, and a voltage regulator.
908E625 Features:
Multi-chip combination within a 54-lead SOIC package
High-performance M68HC08 core
16K bytes of on-chip FLASH memory
512 bytes of RAM
Internal clock generation module
nc...
I
16-bit, 2-channel timet
cale Semiconductor,
Frees
10-bit analog-to-digital converter (ADC)
LIN physical layer interface
Three 2-pin Hall sensor inputs
One analog input with switchable current source
Four low-resistive half-bridge outputs with current limitation
One low-resistive high-side output
14 microcontroller I/Os
Designer Reference Manual DRM047 — Rev 0
96 908E625 Advantages and Features MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 97
Freescale Semiconductor, Inc.
Designer Reference Manual — DRM047

Appendix C. LIN Frames and Signals

This section describes LIN messaging with the frames, signals and the LIN Stepper Controller functionality.

C.1 LIN Leveller Basic Frames

nc...
I
Figure C-1 describes the LIN Leveller signals and frames.
cale Semiconductor,
Frees
NOTE: The LIN messaging scheme, with exact signal description and updated
according to latest software modifications, is described in the file Messaging_LIN_Levellew.xls which is provided with the application software files.
The signal provider is the node that sends the response fields (Section 9. References, 2) of the described frame. The signal acceptor is the node that is programmed to act on the received frame (see
Section 4.1. Axis and Signal Providers and Acceptors).
The column Signal Functionality Description describes the LIN Stepper Controller functionality according to the described signal. The raw value range is the range of the signal in system units. Although the LIN API specifies the unsigned signals, some signals (e.g. position) have signed representation. The normalized value is a physical representation of the signal (variable).
NOTE: The normalized value range is determined by the scaling factor. The
scaling constants RESOLUTION_FREQUENCY_HZ, RESOLUTION_PERIOD_NS are defined and can be changed in the LIN Stepper software header files.
See Sections 6.3.1, 6.3.2, 6.3.3, and 6.3.4 for information about scaling.
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Frames and Signals 97
For More Information On This Product,
Go to: www.freescale.com
Page 98
Freescale Semiconductor, Inc.
LIN Frames and Signals
Table C-1. LIN Leveller Messaging
nc...
I
cale Semiconductor,
Frees
Signal
Provi
der
Master
Signal Accep
tor(s)/
Axis
A1_1
A1_2
Frame Name
(ID)
(0x20)
frmPosCmdA1
Signal Name Signal Functionality Description
Required absolute Position. The LIN
l_u16_rd_positionReqA1
l_u8_rd_frequencyReqA1
l_bool_rd_flagClrA1
l_bool_rd_AppInitFlagA1
l_bool_rd_PosResetFlagA1
Stepper Controller acceptor provides automatic control of the actual position to this value
Required Frequency. The LIN Stepper
Controller acceptor provides automatic position control with motor actual stepping frequency trying to ramp up (or down) to the Required Frequency.
Clear Error Flag. The LIN Stepper
Controller acceptor provides all system error clear
Application Initialization Flag. The LIN
Stepper Controller acceptor puts all processes to the application initialization state. The actual position is not initialized in this state.
For details see Section 6.1.2.
Position and Speed Control
Caution: The application init. state is unconditionally entered even if the motor is not stopped. This can cause the actual position to be lost.
Position Reset Flag. The LIN Stepper
Controller acceptor provides motor position reset.
This position reset is described below:
- software controls the motor stepping to the positionResetRqValue.
- mechanical stall keeps the motor at defined position (even the electrical stepping is in progress)
- after actual position counter reaches the positionResetRqValue, the software sets the counter to positionStall
For details see Section 6.1.2.
Position and Speed Control
Note: There can be other requirements
to control the motor to a reset position, e.g. using stall detection or Hall sensor. These were not used in current software but can be easily implemented on LIN Stepper Controller
Raw
Value
Range
<0xC000, 0x3FFF>
x = <0x00, 0xFF>
0 False 1 True
0 False 1 True
0 1
Normalized
Value
Range
<-16384, 16383>
f(x) =
RESOLU TION_FR EQUENC Y_HZ *x
[Hz]
0-False 1-True
Designer Reference Manual DRM047 — Rev 0
98 LIN Frames and Signals MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 99
Freescale Semiconductor, Inc.
Table C-1. LIN Leveller Messaging (Continued)
LIN Frames and Signals
LIN Leveller Basic Frames
nc...
I
cale Semiconductor,
Frees
Signal
Master
Master A2
Master A3
Signal
Provi
der
A1_1 Master
Accep
tor(s)/
Axis
A1_1 A1_2
Frame Name
(ID)
frmPosCmdA1
(0x20)
frmPosCmdA2
(0x23)
frmPosCmdA3
(0x25)
frmPosStatusA1_1
(0x21)
Signal Name Signal Functionality Description
Light On Flag. The LIN Stepper
Controller acceptor controls the High
l_bool_rd_LightOnFlagA1
l_u16_wr_positionActA1_1
l_u8_wr_frequencyActA1_1
l_u8_wr_uAppFlags1A1_1
Side switch of the power output. So the connector J3 pin 6 can be used for the light on/off control
same as frmPosCmdA1
but the acceptor is A2
same as frmPosCmdA1
but the acceptor is A3
Actual absolute Position. The LIN
Stepper Controller provider sends the
actual position of the position counter
Actual Frequency. The LIN Stepper
Controller provider sends the
actual motor stepping frequency
Application status Flags #1 The LIN
Stepper Controller provider sends
the status byte with the flags bit0 StepRun - motor is stepping = run bit1 StopTimeout - stop timeout (after
stepping before setting motor block) bit2 PositPark - motor is actually
stopped with actual position =
positionPark bi3 PositResetDone - position reset
was provided after last MCU reset bit4 AppInitDone - application
initializationflag
0 - initialization started
1 - initialization done bit5 LightOn - light (Hight side switch
on the connector J3 pin 6) set to on bit6 StallDetected - NOT
IMPLEMENTED stall detected bit7RotDirSign - motor rotation
direction signature
1 - actual position decremented
0 - actual position incrementing
Raw
Value
Range
0 1
<0xC000, 0x3FFF>
x = <0x00, 0xFF>
0 1
Normalized
Value
Range
0-HS OFF 1-HS ON
<-16384, 16383>
f(x) =
RESOLU TION_FR EQUENC Y_HZ * x
[Hz]
0 - False 1 - True
A1_2 Master
A2 Master
A3 Master
frmPosStatusA1_2
(0x22)
frmPosStatusA2
(0x24)
frmPosStatusA3
(0x26)
same as frmPosStatusA1_1
but the signal provider is A1_2
same as frmPosStatusA1_1
but the signal provider is A2
same as frmPosStatusA1_1
but the signal provider is A3
DRM047 — Rev 0 Designer Reference Manual
MOTOROLA LIN Frames and Signals 99
For More Information On This Product,
Go to: www.freescale.com
Page 100
Freescale Semiconductor, Inc.
LIN Frames and Signals
Table C-1. LIN Leveller Messaging (Continued)
Signal
Provi
der
A1_1 Master
nc...
I
A1_2 Master
A2 Master
A3 Master
cale Semiconductor,

C.2 Node ID

Signal Accep
tor(s)/
Axis
Frame Name
(ID)
frmAppStatusA1_1
(0x1C)
frmAppStatusA1_2
(0x1D)
frmAppStatusA2
(0x1E)
frmAppStatusA3
(0x1F)
Signal Name Signal Functionality Description
Application Error Flags. The LIN
Stepper Controller provider sends
the error byte with the flags bit0 HighTemperature - Power Die
over temperature bit1 HB_OverCur - H-bridge
overcurrent flag bit2 HighVoltage - H-bridge high
voltage
l_u8_wr_AppErrFlagsA1_1
l_u8_wr_analogValueA1_1
bit3 LowVoltage - H-bridge low
voltage bit4 PowerDieError - Power Die error bit5 LINTxRxError - NOT
IMPLEMENTED
bit6 SICurrLim - serial input current
limitation bit7 StopSpeedError - speed was too
enough when motor stopped
(possible loss of the step - used for
software debugging)
NOT IMPLEMENTED - any analog
value like temperature, DC bus
voltage, etc. can be send out from
the LIN Stepper Controller provider
same as frmAppStatusA1_1
but the signal provider is A1_2
same as frmAppStatusA1_1
but the signal provider is A2
same as frmAppStatusA1_1
but the signal provider is A3
Raw
Value
Range
0 1
Normalized
Value
Range
0 - False 1 - True
Frees
The controlled axis specifies the relation to the LIN basic messages; each LIN Stepper Controller node relation to LIN messaging is specified by two parameters
the configured axis
exclusive Node ID
The Node ID is used for configuration. The LIN Master Request and Slave Response Frames (Command frames) used for configuration are broadcast frames (each slave node acts upon them). We must
Designer Reference Manual DRM047 — Rev 0
100 LIN Frames and Signals MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Loading...