background image

 

LIN Stepper Software Data Variables

Designer Reference Manual

DRM047 — Rev 0

114

LIN Stepper Software Data Variables

MOTOROLA

 

   

  

F

re

e

sc

a

le

 S

e

m

ic

o

n

d

u

c

to

r,

 I

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

 

Freescale Semiconductor, Inc.

For More Information On This Product,

   Go to: www.freescale.com

n

c

.

..

Summary of Contents for M68HC08 series

Page 1: ... DRM047 Rev 0 12 2003 Designer Reference Manual LIN bus HID Lamp Levelling Stepper Motor Control Using Motorola 908E625 Reference Design Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 2: ...Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 3: ...d trademarks of Motorola Inc Metrowerks and the Metrowerks logo are registered trademarks of Metrowerks Inc a wholly owned subsidiary of Motorola Inc CodeWarrior is a registered trademark of Metrowerks Inc a wholly owned subsidiary of Motorola Inc Microsoft is a registered trademark of Microsoft Corporation in the U S and other countries Freescale Semiconductor I Freescale Semiconductor Inc For Mo...

Page 4: ...Designer Reference Manual DRM047 Rev 0 2 MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 5: ...res 20 2 2 LIN Stepper Controller 21 2 3 LIN Master 22 2 4 Personal Computer 24 Section 3 Hardware Description 3 1 Master Board 27 3 2 Slave Board 28 Section 4 Messaging Scheme Description 4 1 Axis and Signal Providers and Acceptors 35 4 2 LIN Leveller Basic Messaging 36 4 3 LIN Leveller Configuration Messaging 37 Section 5 LIN Master Software Description Freescale Semiconductor I Freescale Semico...

Page 6: ...ter Software General Overview 71 7 3 LIN bus Control 73 7 4 Slave Control 73 7 5 Recorder 77 7 6 Oscilloscope 78 7 7 Programming and Configuration 83 Section 8 Conclusion Section 9 References Appendix A Hardware Schematics A 1 LIN Master Board Schematic 93 A 2 LIN Stepper Board Schematic 94 Appendix B 908E625 Advantages and Features Appendix C LIN Frames and Signals C 1 LIN Leveller Basic Frames 9...

Page 7: ...per Software Data Variables Appendix E System Setup E 1 Hardware Setup 115 E 2 Jumper Settings of Master and Slave Boards 117 E 3 Required Software Tools 118 E 4 Building and Uploading the Application 118 E 5 Executing the LIN HID Demo Application 120 Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 8: ...Designer Reference Manual DRM047 Rev 0 8 MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 9: ...e Data Flow Chart 49 5 6 Pass Mode Data Flow Chart 50 6 1 LIN Stepper Software Data Flow 1 53 6 2 Motor Position and Speed Control Service Updated Requests 56 6 3 Motor Position and Speed Control Service Updated Actual Position 57 6 4 Frequency Acceleration and Deceleration Flow Chart 58 6 5 LIN Stepper Software Data Flow 2 Configuration 61 6 6 LIN Stepper Software Application State Diagram 63 7 1...

Page 10: ...m 95 C 1 Configuration Parameters Addressing 108 E 1 LIN HID Demo Application 116 E 2 Programming and Debugging Application Detail 117 E 3 Metrowerks Compiler with lin_stepper mcp 119 E 4 Bootloader Setting 120 E 5 Communication Page 121 E 6 Variables Source page 122 Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 11: ...d Variable Watch Variables Comparison Loop1 80 7 2 LIN bus Control Page and Variable Watch Variables Comparison Loop2 81 7 3 LIN bus Control Page and Variable Watch Variables Comparison Status Notes and State Buttons 83 C 1 LIN Leveller Messaging 98 C 2 LIN Leveller Configuration Frames 103 D 1 Stepper Controller Software Data Variables 111 E 1 Master and Slave Boards Jumper Settings 117 Freescale...

Page 12: ...Designer Reference Manual DRM047 Rev 0 12 MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 13: ...ster 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 i...

Page 14: ...ctions 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 1 3 HID Headlamp Levell...

