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 0Designer Reference Manual
MOTOROLAIntroduction13
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 ManualDRM047 — Rev 0
14IntroductionMOTOROLA
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 0Designer Reference Manual
MOTOROLAIntroduction15
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) Acceptorthe device which receives and responses to
AFSAdvanced Front Lighting System
Caironesee Power Die
cale Semiconductor,
ESCIEnhanced Serial Communication Interface
DSPDigital Signal Processor
Frees
ECTEnhanced Capture Timer
HID LampHigh Intensity Density headlamp
LIN Levellerthe system described in this reference
a bus signal
design. It consists of the LIN master and
LIN stepper controllers
LIN-busa local interface network standard for serial
asynchronous communication (see
Section 9. References, 2)
Designer Reference ManualDRM047 — Rev 0
16IntroductionMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 17
Freescale Semiconductor, Inc.
LIN Mastermaster board with LIN master software
LIN Master Softwarethe LIN-bus master software for stepper
LIN SIO WireLIN-bus signal (Serial Input Output) wire
LIN Stepper ControllerLIN-bus slave board with General Purpose
LIN Stepper Softwarethe LIN-bus slave stepper motor control
LIN Stepper Boardslave 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 Boardmaster board hardware for LIN Master
MCUmicrocomputer unit
PCBprinted circuit board
Power Diepart of 908E625 with H-bridges LIN
SCISerial Communication Interface module
(signal) providerthe 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 0Designer Reference Manual
MOTOROLAIntroduction17
For More Information On This Product,
Go to: www.freescale.com
Page 18
Introduction
nc...
I
Freescale Semiconductor, Inc.
cale Semiconductor,
Frees
Designer Reference ManualDRM047 — Rev 0
18IntroductionMOTOROLA
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 0Designer Reference Manual
MOTOROLASystem Concept19
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 RHead Lamp L
Head Lamp RHead 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 ManualDRM047 — Rev 0
20System ConceptMOTOROLA
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 0Designer Reference Manual
MOTOROLASystem Concept21
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 ManualDRM047 — Rev 0
22System ConceptMOTOROLA
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 0Designer Reference Manual
MOTOROLASystem Concept23
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 ManualDRM047 — Rev 0
24System ConceptMOTOROLA
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 0Designer Reference Manual
MOTOROLASystem Concept25
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 ManualDRM047 — Rev 0
26System ConceptMOTOROLA
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 0Designer Reference Manual
MOTOROLAHardware Description27
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 ManualDRM047 — Rev 0
28Hardware DescriptionMOTOROLA
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.
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 ManualDRM047 — Rev 0
30Hardware DescriptionMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Page 31
Freescale Semiconductor, Inc.
MCU 908EY16Power 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 0Designer Reference Manual
MOTOROLAHardware Description31
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
1PTC4/OSC19,6608kHz
2VSSGroundGND
3VDD5V supply5V
4InIRQ_INMCU IRQ Input9V
5OutIRQ_RQ
6InRSTMCU Reset inputfalling edge
7In/Out
8In
Input/
Output
Pin NameDescriptionMON08 mode
PTA0/KB0
PTA1/KB1
Power Die IRQ
output
MON08 mode
MON08 modeGND
jumper JP1 open
serial
communication
19.200 kBaud
9In
Designer Reference ManualDRM047 — Rev 0
32Hardware DescriptionMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
PTB3/AD3
MON08 modeGND
Page 33
Freescale Semiconductor, Inc.
Table 3-1. Connector J2 Signals
Hardware Description
Slave Board
Pin No
10In
Input/
Output
Pin NameDescriptionMON08 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 NoInput/OutputSignalrange
1GND GND GND
2Out
3Out
4Out
5In
6InHigh Side0-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 0Designer Reference Manual
MOTOROLAHardware Description33
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 NoInput/OutputSignalrange
1GNDVSS_AGND
nc...
I
cale Semiconductor,
Frees
2InSensor Analog 10-5V
3In Sensor Hall 1
4InSensor Analog 10-5V
5In Sensor Hall 2
6InSensor Power Analog 10-5V
7In Sensor Hall 3
8Output
HVDD Switchable 5V
output to power sensors
5V
Designer Reference ManualDRM047 — Rev 0
34Hardware DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLAMessaging Scheme Description35
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 ManualDRM047 — Rev 0
36Messaging Scheme DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLAMessaging Scheme Description37
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 ManualDRM047 — Rev 0
38Messaging Scheme DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLALIN Master Software Description39
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 ManualDRM047 — Rev 0
40LIN Master Software DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLALIN Master Software Description41
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 ManualDRM047 — Rev 0
42LIN Master Software DescriptionMOTOROLA
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.
Figure 5-2. PC Master Mode Data Flow Chart - Part1
Designer Reference ManualDRM047 — Rev 0
44LIN Master Software DescriptionMOTOROLA
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).
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 ManualDRM047 — Rev 0
46LIN Master Software DescriptionMOTOROLA
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.
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 numberPin namePin type
1CLOCKOutputHigh impedance state19,6608MHz clock
2GNDPowerGroundGround
3VDDOutput
4\IRQOUTOutput
5\IRQINInput+5V (pull-up)+5V (pull-up)
6RSTB
7DATABidirectionalTxD 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
8MON1OutputHigh impedance state
Designer Reference ManualDRM047 — Rev 0
48LIN Master Software DescriptionMOTOROLA
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 numberPin namePin type
9MON2OutputHigh impedance state
10MON3OutputHigh 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 0Designer Reference Manual
MOTOROLALIN Master Software Description49
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 ManualDRM047 — Rev 0
50LIN Master Software DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLALIN Stepper Software Description51
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 ManualDRM047 — Rev 0
52LIN Stepper Software DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLALIN Stepper Software Description53
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 ManualDRM047 — Rev 0
54LIN Stepper Software DescriptionMOTOROLA
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_AFTERRAMP_RESERVEnumber of steps with starting
frequency after deceleration ramp
[steps]
2reserve for following acceleration
requires1 acceleration step and 1
deceleration step [steps]
DECEL_NUMERICAL_RESERVEdeceleration 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 0Designer Reference Manual
MOTOROLALIN Stepper Software Description55
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 ManualDRM047 — Rev 0
56LIN Stepper Software DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLALIN Stepper Software Description57
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 ManualDRM047 — Rev 0
58LIN Stepper Software DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLALIN Stepper Software Description59
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 ManualDRM047 — Rev 0
60LIN Stepper Software DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLALIN Stepper Software Description61
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 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 0Designer Reference Manual
MOTOROLALIN Stepper Software Description63
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 ManualDRM047 — Rev 0
64LIN Stepper Software DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLALIN Stepper Software Description65
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 ValueMAX_U16 1+()
SWord16 ValueMAX_S16 1+()
UB yte ValueMAX_U8 1+()
SB yte ValueMAX_S8 1+()
where:
Real Value
=
-------------------------------------------------------------Real Quantity Range Max
NOTE:The actual frequency variable frequencyActLowHigh is represented as
an union. Then for the acceleration calculations it can be accessed as
Designer Reference ManualDRM047 — Rev 0
68LIN Stepper Software DescriptionMOTOROLA
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:
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 0Designer Reference Manual
MOTOROLAUser Interface Description71
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 ManualDRM047 — Rev 0
72User Interface DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLAUser Interface Description73
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 ManualDRM047 — Rev 0
74User Interface DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLAUser Interface Description75
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 ManualDRM047 — Rev 0
76User Interface DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLAUser Interface Description77
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 ManualDRM047 — Rev 0
78User Interface DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLAUser Interface Description79
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
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
periodeSendMinperiodeSendMin_Loop2
periodeSendReqperiodeSendReq_Loop2
periodeSendperiodeSend_Loop2
positionReqpositionReq_Loop2
frequencyReqfrequencyReq_Loop2
ClrFlagClrFlag_Loop2
AppInitFlagAppInitFlag_Loop2
PosResetFlagPosResetFlag_Loop2
Name of representative from
Watch variable
TxPositionError_Loop2
RxPosStatusError_Loop2
RxStatusError_Loop2
axisTxPosition_Loop2Target device of PosCmd frame
axisRxPosStatus_Loop2Target device of PosStatus frame
axisRxStatus_Loop2Target 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>,
LightOnFlagLightOnFlag_Loop2
positionActpositionAct_Loop2
frequencyActfrequencyAct_Loop2
AppFlagsuAppFlags_Loop2
Designer Reference ManualDRM047 — Rev 0
82User Interface DescriptionMOTOROLA
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
analogValueanalogValue_Loop2
AppErrFlagsuAppErrFlags_Loop2
positionReqManualpositionReqManual_Loop2Value 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
StatusLIN_Status
ErrorCreated as OR function of all error messages in HTML page code
Sleep/Wake-upLIN_SleepWakeReq
Run/StopLIN_RunStopReq
Park PositionParkSets 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 0Designer Reference Manual
MOTOROLAUser Interface Description83
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 ManualDRM047 — Rev 0
84User Interface DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLAUser Interface Description85
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 ManualDRM047 — Rev 0
86User Interface DescriptionMOTOROLA
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 0Designer Reference Manual
MOTOROLAConclusion87
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 ManualDRM047 — Rev 0
88ConclusionMOTOROLA
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 0Designer Reference Manual
MOTOROLAConclusion89
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 ManualDRM047 — Rev 0
90ConclusionMOTOROLA
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 0Designer Reference Manual
MOTOROLAReferences91
For More Information On This Product,
Go to: www.freescale.com
Page 92
References
nc...
I
Freescale Semiconductor, Inc.
cale Semiconductor,
Frees
Designer Reference ManualDRM047 — Rev 0
92ReferencesMOTOROLA
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
DD
+5V
CC
C12
C12
100nF
100nF
BB
R20
R20
10k
10k
AA
MONx JPx
High
Low ON
ON - JUMPER PINS ARE SHORT - CIRCUIT
OFF - JUMPER PINS AREN'T SHORT- CIRCUIT
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 0Designer Reference Manual
MOTOROLA908E625 Advantages and Features95
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 ManualDRM047 — Rev 0
96908E625 Advantages and FeaturesMOTOROLA
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 0Designer Reference Manual
MOTOROLALIN Frames and Signals97
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 NameSignal 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 ManualDRM047 — Rev 0
98LIN Frames and SignalsMOTOROLA
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
MasterA2
MasterA3
Signal
Provi
der
A1_1Master
Accep
tor(s)/
Axis
A1_1
A1_2
Frame Name
(ID)
frmPosCmdA1
(0x20)
frmPosCmdA2
(0x23)
frmPosCmdA3
(0x25)
frmPosStatusA1_1
(0x21)
Signal NameSignal 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
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_2Master
A2Master
A3Master
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 0Designer Reference Manual
MOTOROLALIN Frames and Signals99
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_1Master
nc...
I
A1_2Master
A2Master
A3Master
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 NameSignal 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 ManualDRM047 — Rev 0
100LIN Frames and SignalsMOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.