Page 15: ...em 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 prot...

Page 16: ...l speed is fully sufficient for a headlamp leveller with a stepper motor actuators The advantage versus other bus protocols such as CAN bus is low system cost 1 5 Definitions and Acronyms The definitions and acronyms used in this reference design are listed below signal Acceptor the device which receives and responses to a bus signal AFS Advanced Front Lighting System Cairone see Power Die ESCI En...

Page 17: ...e stepper controller The PCB layout is same as LIN Enhanced Stepper Board Some parts are not populated LIN Enhanced Stepper Board slave stepper board hardware for LIN Master with sensor connector and other components LIN Master Board master board hardware for LIN Master MCU microcomputer unit PCB printed circuit board Power Die part of 908E625 with H bridges LIN physical layer high side switch con...

Page 18: ...Introduction Designer Reference Manual DRM047 Rev 0 18 Introduction MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 19: ... single wire LIN bus The master controller can handle 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 The control system consists of the following modules Personal Computer LIN Master LIN mas...

Page 20: ... with 3 and half axes Embedded code written in C language LIN Master Board RS 232 Program Debugging Interface Stepper Axis 1_1 Stepper Axis 1_2 Stepper Axis 2 Stepper Axis 3 RS232 LIN bus LIN physical interface HC12 CPU Application Control GUI pc master s w LIN Stepper Slave HC08 S W Head Lamp R Head Lamp L Master HC12 S W LIN Stepper Board PM908E625 LIN Stepper Controller LIN Master Board RS 232 ...

Page 21: ...s 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 ...

Page 22: ...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 a...

Page 23: ...IN Stepper configuration and programing using master request slave response frames defined for this application 2 3 2 Master Mode 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 2 3 3 Debug Mode In this mode it is possible to program and ...

Page 24: ... 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 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 comp...

Page 25: ...ll 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 Master Applicati...

Page 26: ...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 Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 27: ...pply currents up to 5 A It can be used in four different modes as described in Section 2 3 LIN Master 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 Figure 3 1 Master Board DEBUG MODE SELECTION RS232 LIN RESET BUTTON 12V MONs Freescale Semiconductor I Freescale Semiconductor Inc For More Infor...

Page 28: ...t incorrect supply voltage polarity and provides this feature to all LIN Stepper Controllers supplied by the Master Board 3 2 Slave 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 RS232 physical interface LIN physical interf...

Page 29: ... 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...

Page 30: ... 17 FGEN 15 PTD0 TACH0 BEMF 12 PTB1 AD1 11 RSTB_MCU 10 IRQB_MCU FLSEPGMN 9 VSUP 31 GND 30 HB3 29 HS 28 VSUP 27 HB2 26 GND 25 VSUP 24 H2 36 H1 37 VDD 38 PA1 39 PTA1 KBD1 53 PTA0 KBD0 54 HB1 23 EVDD 46 VDDA 47 PTE1 RxD 42 BEMF 16 VREFL 43 VSSA 44 EVSS 45 PTA2 KBD2 52 FLSVPP 51 PTA3 KBD3 50 PTA4 KBD4 49 H3 35 HVDD 34 NC 33 HB4 32 PTB3 AD3 8 PTB4 AD4 7 PTB5 AD5 6 PTC2 MCLK 5 LIN 20 SSB 19 NC 22 NC 21 ...

Page 31: ...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 MCU 908EY16 Power Die SPI LIN bus...

Page 32: ...ational 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 Pin1 PTC4 OSC is precise clock input for MON08 mode There must be external clock source for the software download and debugging Table 3 1 Connector J2 Signals Pin No Input...

Page 33: ... 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 10 In PTB4 AD4 MON08 mode Vdd 5V via 10k resistor Table 3 1 Connector J2 Signals Pin No Input Output Pin Name Description MON08 mode Table 3 2 Connector J3 Signals Pin No I...

Page 34: ...for possible use of Hall sensors or analog signals There is a place for connector J4 resistors R2 R1 Table 3 3 Connector J4 Signals Pin No Input Output Signal range 1 GND VSS_A GND 2 In Sensor Analog 1 0 5V 3 In Sensor Hall 1 4 In Sensor Analog 1 0 5V 5 In Sensor Hall 2 6 In Sensor Power Analog 1 0 5V 7 In Sensor Hall 3 8 Output HVDD Switchable 5V output to power sensors 5V Freescale Semiconductor...

Page 35: ... 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 Thi...

Page 36: ... 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...

Page 37: ...he 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 LIN Reconfiguration 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 con...

Page 38: ...heme Description Designer Reference Manual DRM047 Rev 0 38 Messaging Scheme Description MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 39: ...n 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 5 1 2 Mode Selection 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 recognize...

Page 40: ...ster software driver Initialize LIN driver including initialization of SCI0 and ECT channel0 Set up ECT each channels acts as an output compare and causes the corresponding interrupt channel1 Loop1 timing channel2 Loop2 timing channel3 PC master software recorder Set all program flow control and state variables Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Prod...

Page 41: ...Init Control LIN communication according to change of variables by means of PC master Reload variables Run PC master Recorder Send Sleep Wake up LIN frames Send Receive Programming and Configuration frames Enable Periode timing interrupts Wait for Periode timing interrupt Send Receive LIN frames Send Receive LIN frames Wait for Periode timing interrupts Exchange data between RS232 and Debug line E...

Page 42: ...e 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 5 2 2 Slave Sleep Wake up Programming and Configuration Replaces a function that is able to send and receive the frames below according to the states of the control variables ...

Page 43: ...ty 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...

Page 44: ...ableRxStatus_Loop1 periodeSend_Loop1 periodeSendMin_Loop1 ctrlFlag_Loop1 FieldOfPositions positionReqManual_Loop1 frequencyReq_Loop1 positionReq_Loop1 TxPositionError_Loop1 positionAct_Loop1 frequencyAct_Loop1 uAppFlags_Loop1 uAppErrFlags_Loop1 analogValue_Loop1 RxStatusError_Loop1 RxPosStatusError_Loop1 autCurveSelect modeAutMan_Loop1 autReset_Loop1 positionReqSent_Loop1 LOOP1_TIMER_Interrupt Sen...

Page 45: ... All variables surrounding this bubble are described in Section 7 3 LIN bus Control 5 2 5 Error Handling 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 Freescale Sem...

Page 46: ... applied These are used in PC master mode enableTxPosition_Loop2 enableRxPosStatus_Loop2 enableRxStatus_Loop2 periodeSendMin_Loop2 periodeSendReq_Loop2 periodeSend_Loop2 positionReqManual_Loop2 frequencyReq_Loop2 ctrlFlag_Loop2 positionReq_Loop2 positionAct_Loop2 frequencyAct_Loop2 uAppFlags_Loop2 uAppErrFlags_Loop2 analogValue_Loop2 positionReqSent_Loop2 TxPositionError_Loop2 RxStatusError_Loop2 ...

Page 47: ...including the required position of the LIN Stepper Controller HID lamp which is the read out from FieldOfPossition array curve SLOW FAST 5 2 9 Error Handling See Section 5 2 5 Error Handling Figure 5 4 Master Mode Data Flow Chart TxPositionError_Loop1 positionAct_Loop1 frequencyAct_Loop1 uAppFlags_Loop1 uAppErrFlags_Loop1 analogValue_Loop1 RxStatusError_Loop1 RxPosStatusError_Loop1 positionReqSent...

Page 48: ... line pin assignments and the relationship to the RS232 line signals Table 5 1 Debug Line Output Pin number Pin name Pin type Master Board signals DTR High level Reset DTR Low level Debugging and programming 1 CLOCK Output High impedance state 19 6608MHz clock 2 GND Power Ground Ground 3 VDD Output Connected to ground discharging capacitors of Slave Board push supply voltage line to 0V Open collec...

Page 49: ...IO wire and then copies the LIN SIO wire signal back to TxD RS232 see Figure 5 6 Functionality of the Exchange 9 MON2 Output High impedance state 0V Set by JP2 on Master Board 10 MON3 Output High impedance state 5V Set by JP3 on Master Board Table 5 1 Debug Line Output Pin number Pin name Pin type Master Board signals DTR High level Reset DTR Low level Debugging and programming Debug Programming C...

Page 50: ...Software Description MOTOROLA data procedure was successfully tested with data speeds up to 20 kBaud Figure 5 6 Pass Mode Data Flow Chart PTS PTS LIN RS232 Exchange data Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 51: ... 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 Detailed descriptions of the data variables are in Appendix D LIN Stepper Software Data Variables A description of the application processes starts here 6 1 1 Slave Application Control The Slave Application Control is the software top level...

Page 52: ...ermine 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...

Page 53: ... sParameterRAM positionReq eAppState l_u16_wr_positionAct l_u8_wr_frequencyAct l_u8_wr_AppFlags1 uAppFlags1 l_u8_wr_AppErrFlags l_bool_rd_ClrFlag l_bool_rd_PosResetFlag l_bool_rd_LightOnFlag uMotStepControlFlags uAppErrFlags SPI Driver erHBOU Timer Motor Step erPOUT erIFR erIMR erSYSCTL erSYSSTAT POUT IFR IMR SYSCTL SYSSTAT HBOUT sParameterRAM curentBlockRun sParameterRAM uAppConfigByte1 fun fun f...

Page 54: ... 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 bet...

Page 55: ...TERRAMP_RESERVE number of steps with starting frequency after deceleration ramp steps 2 reserve for following acceleration requires1 acceleration step and 1 deceleration step steps DECEL_NUMERICAL_RESERVE deceleration reserve to cover the difference between acceleration and deceleration ramps caused by numerical rounding steps Service of the Updated Requests is shown in Figure 6 2 It provides the ...

Page 56: ...sition 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 Updated Requests positionDif 0 positionDif positionReq positionAct Yes Step Start Return StepRun StopTimeout Yes No No Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to w...

Page 57: ...n periodStep 1 frequencyAct 1 Return 1 positive rotation direction decelDistance DECEL_RESERVE positionDif StepRun flag StopTimeout flag No Yes Return StepRun flag Yes frequencyReq frequencyActLowHigh Yes No positionDecelAfterRamp 0 No Yes Return Yes decelDistance DECEL_RESERVE positionDif frequencyActLowHig Frequency Acceleration No Yes frequencyActLowHig Frequency Deceleration frequencyReq frequ...

Page 58: ...ion Flow Chart frequencyActLowHigh Frequency Deceleration frequencyActLowHigh acceleration positionDecelDistance frequencyStart Return positionDecelAfterRamp limited to 0 positionDecelDistance limited to 0 frequencyActLowHigh periodStep acceleration frequencyStart frequencyActLowHigh Byte Hi gh frequencyActLowHigh frequencyStart Yes No frequencyActLowHigh Frequency Acceleration frequencyActLowHigh...

Page 59: ...equency 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...

Page 60: ...n initialization e g a Hall sensor with a defined position is used the current software could be adapted simply by changing of the Position Sensing process 6 1 5 LIN Driver 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 ...

Page 61: ... parameters RAM to LIN l_u8_wr_dataX signals according to l_u8_rd_paramArray 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 LIN Driver LIN Messages Slave App Control positionAct eAppState sParameterRAM sParameterROM Config Param Reconfig LIN l_u8_rd_service l_u8_rd_configLINAxis l_u8_rd_paramArray l...

Page 62: ...resets 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 6 2 1 MC...

Page 63: ...The application performs the following initializes timers MCU Init App Prepare Sleep App Wake up App Init Done App Run Done App Sleep SysMasterRequest_Sleep Done LIN Wake up Request Done l_bool_rd_AppInitFlag App Position Reset l_bool_rd_PosResetFlag PositResetDone App Configuration l_u8_rd_nodeIDCurent sParameterRAM nodeID SysMasterRequest_Download OR SysMasterRequest_Store OR SysMasterRequest_LI...

Page 64: ...te 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 P...

Page 65: ...n 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 6 3 1 Scaling of Quantities The LIN Leveller application uses signed 16 bit type SWord16 unsigned 16 bit type UWord16 signed 8 bit type SByt...

Page 66: ... of the real value Real Value is the real value of the quantity V A RPM etc Real Quantity Range Max is the maximum of the quantity range defined in the application V A RPM etc MAX_U16 65535 is the maximum of the unsigned 16 bit variable MAX_S16 32768 is the maximum of the signed 16 bit variable MAX_U8 255 is the maximum of the unsigned 8 bit variable MAX_S8 127 is the maximum of the signed 8 bit v...

Page 67: ...ented by LSB bit of the Variable X Max Type Variable X system Variable X maximum according to the Variable Type Type UWord16 MAX_U16 65535 Type SWord16 MAX_S16 32768 Type UByte MAX_U8 255 Type SByte MAX_S8 127 And hence the Real Value EQ 11 Real Value UWord16 Value Real Quantity Range Max MAX_U16 1 Real Value SWord16 Value Real Quantity Range Max MAX_S16 1 Real Value UByte Value Real Quantity Rang...

Page 68: ...solution Acceleration is EQ 18 NOTE The actual frequency variable frequencyActLowHigh is represented as an union Then for the acceleration calculations it can be accessed as Resolution Period Timer Prescaller Division Bus Frequency Real Step Period periodStep Resolution Period UWord16 Variable3 UWord16 Variable1 UByte Variable2 256 Frequency Difference SteppingPeriod Acceleration Resolution Freque...

Page 69: ... 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 EQ 20 The conversion must take into account the variables scaling EQ 21 EQ 22 So the final calculation using the udiv16_8to16 function is EQ 23 where Resolution Peri...

Page 70: ... Utilization Table 6 1 shows how much memory is required to run the LIN Stepper Controller with code compiled with Metrowerks CodeWarrior v 2 1 Table 6 1 Stepper Controller Software Memory Utilization Memory Used by Software Important Sections Size FLASH ROM 4039 Bytes Parameter ROM 16B LIN Reconfig ROM 128B RAM 278 Bytes Stack 64B LIN Reconfig RAM 96B Parameter RAM 16B Freescale Semiconductor I F...

Page 71: ...ion 2 3 1 PC Master Mode in terms of 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 Freescale Semiconductor I Freescale Semiconductor Inc For More Information On...

Page 72: ...the legend selects what is displayed in the remaining boxes 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 View Area Project Tree Variable Watch View Tabs Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 73: ...g 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 7 3 LIN bus Control 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 pag...

Page 74: ...s 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 and positionReq is driven by positionReqManual The actual value can be seen either in the box below the slide ...

Page 75: ... 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 Freescale Semiconductor I Freesc...

Page 76: ...sition after button click is positionReq variable of both loops forced to zero and the mode of Loop1 is set to Manual 7 4 4 Error Handling 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...

Page 77: ...ned 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 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...

Page 78: ...mePosCmd 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 7 6 Oscilloscope Figure 7 4 shows the Oscilloscope page Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www free...

Page 79: ...diately 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 Figure 7 4 Oscilloscope Page Freescale...

Page 80: ...atus enableRxStatus_Loop1 Enable receive frame AppStatus Error TxPositionError_Loop1 Error during frame PosCmd transmitting RxPosStatusError_Loop1 Error during frame PosStatus receiving RxStatusError_Loop1 Error during frame AppStatus receiving Select Axis axisTxPosition_Loop1 Target device of PosCmd frame axisRxPosStatus_Loop1 Target device of PosStatus frame axisRxStatus_Loop1 Target device of A...

Page 81: ...p1 Included in frame PosStatus data field length 8 bits analogValue analogValue_Loop1 Included in frame AppStatus data field length 8 bits AppErrFlags uAppErrFlags_Loop1 Included in frame AppStatus data field length 8 bits positionReqManual positionReqManual_Loop1 If is Mode manual sets value of positionReq variable Table 7 1 LIN bus Control Page and Variable Watch Variables Comparison Loop1 LIN b...

Page 82: ...e in milliseconds positionReq positionReq_Loop2 Included in frame PosCmd data field length 16 bits frequencyReq frequencyReq_Loop2 Included in frame PosCmd data field length 8 bits page range 0Hz 2500 Hz ClrFlag ClrFlag_Loop2 Included in frame PosCmd data field length 1 bit each AppInitFlag AppInitFlag_Loop2 PosResetFlag PosResetFlag_Loop2 LightOnFlag LightOnFlag_Loop2 positionAct positionAct_Loop...

Page 83: ...q variable Table 7 2 LIN bus Control Page and Variable Watch Variables Comparison Loop2 LIN bus Control page variable name Name of representative from Watch variable Note Table 7 3 LIN bus Control Page and Variable Watch Variables Comparison Status Notes and State Buttons LIN bus Control page variable name Name of representative from Watch variable Note Status LIN_Status Display LIN status IDLE RU...

Page 84: ...N Master Software Description Figure 7 5 Programming and Configuration Page 7 7 1 LIN Reconfiguration 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 Freescale Semiconductor I Freescale Semiconductor Inc For More Informatio...

Page 85: ...ad Parameters 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 ...

Page 86: ...click on the Send Position Correction button For uninitialized device nodeID is 255 7 7 7 Error Handling 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...

Page 87: ...ing 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 spe...

Page 88: ...gnal 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 Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 89: ...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 syste...

Page 90: ... 0 90 Conclusion MOTOROLA 908E625 device as an integrated solution which makes the slave nodes easy with a low number of components Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 91: ... 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 ...

Page 92: ...References Designer Reference Manual DRM047 Rev 0 92 References MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 93: ...0k R6 10k D6 BAV99 D6 BAV99 Q4 BSS138 Q4 BSS138 Q6 BSS138 Q6 BSS138 COMP 5 TCAP 3 VCC 6 GND 4 DC 8 PK 7 SWC 1 SWE 2 U1 MC33063A D U1 MC33063A D C23 100nF C23 100nF R2 3k6 R2 3k6 C9 10uF 10V C9 10uF 10V R3 1R R3 1R C24 100nF C24 100nF R16 10k R16 10k SW1 PUSHBUTTON 2 SM SW1 PUSHBUTTON 2 SM 10 7 6 5 4 3 2 1 9 8 J4 MICROMATCH10 FEMALE J4 MICROMATCH10 FEMALE R9 10k R9 10k JP1 JP1 C7 100nF C7 100nF C12...

Page 94: ...f Schematic Name Copyright Motorola POPI Status Author 1 0 LIN HID Lamp Actuator Motorola MCSL Roznov 1 maje 1009 756 61 Roznov p R Czech Republic Europe Custom 1 1 Monday October 06 2003 00166_03 General Business Libor Prokop 2003 D R30322_MC159VIEW MC MC159 HW 00166_03 00166_03 DSN 1 2 3 4 6 5 7 8 J4 HDR 4X2 RA J4 HDR 4X2 RA C3 100n C3 100n R2 470 R2 470 C4 100n C4 100n GC3 CON GC3 CON D1 LED_YE...

Page 95: ...t LIN distributed architectures It is especially suited to the control of automotive mirror door lock and light levelling applications 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 Freescale Semic...

Page 96: ...d SOIC package High performance M68HC08 core 16K bytes of on chip FLASH memory 512 bytes of RAM Internal clock generation module 16 bit 2 channel timet 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 ...

Page 97: ...r 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 ...

Page 98: ...ll 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 0 False 1 True l_bool_rd_PosResetFlagA1 Position Reset Flag The LIN Stepper Controller acceptor ...

Page 99: ...byte with the flags bit0 StepRun motor is stepping run bit1 StopTimeout stop timeout after stepping before setting motor block bit2 PositPark motor is actually stopped with actual position positionPark bi3 PositResetDone position reset was provided after last MCU reset bit4 AppInitDone application initializationflag 0 initialization started 1 initialization done bit5 LightOn light Hight side switc...

Page 100: ...ltage 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 0 1 0 False 1 True l_u8_wr_analogValueA1_1 NOT IMPLEMENTED any analog value like temperature DC bus voltage etc can be send out from the LIN St...

Page 101: ...nfiguration frame 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 1 Parameters Configuration Provides upload and download of the control parameters from and to paramRAM structure The paramArray variable with a dedicated signal l_u8_rd_paramArray defines ...

Page 102: ...select the frames and signals according to the defined axis The axis are described in Section 4 1 Axis and Signal Providers and Acceptors The LIN driver filters out the messages dedicated for other controlled axis The LIN reconfiguration is also described in the Section 6 1 9 Reconfig LIN Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale...

Page 103: ...Stepper Controller node is determined by the node ID see Appendix C 3 LIN Leveller Configuration Frames With the exception of the Sleep Service the node reacts only if the l_u8_rd_nodeID is equal with the defined nodeID parameter 0 0xFF 0 255 l_u8_rd_configLINAxis config Axis This signal is used only for LIN Reconfig If any node Node ID parameter l_u8_rd_nodeID and l_u8_rd_service LIN Reconfig the...

Page 104: ...lllStep full step stepper operation 1 full stepping 0 half stepping 0 1 0 False 1 True l_u8_rd_data2 the signal is interpreted according to the l_u8_rd_paramArray signal paramArray 0 currentBlockRun defines the current limitation when motor is running or stopped 0x1Y 0xZ2 0x3Y 0x4Y 0x5Y 0x6Y 0x7Y 0xZ0 0xZ1 0xZ2 0xZ3 0xZ4 0xZ5 0xZ6 0xZ7 Block current Limitation 0x0Y off no current 0x1Y no limitatio...

Page 105: ...H time instant before the motor block state after the motor stops High Byte x H 0 255 f x RESOLUTION_PERIOD_ NS x HL ns Master broad cast frmMaster Request 0x3C in case paramArray 2 PARAM_RESET_POS the data signals has the below described meaning l_u8_rd_data0 paramArray 2 positionStallL position of the low stall used for position reset see Table C 1 l_bool_rd_PosResetFlagA1 High Byte x L 0x0 0xFF...

Page 106: ...ramArray 3 positionParkH position park is used for actual position setting after MCU reset Therefore the master should set the positionReq of each Stepper Controller to this dedicated positionPark before reset and power down The Stepper Controller indicates that positionActual positionPark with PositPark flag see Table C 1 PositPark High Byte x H 0xC0 0x3F x HL 16384 16383 l_u8_rd_data2 paramArray...

Page 107: ...p 0x01 0x7F Reserved 0x80 Upload parameters S M l_u8_wr_nodeID Node ID Current LIN Stepper Controller node ID see l_u8_rd_nodeID and Appendix C 3 LIN Leveller Configuration Frames 0 0xFF 0 255 l_u8_wr_configLINAxis config Axis Current LIN Stepper Controller signal axis see l_u8_rd_configLINAxis Section 4 1 Axis and Signal Providers and Acceptors Section 6 1 9 Reconfig LIN 0x00 0x01 0x02 0x03 0x04 ...

Page 108: ...AM_RAM 0 effective address BASE_ADDR_PARAM_RAM paramAray 4 X AppConfiByte1 currentBlockRun RESERVED frequencyStart acceleration periodStopTimeoutL periodStopTimeoutH positionStallL positionStallH positionResetReqL positionResetReqH positionParkL positionParkH positionCorrectionL positionCorrectionH nodeID possible extension BASE_ADDR_PARAM_RAM 127 AppConfiByte1 currentBlockRun RESERVED frequencySt...

Page 109: ...onfiguration So there is a RAM space area up to 128 or even 256 bytes This RAM area could be loaded step by step using a configuration frame similar to the one used for parameters configuration Each configuration frame would load four data bytes in the RAM area The FLASH memory with the code could be split into areas 128 or 256 Each area could be step by step flashed after the RAM space is fully l...

Page 110: ...mes and Signals Designer Reference Manual DRM047 Rev 0 110 LIN Frames and Signals MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 111: ...stepping Frequency union Word Byte High Byte Low frequencyReq Required motor stepping Frequency HBCTL eHBCTL H Bridge Control Register in Power Die see Section 9 References 9 HBOUT eHBOUT H Bridge Output Register in Power Die see Section 9 References 9 IFR erIFR Interrupt Flag Register in Power Die see Section 9 References 9 IMR erIMR Interrupt Mask Register in Power Die see Section 9 References 9...

Page 112: ...requencyStart motor Start Minimum stepping frequency data0_3 RESERVED curentBlockRun current limitation for motor block run state uAppConfigByte1 Application Configuration Byte 1 nodeID uAppConfigByte1 RotDir24AtPosit Flag motor rotation direction at positive speed HB2 HB4 AccelEnbl Flag motor speed Acceleration Enabled FullStep Flag full step stepper operation 1 full stepping 0 half s sParameterR...

Page 113: ...pSpeedError speed was too enough when motor stopped uAppFlags1 Application status Flags 1 register See Table C 1 l_u8_wr_uAppFlags1A1_1 for details on each components StepRun motor Running flag StopTimeout motor Stop Timeout flag PositPark motor is in Parking Position PositResetDone motor Position Reset Done AppInitDone Application Init Done LightOn Light On status StallDetected Not implemented Ro...

Page 114: ... Data Variables Designer Reference Manual DRM047 Rev 0 114 LIN Stepper Software Data Variables MOTOROLA Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 115: ... where the HID lamp position is driven by a personal computer The second setup is for programming and debugging slave nodes see Figure E 2 It is also controlled by a PC Both setups incorporate the following modules HID lamp system with two slave boards Master board Personal computer Power supply 12 V 5 A the total power current is dependent on the lamp in this case it is less than 0 5 A Freescale ...

Page 116: ...16 System Setup MOTOROLA Figure E 1 LIN HID Demo Application Personal Computer 12V Power Supply Master Board Slave Board HID Lamp system Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 117: ... E 1 Slave Board Master Board Power Supply Personal Computer Table E 1 Master and Slave Boards Jumper Settings System Setup LIN HID demo application Programming and Configuration Master Board jumper header J2 Jumper to position marked as PCM click on the Reset button SW1 Jumper to position marked as D click on the Reset bottom SW1 Slave Board jumper header JP1 Short jumper pins Open jumper pins Fr...

Page 118: ...stepper E 4 1 LIN Master The application software is delivered as the master mcp project file with main C source master c and main header master h Using Metrowerks CodeWarrior for HC12 the executable file can be created The executable file is then downloaded into the MCU through the BDM multilink hardware connected to the parallel port on the PC E 4 2 LIN Stepper Slave Controller After successfull...

Page 119: ...h the support of LIN Master All the jumpers must be connected according to Table E 1 Master and Slave Boards Jumper Settings under Programming and Configuration The software can be loaded using the PEMICRO PROG08SZ Flash programmer After the programmer is started the page from Figure E 5 appears and the parameters must be set as shown NOTE The bootloader communication speed must be set to 19200 ba...

Page 120: ... according to Appendix E 2 Jumper Settings of Master and Slave Boards Run the PC Master tool on the PC via Master pmp in the lin_leveller lin_master pc_master folder Then set two present Project Options windows as shown Figure E 5 and Figure E 6 NOTE The PC master software and Internet Explorer must be installed to be able to run the Master pmp Depending on used PC serial port Freescale Semiconduc...

Page 121: ...n DRM047 Rev 0 Designer Reference Manual MOTOROLA System Setup 121 Figure E 5 Communication Page Depending on the PC serial port used Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 122: ...stem is prepared Its control is described in the User Interface Description NOTE Do not forget to click on the button RUN at the bottom right corner of the control page to start sending signals on the bus Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 123: ...Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ...

Page 124: ...ferent applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical experts Motorola does not convey any license under its patent rights nor the rights of others Motorola products are not designed intended or authorized for use as components in systems intended for surgical implant into th...

Reviews: