Home
Designer Reference Manual
Contents
1. 23 Na NANANA KA JA JA LI I if NG M68HC08 CPU POWER are wer Voltage Regulator Y Gel yop vA JA CPU AU On aO ive Switched VDD SI Reset A A EvoD H pl 2 crd C Dagse 1 Hoo kat E T Coira Status lin Petictic Waceup Ky hee i MEN pag eal CD KEV Timebase Module Y Diagnostic 1 HS PTB7AD7TBOH 4 PARADA THO D ON maga KO KY AbierMoade Half Bridge j PNN KC Driver amp C 481 SE ma a ees eae ULI a P PTB AD4 JA 8 DN 4 PTBYACS on Naa CD KO Presar Module CONTROL li ae AE PTBHADA CO Diagnostic Y AH User Flash Vector NG ab PTAOKBDO j Space KS Intemal Clock Generator 4 IG cal 36Bytes re Om T PTOOMISO MISO K pel ieee NiBa Baka A a O Ka peer PTC1MOSI MOSI mayat l O r PTA4 KBD4 S Bit Keyboard Intemupt 1 UN Single Breakpoint Break PTASISPSCK SPECK Autonomous AN Half Bridge L pa I Module NY NV Module Watchdog rn KH Driver amp B4 PTCAIOSCA H Diagnostic maso agar a Gaara YG Interface Module A KU feces Module LIN Physical KOH FO QH t
2. Name Components Description enumeration constants APP_INIT APP_RUN APP_POS_INIT eds eAppState APP_PREPARE_CONFIG Application State enumeration APP_CONFIG APP_PREPARE_SLEEP APP_SLEEP Actual motor stepping Frequency union Word frequencyActLowHigh Byte High Byte Low frequencyReq Required motor stepping Frequency H Bridge Control Register HBOTE GHBOTEL in Power Die see Section 9 References 9 H Bridge Output Register PROUT ene in Power Die see Section 9 References 9 Interrupt Flag Register IER ena in Power Die see Section 9 References 9 Interrupt Mask Register IMP MR in Power Die see Section 9 References 9 periodStep motor stepping Period positionAct Actual motor Position positionreq Required motor Position Power Output register WAG SANG aag in Power Die see Section 9 References 9 DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Stepper Software Data Variables 111 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Data Variables Table D 1 Stepper Controller Software Data Variables Continued Name Components Description RAM structure with control parameters See Table C 2 frmMasterRequest for details on each component positionCorrection Motor Position Correction motor Parking positionPark position reset position fo
3. H UM o 2500 LU positionAct Loop1 5000 7500 10000 Index Figure 8 1 Slow Fast Signal lo positionReq Loop1 a positionReqSent_Loop1 p1 Position Loo positionAct Loop1 5000 7500 10000 Time ms Figure 8 2 Low High Amplitude Signal The Figure 8 2 shows that the required position positionReq with a sinusoidal signal of small amplitude can be followed by actualPosition Designer Reference Manual DRM047 Rev 0 88 Conclusion MOTOROLA For More information On This Product Go to www freescale com DRM047 Rev 0 Freescale Semiconductor Inc Conclusion Programming and Configuration 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 o P 4 a positionReq_Loop1 kaaa a O positionAct_Loop1 E O positionReqSent_Loop1 i Loop1 N W o O oO o Tap Bpi Position Loo o 2500 5000 7500 10000 Time ms 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
4. frmPosStatusA1_2 same as frmPosStatusA1 1 A12 Mare 0x22 but the signal provider is A1_2 frmPosStatusA2 same as frmPosStatusA1 1 na Master 0x24 but the signal provider is A2 frmPosStatusA3 same as frmPosStatusA1_1 ne Master 0x26 but the signal provider is A3 DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Frames and Signals 99 For More information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Frames and Signals Table C 1 LIN Leveller Messaging Continued Signal Provi der Signal Accep tor s Axis Frame Name ID Signal Name Signal Functionality Description Raw Normalized Value Value Range Range A1_1 Master frmAppStatusA1 1 Ox1C u8 wr AppErrFlagsA1 1 Application Error Flags The LIN Stepper Controller provider sends the error byte with the flags bit0 HighTemperature Power Die over temperature bit HB OverCur H bridge overcurrent flag bit2 HighVoltage H bridge high voltage bit3 LowVoltage H bridge low voltage bit4 PowerDieError Power Die error bits 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 False 1 True u8 wr analogValueA1 1 NOT IMPLEMENTED any analog value like temperature DC bus voltage
5. MOTOROLA Hardware Description 27 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc 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 jal 5o SA ER za co Ss Mm SN ss Figure 3 2 Master Board Concept This board is protected against 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 Designer Reference Manual DRM047 Rev 0 28 Hardware Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Hardware Description Slave Board J2 Debugging J3 Motor Pe J2 LIN 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 ar
6. Hardware Schematics A 2 LIN Stepper Board Schematic 5 z 3 z i Vsup J33 ing on 21 1 c2 Tes ale D fe Jasur un 330u 35 100n u1 P S SS 4 izle e 4 a a 2 gt gt gt 5 POWER_HDR4 sab Ka L201 1 iy HB1 23 le 100p H PTER E Jono RxD HB2 HDR 6X1 54 PTA0 KBDO rH PTA KBD1 HB3 HiIl ig aa S2_ PTA2 KBD2 UDa S0 PTA3 KBD3 A9 PTA4 KBD4 Hp4 Aou 14_ PTAB SSB SSB 11 prB1 AD1 Hs PE rH PTB3 AD3 10 PTB4 AD4 7 o a PTB3 AD3 SensorAT_g ETBAADA pat aa SensorPAt ka os _ SensorA2 2 51 R6 AD6 TBCHO J4 2 RST PTBHAD7 TBCHI SensorH1 VSS A o i n1 aZ 1 60 2 pai IRA RG apoti o 4 IRON S PTC2MCLK H2 36 SensorH2 00 8 oa WD 4 P163 0802 oH R2 R1 A VSS ng as SensorH3 470 470 ola Proost a arciibop Ww HDR 4X2 RA R CON 10MIGROMATCH T A BEMF 12 34 VDD A VDD SensorA2 SensorA1 FGEN 123 EIDATACHOBEMP KVDD Gc2 VDD A A RST vop 38 _ bia VDD Je t 10 RstB_MCU HDR1 B3TE SMO3 2u2 10 vss R4 vss 42 a i 1k5 9 4 IRQB_MCU FLSEPGMN pe Vesa ROR SNOS IRQ RQ TON VDD VDD A FLBVPP g SSB
7. Freescale Semiconductor Inc Introduction LIN bus 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 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 comm
8. Go to www freescale com Freescale Semiconductor Inc User Interface Description For all Nodes nodelD is zero for uninitialized devices it is 255 7 7 5 MCU Reset Select Node via node D combo box and click on MCU Reset button For all Nodes nodelD is zero for uninitialized devices it is 255 7 7 6 Send Position Correction Set nodelD and variable positionCorrection Then click on the Send Position Correction button For uninitialized device nodelD is 255 7 7 7 Error Handling Error corresponding variable in Variable Watch configProgramError box notes can be e None communication without errors e No Response Slave is not responding wrong selected Axis or Slave is missing In case when Slave is responding this note reflects checksum error e Transmitter Issue more than one LIN device is transmitting or LIN SIO wire is shorted to the supply source wires Designer Reference Manual DRM047 Rev 0 86 User Interface Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 DRM047 Rev 0 Section 8 Conclusion 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 limitations due to mechanical
9. 0 e initializes SPI DRM047 Rev 0 62 LIN Stepper Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description LIN Stepper Software Application State Diagram e initializes LIN drivers e initializes stepIndex STEP INDEX INIT DEFAULT e initializes actual position positionAct sParameterRAM positionPark MCU_Reset ss C wou mit App Pee md conttraton Bi Done NO Position Correction Apo i a S Done CN Position Correction Done ae ee CAp App ip Wake yake up gt kA bool rd LAapinitFlag App Prepare pani Pagg raga ON PositResetDone App Position Nag Cap p Run se Reset Set Stall T oe positionAct positionResetRqValue LIN Wake up Request Lu8 rd nodelDCurent sParameterRAM nodelD KA ree jt SysMasterRequest_Download OR _bool_rd_PosResetFlag es SysMasterRequest_Store OR Ba S App Position Pa a Sleep IN SysMasterRequest LINReconfig Cg Reset TH Par et KP oe mg SysMasterRequest_Sleep J Done aa p naig bool rd CIrFlag amp o i App Prepare Forster AI App Cleat rer Sleep No Errors 2 Figure 6 6 LIN Stepper Software Application State Diagram 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 bool rd ApplnitFlag message The application performs the follow
10. 1 1 1 2 1 3 1 4 1 5 2 1 2 2 2 3 2 4 3 1 3 2 4 1 4 2 4 3 DRM047 Rev 0 Table of Contents Section 1 Introduction PEs AA AE 13 Ca ill m AEAEE RESE EA AA PP RT PAPA 14 HID Headlamp Levelling KABABA ka KG NGA KG KA EBA NG 14 E col AAP EEE TA PAA PP PAA 15 Definitions and ACISIVING c22dcieaedrcdnedcecawaup AWA 16 Section 2 System Concept System PIA a BUG ese Baka KALA E EEN 20 LIN Stepper Controller a 21 Fi AA AA APA AA 22 Personal Computer ccc eee cece eens 24 Section 3 Hardware Description Master Board 0000 ee eee 27 Slave AA AA 28 Section 4 Messaging Scheme Description Axis and Signal Providers and Acceptors 35 LIN Leveller Basic Messaging 2 2 00005 36 LIN Leveller Configuration Messaging 37 Section 5 LIN Master Software Description Designer Reference Manual MOTOROLA 5 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc 5 1 5 2 6 1 6 2 6 3 7 1 T2 7 3 7 4 z5 7 6 bat A 1 A 2 C 1 G2 Designer Reference Manual State Machine AA 39 DEN ch eh aoa ca PA AT AN a eee a 42 Section 6 LIN Stepper Software Description LIN Stepper Software Data Flow 51 LIN Stepper Software Application State Diagram 62 LIN Stepper Software Implementation 65 Section 7 User
11. B r ssp tann B VDD A Dt VREFH FOEN v 471 VODA FGEN Hi 8 evop BEME x BEMF H a LED_YELL 54 100nVss A T weet ise La VSS 45 evss No 22 20 NG 2t _ p1 22 oO 1RQ IN krg o o 2IRQ RG ha PM908E625ACDWB HDR 2X1 PTY Motorola MCSL Roznov MOTOROLA P A 3 1 maje 1009 A sca 756 61 Roznov p R Czech Republic Europe LIN HID Lamp Actuator Author Libor Prokop Size Schematic Name 00166 03 Rev Custontpesign File Name nisas22 motsememwcwcisorvecotss0900168 03 5 10 Modify Date Monday October 06 2003 Sheet 1 o T Copyright Motorola 2003 POPI Status General Business 5 4 3 2 Kk Figure A 2 LIN Enhanced Stepper Board Schematic Designer Reference Manual DRM047 Rev 0 94 Hardware Schematics For More Information On This Product Go to www freescale com MOTOROLA Freescale Semiconductor Inc Designer Reference Manual DRM047 Appendix B 908E625 Advantages and Features This general purpose IC from Motorola has been developed as a highly integrated and cost effective solution for load driving within intelligent LIN distributed architectures It is especially suited to the control of automotive mirror door lock and light levelling applications
12. Configuration 61 6 6 LIN Stepper Software Application State Diagram 63 7 1 PC Master Software Main Page 72 7 2 LIN bus Control PANG irda circa eludes APA GAGA ces 75 Ta Pecore Page essorer ogee A 78 7 4 Oscilloscope Page cc cide we ge cede hese DA DENG LAKEKG PAA 79 7 5 Programming and Configuration Page 84 8 1 IOW FaSt NA KAKA RR KAKA nerta ie iIa ve bens 88 8 2 Low High Amplitude Signal 000005 88 Designer Reference Manual MOTOROLA 9 For More Information On This Product Go to www freescale com Designer Reference Manual Freescale Semiconductor Inc 8 3 A 1 A 2 B 1 C 1 E 2 E 3 E 4 E 5 E 6 MOCO Signal sa ssa masaa a een ster aa aata E 89 LIN Master Board Schematic nannaa anaana 93 LIN Enhanced Stepper Board Schematic 94 908E625 Simplified Block Diagram 95 Configuration Parameters Addressing 108 LIN HID Demo Application 6 waa caveur thie eC i eae ee es 116 Programming and Debugging Application Detail 117 Metrowerks Compiler with lin_stepper mcp 119 Bootloader Setting AA AMA AA 120 Communication Pagg 22cccceeedacsssenenedaceece 121 Variables Source Pade os waw PAP hacec daca GB seas AL 122 DRM047 Rev 0 10 MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Desig
13. Targets Debugger Project File Cj Debugger Cmd Files Zooo Per CG Startup Code CG Libs Am 2 M S08FY16_FLASH C E 308FY16_FLASH h 2 amp 3 Cairon M cairon adc h M cairon_io h B Sources E parameters c F parameters h M chip sets h M vector c 36 files 3 Oe Oe Oe Oe 3 Oe ae Oe Jo Oe Oe Oe Oe Oe Oe 2R oa Ricco ag aag kag aga aaa NG Figure E 3 Metrowerks Compiler with lin stepper mcp DRM047 Rev 0 Designer Reference Manual MOTOROLA System Setup 119 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Setup Attempting to contact target and pass security Target Hardware Type Class IV Direct serial to target w MONOD8 serial port circuitry and additional auto reset circuit built in Advanced Class 1 IL IIL IV Settings Depending on used PC serial port The serial port is closed Target MCU Security bytes C Attempt ALL Known security codes in order C Attempt FF FF FF FF FF FF FF FF From security ini C Attempt FF FF FF FF FF FF FF FF Blank Device C Attempt FF FF FF FF FF FF FF FF From security ini Attempt FF FF FF FF FF FF FF FF From security ini Recent Attempt 00 00 00 00 00 00 00 00 Blank on older devices C Attempt FF FF FF FF FF FF FF FF From security ini C User 00 00 00 00 00 00 00 00 Load from 519 C Attempt FF FF FF FF FF FF FF
14. etc can be send out from the LIN Stepper Controller provider A12 Master frmAppStatusA1 2 Ox1D same as frmAppStatusA1 1 but the signal provider is A1 2 A2 Master frmAppStatusA2 Ox1E same as frmAppStatusA1 1 but the signal provider is A2 A3 Master frmAppStatusA3 Ox1F same as frmAppStatusA1 1 but the signal provider is A3 C 2 Node ID The controlled axis specifies the relation to the LIN basic messages each LIN Stepper Controller node relation to LIN messaging is specified by two parameters the configured axis exclusive Node ID The Node ID is used for configuration The LIN Master Request and Slave Response Frames Command frames used for configuration are broadcast frames each slave node acts upon them We must Designer Reference Manual DRM047 Rev 0 100 LIN Frames and Signals For More Information On This Product Go to www freescale com MOTOROLA Freescale Semiconductor Inc LIN Frames and Signals LIN Leveller Configuration Frames distinguish the nodes when using Appendix C 3 LIN Leveller Configuration Frames NOTE The default node ID settings of the LIN Stepper software reflect the configured axis so Axis3 has node ID 4 Axis2 has node ID 3 Axis1_2 has node ID 2 Axis1_1 has node ID 1 However both the configuration axis and the node ID can be independently changed in the software or during configuration The
15. ireduencyReg gt gt frequencyActLonbigh Byte Hi Dr gh sil Yes frequencyActLowHigh periodStep acceleration Y positionDecelDistance v positionDecelAfterRamp No DECEL_AFTERRAMP_RESERVE _Y Aequi Reg lt frequencyActLowHigh Byte Hi gt Nom ne o a Bi Yes v frequencyActLowHigh frequencyReq Return N frequency Start frequencyActLowHigh Frequency N i Deceleration frequencyActLowHigh acceleration positionDecelDistance IN frequencyActLowHigh periodStep acceleration UU equencyStart gt frequencyActLowHigh Ka AD gh G pe Yes v frequencyActLowHigh frequencyStart No aaa limited to 0 4 v positionDecelDistance limited to 0 Pa O N Return Figure 6 4 Frequency Acceleration and Deceleration Flow Chart Designer Reference Manual DRM047 Rev 0 58 LIN Stepper Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description LIN Stepper Software Data Flow The frequency acceleration subroutine provides the actual frequency frequencyActLowHigh ramp with the maximum frequency limit at frequencyReg If the actual frequency is lower than the required the new actual frequency is calculated from the last a
16. is comprised of four main boxes DRM047 Rev 0 Designer Reference Manual MOTOROLA User Interface Description 71 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description Project Tree View Area EE Master pmp PCMaster H A x File Edit View Explorer Item Prof ct Help slalom a Ha elelee ea trol ME Configuration and Oscilloscope Designed By 488 Recorder Motorola Czech System Laboratories Roznov p Radl algorithm block description Nam Period a IN Status RUN ENUM 0 LIN_SleepWakeReq Wake ENUM 5000 enableTxPosition Loop1 Yes ENUM 5000 axisTxPosition Loop1 Axisl 1 Axisl 2 ENUM 5000 TxPositionError Loop1 None ENUM 1000 Done PSQ32 COM2 speed 115200 V View Tabs Variable Watch Figure 7 1 PC Master Software Main Page 7 2 1 Project Tree Clicking the mouse on 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 Designer Reference Manual DRM047 Rev 0 72 User Interface Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description LIN bus Control 7 2 3 View Tabs The View tabs select what is displayed in the View area 7 2 4 View Area
17. positionAct_Loop2 on o p2 a 0 Position Loo 339250 339500 339750 340000 Time ms algorithm block description oscilloscope RS232 COM2 speed 115200 Scope Running 7 Figure 7 4 Oscilloscope Page DRM047 Rev 0 Designer Reference Manual MOTOROLA User Interface Description 79 For More Information On This Product Go to www freescale com 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 e Loop1 Table 7 1 e Loop2 Table 7 2 e Status notes and State buttons Table 7 3 Table 7 1 LIN bus Control Page and Variable Watch Variables Comparison Loop1 LIN bus Control page variable Name of representative from name Watch variable Note Send enableTxPosition_Loop1 Enable transmit frame PosCmd enableRxPosStatus_Loop1 Enable receive frame PosStatus Receive enableRxStatus_Loop1 Enable receive frame AppStatus TxPositionError_Loop1 Error duning Heme road transmitting Error RxPosStatusError Loop1 Error during mame eesotails receiving RxStatusError Loop1 Error during frame AppStatus receiving axisTxPosition Loop1 Target device of PosCmd frame Select Axis axisRxPosStatus Loop1 Target device of PosStatus frame
18. 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 6 1 7 Timer Motor Step Designer Reference Manual The Timer Motor Step sets the timer for the The Motor Stepping Control and Motor Position and Speed Control processes DRM047 Rev 0 60 LIN Stepper Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description LIN Stepper Software Data Flow LIN Messages HE u8 rd configLINAxis u8 rd service u8 rd paramArray u8 rd nodelDCurrent u8 rd dataX sParameterROM Slave App Control Position Sensing positionAct Reconfig LIN eAppState sParameterRAM Figure 6 5 LIN Stepper Software Data Flow 2 Configuration 6 1 8 Config Param The process includes the functions necessary for parameter configuration The functions are e parameter transfer from FLASH ROM to parameter RAM e parameter upload from parameters RAM to LIN u8 wr dataX signals according to u8 rd paramArray e parameters download from l u8 rd dataX signals to parameter RAM according to u8 rd paramArray e FLASH programming parameters from RAM to FLASH ROM DRM047 Rev 0 Designer Re
19. the connector J3 pin 6 can be used for the light on off control 0 0 HS OFF 1 1 HS ON frmPosCmdA2 same as frmPosCmdA1 Master ne 0x23 but the acceptor is A2 frmPosCmdA3 same as frmPosCmdA1 Master Ag 0x25 but the acceptor is A3 Actual absolute Position The LIN u16 wr positionActA1 1 Stepper Controller provider sends the actual position of the position counter lt 0xC000 lt 16384 Ox3FFF gt 16383 gt f x RESOLU Actual Frequency The LIN Stepper X TION_FR u8 wr frequencyActA1 1 Controller provider sends the lt 0x00 EQUENC actual motor stepping frequency OxFF gt Y_HZ x Hz 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 u8 wr uAppFlags1A1 1 bit4 AppInitDone application initializationflag 0 initialization started 1 initialization done bit5 LightOn light Hight side switch on the connector J3 pin 6 set to on bit6 StallDetected NOT IMPLEMENTED stall detected bit7RotDirSign motor rotation direction signature 1 actual position decremented 0 actual position incrementing frmPosStatusA1_1 A11 Master 0x21 0 0 False 1 1 True
20. 1 o zi Ox3D config Axis Current LIN Stepper 0x00 0x01 A1 2 z3 Controller signal axis 0x01 5S 7 a i 0x02 A2 h 3 see u8 rd configLINAxis 0x02 _u8_wr_configLINAxis g A i 0x03 A3 Section 4 1 Axis and Signal 0x03 lt 0x04 Providers and Acceptors lt 0x04 OxFF gt Reserved Section 6 1 9 Reconfig LIN OxFF gt _u8_wr_paramArray Lu8 rd paramArray of the 0 PARAMS CONFIG initiated frmMasterRequest 0x00 the following data signals 0x01 1 PARAM SPEED _u8_wr_paramArray ie eee oxo2 2 PARAM RESET POS maa 3PARAM PARK POSITIO space defined by that 0x03 N u8 rd paramArray according the Figure C 1 same as frmMasterRequest but na u8 wr dataX frmMasterRequest u8 rd dataX data upload rere seel u8 rd data0 AU a Mi NOTE the normalized value range is determined by scaling factor DRM047 Rev 0 The scaling constants RESOLUTION FREQUENCY HZ and RESOLUTION PERIOD NS are defined and can be changed in the LIN Stepper software header files The parameters configuration uses addressing of the parameters according to Figure C 1 There are four data signals in the Master Designer Reference Manual MOTOROLA LIN Frames and Signals For More Information On This Product Go to www freescale com 107 Freescale Semiconductor Inc LIN Frames and Signals Request and Slave response frames The parameters space of these data signals is addressed the parameters RAM according to paramArray point
21. 83 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description e MCU Reset reset MCU e Send Position Correction set new position All variables included in the parameters array are described in Section 5 LIN Master Software Description service sleep Gt nodelD lo ConfigLINAxis Axis 1_1 LIN Reconfig paramArray PARAMS_CONFIG nodelD fo frequencyStart 0 positionStall positionPark coc UAppConfiByte1 bo acceleration jf positionResetReq b positionCorrection fo currentBlockRun oa periodStopTimeout 0 data0 3 jo Error None UPLOAD DOWNLOAD MCU Reset RecvData Ok positionCorrection jo Send Position Correction STORE 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 Designer Reference Manual DRM047 Rev 0 84 User Interface Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description Programming and Configuration 7 7 2 Upload Parameters Steps are as follows 1 Select nodelD node identity for an uninitialized device by the nodelD item in parameters array the nodelD
22. Control Page 7 4 2 Control Loop2 The setting is the same as for Control Loop1 except e If there are communication requests of both loops at the same time Loop1 always has the main priority This means that a request from Loop2 is shifted until the request of Loop1 is satisfied That is why there is a delay between two following satisfied communication requests from Loop2 measured and displayed via periodeSend The periodeSendReq box is used to set the desired time periods between two communication events of Loop2 DRM047 Rev 0 Designer Reference Manual MOTOROLA User Interface Description 75 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description FramePosCmd 16 bit data source positionReg 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 7 4 4 Error Handling Status displays current status of LIN communication and can be dle LIN is activated but communication is not started Run communication is running Sleep LIN bus is in Sleep state 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 i
23. FF From security ini J IGNORE security failure and enter monitor mode Status Invalid Response or No Response to last attempt to contact target 0 ICS Hardware loopback detected N 4 Device entered monitor mode N 1 Device echoed some security bytes N Port 5 Reset was Power On Reset Help 2 Device echoed all security bytes N 6 ROM is accesible un secured 3 Device signaled monitor mode with a break N T Show this dialog before attempting to contact the target 68HC08 board Contact target with these settings Halt Figure E 4 Bootloader Setting E 5 Executing the LIN HID Demo Application The LIN HID demo application is prepared for operation when connected according to Figure E 1 in Appendix E 1 Hardware Setup with jumpers setting 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 Designer Reference Manual DRM047 Rev 0 120 System Setup MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Setup Executing the LIN HID Demo Application x Comm MAP Files Pack Dir HTML Pages Demo Mode Communication MCE
24. Frames and Signals Possible Software Extension Programming via LIN The resident constant software segment cannot be reprogrammed Since the LIN bus communication and some control features are necessary for the software download The re programmable software segment could be reprogrammed using the same principle as the parameters configuration 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 loaded This way any size of re programmable software segment in FLASH memory can be programmed DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Frames and Signals 109 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Frames and Signals Designer Reference Manual DRM047 Rev 0 110 LIN Frames and Signals MOTOROLA For More Information On This Product Go to www freescale com Designer Reference Manual DRM047 Freescale Semiconductor Inc Appendix D LIN Stepper Software Data Variables Table D 1 describes the LIN Stepper Controller data variables Table D 1 Stepper Controller Software Data Variables
25. Information On This Product Go to www freescale com Freescale Semiconductor Inc Hardware Description Slave Board 5 a 8 3 5 EER 2 Pa 5 a br a 5 5 p 5 5 8 s5 9 go O 22PER Eaj 4 2 ee 5 5 MCU 908EY1 202020 2020 01010303 0 0 0 COp Di M68HC08 CPU POWER vss TEN Voltage Regulator paga O vo CH cpu Au Power On Reset j rg Module Es xa 75 5 cara K Bro 3 1 NG KU I I i VEDA H LZ Coir astus j a vie OO pakasa ON KD Bican Y 4 Ha m Timebase Module PTB7AD7T6cH1 I I User Flash AN UN A ti r PTBS ADSTBCHO Oa 15 872 Bytes V KI ber Module ik I prewans H Y 4 N KON Seed Pera moe H 512 Bytes Yy Interface Module SPI Ar CONTROL PTESYAD On Montoro LN LUN sere PTa OH Al User Flash vedor a JIL PTAOKBDO Space D KD Intemal Clock Generator SPI NG I 36Bytes PTAKI O Y ot PTCOMISO MISO Paak FLASH programing LUN Lan computer
26. Interface Description Janina NG is kbd eee eed edb eae dee eae 71 PC Master Software General Overview 71 Al LB AA APA AA PA AA 73 eee on oy Pea ee AA AA 73 P AR dh eh hone eae eke E AA AA 77 Ce a oa ca RA RE a ee ERER 78 Programming and Configuration 000006 83 Section 8 Conclusion Section 9 References Appendix A Hardware Schematics LIN Master Board Schematic 44 0220 wawa ma NGA WG 93 LIN Stepper Board Schematic a 94 Appendix B 908E625 Advantages and Features Appendix C LIN Frames and Signals LIN Leveller Basic Frames 0 00 00 naana anaana 97 adlaw bad so a heed PR PPO LA OKs Kee eae as 100 DRM047 Rev 0 6 MOTOROLA For More Information On This Product Go to www freescale com DRM047 Rev 0 Freescale Semiconductor Inc C 3 C 4 E E 2 E 3 E 4 E 5 LIN Leveller Configuration Frames 101 Possible Software Extension Programming via LIN 108 Appendix D LIN Stepper Software Data Variables Appendix E System Setup Hardware Setup an BKA aaae 115 Jumper Settings of Master and Slave Boards 117 Required Software Tools AA 118 Building and Uploading the Application 118 Executing the LIN HID Demo Application 120 Designer Reference Manual MOTOROLA 7 For More Information On This Product Go to www freescale com Freescale
27. Over Temperature Status Bit HB_OverCur HB_OCF H Bridge Over Current Flag Bit HighVoltage HVF H Bridge High Voltage Bit uAppErrFlags LowVoltage LVF H Bridge Low Voltage Bit PowerDieError Power Die error LINTxRxError NOT IMPLEMENTED SICurrLim serial input current limitation StopSpeedError speed was too enough when motor stopped Application status Flags 1 register See Table C 1 u8 wr uAppFlags1A1 1 for details on each components StepRun motor Running flag StopTimeout motor Stop Timeout flag PositPark motor is in Parking Position uAppFlags1 PositResetDone motor Position Reset Done ApplnitDone Application Init Done LightOn Light On status StallDetected Not implemented RotDirSign motor rotation direction signature Motor stepping Control Flags uMotStepControlFlags wanti RotDir24 rotation direction HB2 gt HB4 timeMotStep Motor Controller Time DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Stepper Software Data Variables 113 For More information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Data Variables Designer Reference Manual DRM047 Rev 0 114 LIN Stepper Software Data Variables MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 Appendix E System Setup E 1 Hardware Setup The hardware setup depends on desired functionality of the whole system There are tw
28. Seg Gleeettor Remote Server DCOM Save settings to project file JV Save settings to registry use it as default r Communication state on startup and onfproject load Open port at startup C Do not open port at startup Store port state on exit apply it gn startup T Store state to project file applyfupon its load Advanced Depending on the PC serial port used Figure E 5 Communication Page DRM047 Rev 0 Designer Reference Manual MOTOROLA System Setup 121 For More information On This Product Go to www freescale com Freescale Semiconductor Inc System Setup Comm MAP Files Pack Dir HTML Pages Demo Mode Default symbol file bin master abs T File format Binary ELF with D WARF1 or DWARF2 dbg format Edit Del Litofalvaid MEE E New symbol files New Note The file selected in the list will be used as default symbol file when the project is opened On Load IT Let the user select starting symbol file lv Synchronize variables each time the symbol file loads Iv List errors variables using undefined symbols Always Except after project load Apply Cancel Figure E 6 Variables Source page Now the system 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
29. Semiconductor Inc Designer Reference Manual DRM047 Rev 0 8 MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 DRM047 Rev 0 List of Figures Figure Title Page 1 1 System Concept paa na KKK ARA cade sede ses ese LLANA 13 mo ME CI KELAN APA AA 20 2 2 PC Master Software Principle 000 eee ee 25 Tl NAGA PA RD BKEKKP a iraid PSP EYA 27 3 2 Master Board Concept assas aaae aeee 28 3 3 LIN Stepper Slave Board Aa aba eves de ce wdavauceees 29 3 4 LIN Stepper Controller Slave Board Schematic 30 3 5 908E625 Blocks Usage snus weceiedindedawad ada we WAWA 31 5 1 Software State Diagram 2 s 4208 che bewelecisagaeeess 41 5 2 PC Master Mode Data Flow Chart Part1 44 5 3 PC Master Mode Data Flow Chart Part2 46 5 4 Master Mode Data Flow Chart 20000005 47 5 5 Debug Mode Data Flow Chart 000000 eee 49 5 6 Pass Mode Data Flow Chart 00000000ee 50 6 1 LIN Stepper Software Data Flow1 53 6 2 Motor Position and Speed Control Service Updated Requests 6 a oi KA eke cede tatawneee ae sees 56 6 3 Motor Position and Speed Control Service Updated Actual Position 0 0 00 2402404 5446 edend en ceaw s 57 6 4 Frequency Acceleration and Deceleration Flow Chart 58 6 5 LIN Stepper Software Data Flow 2
30. Shows one of following items e HTML Control page LIN bus Control page or Programming and Configuration page e Oscilloscope page e 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 7 3 LIN bus Control The pages dedicated to LIN slave control are see Project Tree e Slave control LIN bus control page e Oscilloscope real time variables watching e Recorder recorded variables watching 7 4 Slave Control Via this HTML page Figure 7 2 it is possible to fully control up to two LIN Stepper Controllers The page comprises three main areas Control Loop1 Control Loop2 and an area containing Status notes and State buttons on a yellow background DRM047 Rev 0 Designer Reference Manual MOTOROLA User Interface Description 73 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description 7 4 1 Control Loop1 The steps for setting this page are as follows 1 ChoseLIN frames see Section 5 LIN Master Software Description for communication via checking of Send or Receive boxes 2 Select Axis LIN Stepper Controller
31. Sleep Application prepares for sleep In case the motor is spinning it is decelerated and stopped This is provided in order not to lose position by going to sleep Designer Reference Manual DRM047 Rev 0 64 LIN Stepper Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description LIN Stepper Software Implementation 6 2 7 App Prepare Sleep 6 2 8 App Wake Up 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 6 2 9 App Configuration 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 6 3 1 Scaling of Quantities DRM047 Rev 0 The LIN Leveller application uses signed 16 bit type SWord16 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 Designer Reference Manual MOTOROLA L
32. axisRxStatus Loop1 Target device of AppStatus frame periodeSendMin periodeSendMin Loop1 Calculated period range lt 0 2555 value in milliseconds Real period periodeSend periodeSend Loop1 range lt 0 2555 value in milliseconds Mode modeAutMan Loop1 Select Manual or Automatic mode Curve autCurveSelect Loop1 Select one predefined curve Send autSendOnesStill_Loop1 Send curve Ones or Still Designer Reference Manual DRM047 Rev 0 80 User Interface Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description Oscilloscope Table 7 1 LIN bus Control Page and Variable Watch Variables Comparison Loop1 Note Shift pointer in selected Curve to begin Included in frame PosCmd data field length 16 bits Included in frame PosCmd data field length 8 bits page range lt OHz 2500 Hz gt Included in frame PosCmd data field length 1 bit each Included in frame PosStatus data field length 16 bits Included in frame PosStatus data field length 8 bits Included in frame PosStatus data field length 8 bits Included in frame AppStatus data field length 8 bits Included in frame AppStatus data field length 8 bits LIN bus Control page variable Name of representative from name Watch variable Reset autReset_Loop1 position
33. bus Control page variable Name of representative from Note name Watch variable Included in frame AppStatus analogValue analogValue_Loop2 data field length 8 bits Included in frame AppStatus AppErrFlags uAppErrFlags_Loop2 data field length 8 bits positionReqManual positionReqManual_Loop2 Value for positionReg variable Table 7 3 LIN bus Control Page and Variable Watch Variables Comparison Status Notes and State Buttons LIN bus Control page variable Name of representative from Note name Watch variable Display LIN status Status LIN Status IDLE RUN SLEEP Error Created as OR function of all error messages in HTML page code Change current LIN Status Sleep Wake up LIN_SleepWakeReq Sleep Wake up Change current LIN Status Run Stop LIN RunStopReq Run Stop Park Position Park Sets lamp system to initial position Note Frames are not Display relationship between real synchronized with periodeSend synchMode Loop and desired communication timing 7 7 Programming and Configuration 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 e LIN Reconfiguration assign Axis number e Upload Parameters read parameters e Download Parameters write parameters e Store Parameters store parameters to program MCU memory DRM047 Rev 0 Designer Reference Manual MOTOROLA User Interface Description
34. com Freescale Semiconductor Inc LIN Master Software Description y UploadParam DownloadParam TIN Status StoreParam MCUReset SynchMode_Loop1 LINReconfig SendPositionCorrection No LIN_SleepWakeReq TIN_RunStopReq _ LOOP 1 TIMER Interrupt eo T LOOP2_TIMER Interrupt Yes l a y Ya a pee a Pe enableLoop2 lave Sleep Wake up Loop1 Loop2 Programming and priority selector Nous Configuration 4 enableTxPosition_Loop1 ENG enableRxPosStatus_Loop1 a paramArray enableRxStatus Loop1 nodeID uAppConfiBytel Y data0_3 periodeSendMin Loopl currentBlockRun periodeSend Loop1 frequencyStart YY acceleration a aaa periodStopTimeout modeAutMan Loop1 iti o es a mmm P ARR ao CA autCurveSelect positionReqManual Loop1 autReset Loop1 Sh _ gt a configProgramError positionReq Loop1 y Ba FieldO fPositions Loop1 requencyReq Loop Send and Receive ctrlFlag Loop1I LIN messages positionReqSent_Loop1 positionAct Loop1 a lt frequencyAct_Loop1 TxPositionError_Loop1 uAppFlags Loop1 RxPosStatusError_Loop1 uAppErrFlags Loop1 RxStatusError_Loop1 analogValue_Loop1 Figure 5 2 PC Master Mode Data Flow Chart Part1 Designer Reference Manual DRM047 Rev 0 44 LIN Master Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Master Software Description Data Flow 5 2 4 Loop1 Loop2 Send and Receiv
35. 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 e Personal Computer e LIN Master LIN master node e LIN Stepper Controller LIN slave node Each module is programmed with dedicated software DRM047 Rev 0 Designer Reference Manual MOTOROLA System Concept 19 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Concept 2 1 System Features Designer Reference Manual LIN physical N HC12 CPU RS232 mem Application Control GUI pc master s w Master HC12 S W LIN Stepper Slave HC08 S W LIN Master Board PM908E625 LIN bus LIN Stepper Controller Stepper Stepper Axis 3 Program JDO Debugging i Stepper Interface i Axis1 1 as Head LampR Head Lamp L Stepper 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 accelerati
36. disclaims any and all liability including without limitation consequential or incidental damages Typical parameters which may be provided in Motorola data sheets and or specifications can and do vary in different applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical experts 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 the body or other applications intended to support or sustain life or for any other application in which the failure of the Motorola product could create a situation where personal injury or death may occur Should Buyer purchase or use Motorola products for any such unintended or unauthorized application Buyer shall indemnify and hold Motorola and its officers employees subsidiaries affiliates and distributors harmless against all claims costs damages and expenses and reasonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that Motorola was negligent regarding the design or manufacture of the part MOTOROLA Motorola and the Stylized M Logo are registered in the U S Patent and Trademark Office digita
37. is 255 2 Inthe paramArray combo box set which parameters are to be 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 3 Click on the UPLOAD button 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 7 7 3 Download Parameters For this choice 1 Select nodelD node identification for an uninitialized device by the nodelD item in parameters array the nodelDis 255 2 Inthe 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 nodelD and click on the STORE button All parameters are stored in the Node program memory DRM047 Rev 0 Designer Reference Manual MOTOROLA User Interface Description 85 For More Information On This Product
38. mode the functions dedicated to Loop1 Timing and Send and Receive LIN messages are successfully applied These are used in PC master mode Designer Reference Manual DRM047 Rev 0 46 LIN Master Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Master Software Description Data Flow 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 5 2 9 Error Handling See Section 5 2 5 Error Handling periodeMasterMode 3 Tai a4 LOOP1 TIMER Interrupt FieldOfPositions Loop1 Send and ae requencyReq_Loop ctrlFlag Loop1 ges LIN messages positionAct_Loop1 a s positionReqSent_Loop1 frequencyAct_Loop1 TxPositionError_Loop1 uAppFlags Loop1 RxPosStatusError_Loop1 uAppErrFlags Loop1 RxStatusError_Loop1 analogValue Loop1 Figure 5 4 Master Mode Data Flow Chart DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Master Software Description 47 For More Information On This Product Go to www fr
39. parts The bus communication system LIN bus should not be the limitation for the system dynamic 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 e start speed 200rpm e max speed frequencyReq 700rpm e 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 Designer Reference Manual MOTOROLA Conclusion 87 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Conclusion 100 75 positionReq Loop1 positionReqSent_Loop1 p1 N a a o Position Loo 2 N a on o 754 100
40. see Table C 1 _bool_rd_PosResetFlagA1 Low Byte x L lt 0xCO Ox3F gt x HL lt 16384 16383 gt Master broad cast frmMaster Request Ox3C in case paramArray 3 PARAM PARK POSITION the data signals has the below described meaning u8 rd data0 paramArray 3 positionParkL 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 Low Byte x L lt 0x0 OxFF gt X HL lt 16384 16383 gt u8 rd data1 paramArray 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 lt 0xCO Ox3F gt X HL lt 16384 16383 gt u8 rd data2 paramArray 3 positionCorrectionL the relative position Correction is used to correct the actual position by sending this signals Low Byte x L lt 0x00 OxFF gt X HL lt 16384 16383 gt u8 rd data3 paramArray 3 positionCorrecti
41. speeds up to 20 kBaud RS232 Exchange data PTS LIN Figure 5 6 Pass Mode Data Flow Chart Designer Reference Manual DRM047 Rev 0 50 LIN Master Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 Section 6 LIN Stepper Software Description LIN Stepper Software is described in terms of e LIN Stepper Software Data Flow e LIN Stepper Software Application State Diagram e Flow Charts e 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 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 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 als
42. 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 frequencyRegq 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 Period EQ 19 Frequency For software execution optimized calculation we wrote a special arithmetic function UWord16 udiv16_8to16 UWord16 x UByte y with UWord16 output and UWord16 x UByte y inputs It is written in assembler and provides the following calculation UWord16 Variable UWord16 Variable EQ 20 UByte Variable3 The conversion must take into account the variables scaling Resolution Period UWord16 periodStep Poe ae ee er ee eee ee ee EQ 21 Resolution Frequency UByte8 Frequency UWord16 periodStep UWord16 Resolution Frequency ResolutionPeriod EQ 22 UByte8 Frequency So the final calculation using the udiv16 8to16 function is UWord16 periodStep UWord16 CONVERSION_CONST_PERIOD_FERQ EQ 23 UByte8 frequencyActLowHigh Byte High where Resolution Period s is RESOLUTION_PERIOD_NS 1000000000 0 DRM047 Rev 0 Designer Reference Manual MOTORO
43. 3 The periodeSendMin box displays the automatically calculated 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 4 All LIN frames data are displayed in the Frame Data box In FramePosCmd it is necessary to choose the source for positionReg 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 bar or in the positionReg 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 There are four predefined curves and one special choice called SQUARE Designer Reference Manual DRM047 Rev 0 74 User Interface Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description Slave Control Control Loop 1 Control Loop 2 F Enable Frame PosCmd Frame PosStatus Frame AppStatus Frame PosCmd Frame PosStatus Frame AppStatus ly Se
44. AD4 7 PTBSJAD3 ah 9 PIBJADI nsorAT 6 39 OTs PTATKBDT ensorAZ 7 PTBS ADS pai 39 4 OC REDO 5 PTB6 AD6 TBCHO Otg RsT O 4 PTB7 AD7 TBCH1 37 OSs kaka is ae 4 RON oi o H PTC2IMCLK H2 8 oF O PTC3 0SC2 35 o i PICHOST 3 H3 Ho o PTC4 OSC1 CON 10 PATCH BEMF 42 PTDO TACHOIBEMF Hvop 4 GC2 VDD A NPP A N DD PTD1 TACH1 38 ON RST 10 NOD C5 VDD 17777 RSTB MCU RSTB_SMOS 40 2u2 10 vss R4 9 VSS t 1k5 IRQB_MCU FLSEPGMN sci VSS A IRQ RQ si iRaB_smos 18 RO BON p amme VDD VDD A Gi Paver 19 SSB yop A 48 VREFH aa D1 FGEN v 4T VDDA Feen H 4 EVDD 16 BEMF BEMF LED YELL c4 43 VSSA VREFL AnS AJO H 44 vssa ne Heo EVSS NC Hr O JPA 22 NC O aa 1IRQ_IN T 5 o oara Ra o HDR 2X1 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 3 2 1 MCU and Power Die with SPI MCU 908EY16 chip and Power Die chip Cairone forms the 908E625 device in one package These two chips are connected with SPI signals and some other signals So the control of the Power Die like Half bridges control is provided with SPI communication The SPI communication pins MISC MOS SPCLK are connected inside of the 908E625 package see Section 9 References 9 Designer Reference Manual DRM047 Rev 0 30 Hardware Description MOTOROLA For More
45. EQ12 13 Resolution Petiod Timer Prescaller Division EQ 12 Bus Frequency ResolutionPeriod defines the time of Real Step Period periodStep Resolution Period EQ 13 6 3 3 Acceleration Scaling and Arithmetic Operations NOTE Designer Reference Manual Some of the arithmetic operations used in the LIN Stepper software impact the calling A good example is umul_16x8_macro UWord16 Variablel UByte Variable2 EQ 14 256 i UWord16 Variable3 which is used for acceleration ramp calculation Frequency Difference SteppingPeriod Acceleration EQ 15 And EQ15 can be rewritten to EQ 16 Resolution Frequency UWord16 frequencyDif Resolution Period UWord16 periodStep Resolution Acceleration acceleratior if we use the umul 16x8 macro UWord16 Frequency Dif Nr Oper ep a eye Acceleration EQ 17 Then according to EQ16 EQ17 the Resolution Acceleration is EQ 18 RESOLUTION_FREQUENCY_LOW_HIGH RESOLUTION_ACCEL_DECEL_S_S2 L e U 256 0 RESOLUTION_PERIOD_NS 1000000000 0 The actual frequency variable frequencyActLowHigh is represented as an union Then for the acceleration calculations it can be accessed as DRM047 Rev 0 68 LIN Stepper Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description LIN Stepper Software Implementation UWord16
46. Freescale Semiconductor Inc alo oye Q MOTOROLA digital dna intelligence everywhere LIN bus HID Lamp Levelling Stepper Motor Control Using Motorola 908E625 Reference Design Designer Reference M68H C08 Manual Microcontrollers DRM047 Rev O 12 2003 MOTOROLA COM SEMICONDUCTORS For More Information On This Product o to www freescale com Freescale Semiconductor Inc For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN bus HID Lamp Levelling Stepper Motor Control Using Motorola 908E625 Reference Design Designer Reference Manual Rev 0 by Libor Prokop Petr Cholasta MCSL Rosnov e Motorola and the Motorola logo are registered trademarks of Motorola Inc e Metrowerks and the Metrowerks logo are registered trademarks of Metrowerks Inc a wholly owned subsidiary of Motorola Inc e CodeWarrior is a registered trademark of Metrowerks Inc a wholly owned subsidiary of Motorola Inc e Microsoft is a registered trademark of Microsoft Corporation in the U S and other countries DRM047 Rev 0 Designer Reference Manual MOTOROLA 1 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 Rev 0 2 MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047
47. IN Stepper Software Description 65 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description The following equation shows the relationship between system raw value range and real physical or normalized range representation UWord16 Value MAX_U16 Serer eg Tats Te EQ 1 SWord16 Value MAX_S16 AG EQ 2 UByte Value MAX U8 1 ONG EQ 3 SByte Value MAX S8 1 a EQ 4 where UWord16 Value is the unsigned 16 bit system representation of the real value SWord16 Value is the signed 16 bit system representation of the real value UWord8 Value is the unsigned 8 bit system representation of the real value SWord8 Value is the signed 8 bit system representation of the real value Real Value is the real value of the quantity V A RPM etc Real Quantity Range Max is the maximum of the quantity range defined in the application V A RPM etc MAX_U16 65535 is the maximum of the unsigned 16 bit variable MAX_S16 32768 is the maximum of the signed 16 bit variable MAX_U8 255 is the maximum of the unsigned 8 bit variable MAX_S8 127 is the maximum of the signed 8 bit variable Designer Reference Manual DRM047 Rev 0 66 LIN Stepper Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description LIN Stepper Software Impl
48. LA LIN Stepper Software Description 69 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description Resolution Frequency Hz is RESOLUTION FREQUENCY HZ CONVERSION_CONST_PERIOD_FREQ 1000000000 0 RESOLUTION_FREQUENCY_HZ RESOLUTION_PE RIOD_NS 6 3 5 LIN Stepper Software Memory Utilization Designer Reference Manual 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 Used by Memory Software Important Sections Size Parameter ROM 16B FLASH ROM 4039 Bytes LIN Reconfig ROM 128B Stack 64B RAM 278 Bytes LIN Reconfig RAM 96B Parameter RAM 16B DRM047 Rev 0 70 LIN Stepper Software Description For More Information On This Product Go to www freescale com MOTOROLA Freescale Semiconductor Inc Designer Reference Manual DRM047 Section 7 User Interface Description 7A Introduction This section describes the Control pages used for LIN bus control see Section 2 3 1 PC Master Mode in terms of e PC master software general overview e 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 itis possible to see whole PC master software page which
49. Operating TY Pai NU NY Property Module PTASKBDe Bites PTCAMOS Mos yl PTA4KBD4 C JA 5 Bit Keyboard Interupt N Single Breakpoint Break PTASSPSCK SPSCK Autonomous jan ma Module Vi Ko Module Watchdog N7 K Prosci H I I i prace O achamelTiner VN ku Ermahccd Sara Y G Interface Module KY No Oea a LIN Physical Promak PTEJTSD XD NA Layer PTABKBDE NI channel Timer N AN System Integration LI N bus YG hierace Module 5 K Ko Module Fisvep pi Analog lA LN y Analogto Digital Pwy 4 SeouriyMode KO G annie Do ADOUT Multiplexer N Figure 3 5 908E625 Blocks Usage 3 2 2 LIN bus 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 PTO 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 DRM047 Rev 0 Designer Reference Manual MOTOROLA Hardware Description 31 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Hard
50. PTEOTXD XD er aie Ek M ma O Gaara KK mare D Xa FLSVPP H nal seariyweate KIN CN AabgtoDka PTAA DOUT Pa A KA Analog Fort HO pat B source 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 HCO8 MCU chip with SCI SPI internal oscillator and FLASH memory plus a Power DRM047 Rev 0 Designer Reference Manual MOTOROLA 908E625 Advantages and Features 95 For More Information On This Product Go to www freescale com 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 e Multi chip combination within a 54 lead SOIC package e High performance M68HC08 core e 16K bytes of on chip FLASH memory e 512 bytes of RAM e Internal clock generation module e 16 bit 2 channel timet e 10 bit analog to digital converter ADC e LIN physical layer interface e Three 2 pin Hall sensor inputs e One analog input with switchable current source e Four low resistive half bridge outputs with current limitation e One low resistive high side output e 14 microcontroller I Os Designer Reference Manual DRM047 Rev 0 96 908E625 Advantages and Features MOTOROLA For More Information On This Product Go to www freescal
51. Req positionReq_Loop1 frequencyReq frequencyReq_Loop1 ClrFlag ClrFlag_Loop1 ApplnitFlag ApplnitFlag Loop1 PosResetFlag PosResetFlag Loop1 LightOnFlag LightOnFlag Loop1 positionAct positionAct Loop1 frequencyAct frequencyAct Loop1 AppFlags uAppFlags_Loop1 analogValue analogValue_Loop1 AppErrFlags uAppErrFlags Loop1 positionReqManual positionReqManual_Loop1 If is Mode manual sets value of positionReq 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 Send enableTxPosition_Loop2 Enable transmit frame PosCmd Receive enableRxPosStatus_Loop2 Enable receive frame PosStatus enableRxStatus_Loop2 Enable receive frame AppStatus DRM047 Rev 0 Designer Reference Manual MOTOROLA User Interface Description 81 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description Table 7 2 LIN bus Control Page and Variable Watch Variables Comparison Loop2 LIN bus Control page variable Name of representative from Note name Watch variable Error during frame PosCmd TxPositionError_Loop2 pia transmitting Error during frame PosStatus Error RxPosStatusError Loop2 ire receiving RxStatusError Loop2 Error during frame AppStatus receiving axisTxPosition Loop2 Tar
52. 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 Designer Reference Manual MOTOROLA LIN Stepper Software Description 59 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description 6 1 4 Position Sensing NOTE 6 1 5 LIN Driver 6 1 6 SPI Driver 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 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 defined position is used the current software could be adapted simply by changing of the Position Sensing process LIN drivers provide all the processes for the LIN bus protocol which handles the transmitting receiving of LIN frames The application
53. TXCANA 98 7 A GND NG liq napag E R5 Rie c13 a KWHOPHO St 220 l 1w one 19 0608MHz KWHZIPH2 9 Ten COC voo l F 2 kore ukaout cra XTAL KWHAPHA 3 RON 100r sa UN VDDA KWH6 PHO Ria cis ote xwariPar 82 yi Pa Bao TOOS vor VRH pKarpixo 8 x al 5 VRE BKIK pl bi PK2PIX2 amp a tad 4 7 vREGEN PKPS PB on 8 t PP t a2 RESETA Bkapna 20 ha PREPDS nao 2821 Papiganis BD PADIAJANTA PK7IECSn H08 8 BADISIANIS g rag NAA BADIAN KWI Fi IR PADIGAN O m 5 10 PADOS ANO9 vop1 42 cre H 28 PADOBANOB yoo2 957 ro 2 Max2o2EcsE 5 5 H PUSHBUTTON 215M Pr pabasa Monk 5 o CANNONG FEMALE 1 23 MODCITAGHINBKGD vss H4 k k ozs nil ore 43 Ves pond 7 gt 100nF 645 1 4 VDDPLL VSSX VSSR po VSSA HEADER3X2 g VSSPLL J 4 Ga x c24 C20 C25 c21 c22 ToonF p p 400nF 10uF 6 3V 100nF 10uF 6 3V 1001F l Mm ai H oss 12DP256 ae AA MOTOROLA 1 maje 1009 mat nazmar T36 61 Roznov p R Czech Republic Europe c28 Tie 10nF nF R8232 LIN Interface JE al L Aunar Per Coast oe Size Schematic Name 00177_01 Rev 5k6 B Design File Name om crane usrano penn moen 91 Modify Date Tuesday August 26 2003 Sheet 1 of aq Copyright Motorola 2001 POPI Status 7 General Business z z T z 7 T 7 DRM047 Rev 0 Figure A 1 LIN Master Board Schematic Designer Reference Manual MOTOROLA Hardware Schematics For More Information On This Product Go to www freescale com 93 Freescale Semiconductor Inc
54. Z5 0xZ3 60MA OxZ6 0xZ4 250mA OxZ7 0xZ5 350MA 0xZ6 500mA 0xZ7 700mA the signal is interpreted according to LU8 rd data3 the u8 rd paramArray signal Designer Reference Manual DRM047 Rev 0 104 LIN Frames and Signals For More Information On This Product Go to www freescale com MOTOROLA Freescale Semiconductor Inc LIN Frames and Signals LIN Leveller Configuration Frames Table C 2 LIN Leveller Configuration Frames Continued Signal Signal Frame Raw Provi tor s Name Signal Name Signal Functionality Description Value Normalized Value Range der Axi ID Range xis in case paramArray 1 PARAM SPEED the data signals has the below described meaning the signal is interpreted according to the u8 rd paramArray signal aaa x fa FREQUENCY _u8_rd_dataO AJ 0 255 RESOLUTION HZ x is the minimum frequency of the N Hz motor The motor starts stepping and ramps down to this frequency before stop paramArray 1 ag f x frmMaster acceleration Ng RESOLUTION ACCEL Master pakain Request Lu8_rd_data1 is motor speed acceleration and aa DECEL_S_S2 x Ox3C deceleration ramp constant steps s paramArray 1 f x periodStopTimeoutL x L T u8 rd data2 time instant before the motor block lt 0 255 RESOLUTION PERIOD NS x HL state after the motor stops gt Ins Low Byte paramArray 1 f x periodStopTimeoutH x H g u8 rd data3 time instant
55. al 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 recognized The corresponding subroutine is initialized In that routine the program is running until reset or power die event The modes were described in Section 2 3 LIN Master DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Master Software Description 39 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Master Software Description 5 1 3 PC Master Mode Initialization The actions are following e Turn on LIN supply voltage e Initialize SCI1 and PC master software driver e Initialize LIN driver including initialization of SCIO and ECT channelo0 e 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 e Set all program flow control and state variables Designer Reference Manual DRM047 Rev 0 40 LIN Master Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Master Software Description State Machine Reset my Timer Channel 3 Interrupt ta Pass Mode AN Selection PC master Run 4
56. art 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 positonReg 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 Designer Reference Manual MOTOROLA User Interface Description 77 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description E Master pmp PCMaster 10 x File Edit View Recorder Item Project Help E8 Slave control mA Configuration and Programming Oscilloscope 4 Recorder Done 7 6 Oscilloscope Designer Reference Manual H O E Hale esel HA f0 Alesi tis el 6975 020 09 760 Eng positionReq Loop1 positionRegSent Loop1 es positionAct Loop1 p1 Position Loo 5000 7500 10000 Time ms Recorder is idle IF Auto stop Autorun f algorithm block description recorder R5232 COM2 speed 115200 Rec Idle Zz Figure 7 3 Recorder Page By comparing 1 and 2 it is possible to watch the dela
57. before the motor block lt 0 255 RESOLUTION PERIOD NS x HL state after the motor stops gt Ins High Byte in case paramArray 2 PARAM_RESET_POS the data signals has the below described meaning paramArray 2 positionStallL vie u8 rd data0 position of the low stall used for O x HL metas position reset see Table C 1 OxEF gt lt 16384 16383 gt bool rd PosResetFlagA1 High Byte frmM paramArray 2 Master broad kiya positionStallH HE cast position of the low stall used for nae X HL 0x3C _u8_rd_datat position reset see Table C 1 ne lt 16384 16383 gt bool rd PosResetFlagA1 High Byte paramArray 2 positionResetRqValueL xL position reset value is used for AT x HL _u8_rd_data2 position reset see Table C 1 ped lt 16384 16383 gt _bool_rd_PosResetFlagA1 Low Byte DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Frames and Signals For More Information On This Product Go to www freescale com 105 Freescale Semiconductor Inc LIN Frames and Signals Table C 2 LIN Leveller Configuration Frames Continued Signal Provi der Signal Accep tor s Axis Frame Name ID Signal Name Signal Functionality Description Raw Value Range Normalized Value Range Master broad cast frmMaster Request Ox3C u8 rd data3 paramArray 2 positionResetRqValueH position reset value is used for position reset
58. bus Designer Reference Manual DRM047 Rev 0 122 System Setup MOTOROLA For More information On This Product Go to www freescale com Freescale Semiconductor Inc For More Information On This Product Go to www freescale com Freescale Semiconductor Inc HOW TO REACH US USA EUROPE LOCATIONS NOT LISTED Motorola Literature Distribution P O Box 5405 Denver Colorado 80217 1 303 675 2140 or 1 800 441 2447 JAPAN Motorola Japan Ltd SPS Technical Information Center 3 20 1 Minami Azabu Minato ku Tokyo 106 8573 Japan 81 3 3440 3569 ASIA PACIFIC Motorola Semiconductors H K Ltd Silicon Harbour Centre 2 Dai King Street Tai Po Industrial Estate Tai Po N T Hong Kong 852 26668334 TECHNICAL INFORMATION CENTER 1 800 521 6274 HOME PAGE http motorola com semiconductors Information in this document is provided solely to enable system and software implementers to use Motorola products There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document Motorola reserves the right to make changes without further notice to any products herein Motorola makes no warranty representation or guarantee regarding the suitability of its products for any particular purpose nor does Motorola assume any liability arising out of the application or use of any product or circuit and specifically
59. col 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 Designer Reference Manual 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 Enhanced Serial Communication Interface DSP Digital Signal Processor ECT Enhanced Capture Timer HID Lamp High Intensity Density headlamp LIN Leveller the system described in this reference design It consists of the LIN master and LIN stepper controllers LIN bus a local interface network standard for serial asynchronous communication see Section 9 References 2 DRM047 Rev 0 16 Introduction MOTOROLA For More Information On This Product Go to www freescale com DRM047 Rev 0 Freescale Semiconductor Inc LIN Master LIN Master Software LIN SIO Wire LIN Stepper Controller LIN Stepper Software LIN Stepper Board LIN Enhanced Stepper Board LIN Master Board MCU PCB Power Die SCI signal provider Introduction Definitions and Acronyms master board with LIN master software the LIN bus master software for stepper motors control and communication LIN bus signal Serial Input Output wire LIN bus slave board with General Purpose IC 908E625 wit
60. ctual 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 frequencyReq 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 itis 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 6 1 3 Motor Stepping Control DRM047 Rev 0 The process controls the motor stepping It prepares the erHBOUT variable and using the
61. d Signals 2 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 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 Designer Reference Manual DRM047 Rev 0 102 LIN Frames and Signals MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Frames and Signals LIN Leveller Configuration Frames Table C 2 LIN Leveller Configuration Frames Signal Signal Frame Raw Provi p Name Signal Name Signal Functionality Description Value Normalized Value Range tor s der Axis ID Range i gi 0x00 Sleep Service Byte Specifies the Master 0x00 lt 0x01 Ox7E gt Reserved Request Frame service The Pak F lt 0x01 0x80 Upload parameters application uses this Command 6 Ox7F gt S gt M Frame user defined service as pe 0x80 prior frmSlaveResponse l_u8_rd_service specified in Section 9 References 2 0x81 0x81 Download 0x82 parameters M gt S e eee 083 Cit Store FLASH aaa aa oes 0x63 MEU Deser 0x84 LIN Reconfig Node ID Configuration of Each LIN Stepper Controller node is determined by the node ID see Appendix C 3 LIN Leveller lt 0 u8 rd nod
62. e IR 7V2 power Jack o 111 o MON apa oH Mosizpwsiwpsipps PAZIADIO 100uF 8 3 1 te ur a tavieamax Jo makan M ST SsipwaKwpapes PAsaDtTMOD 1 SE Spe MaD ce le a 8 3 MOSITPWIKWPTIPE1 PASIADI4 TMOD2 l ng i rap High OFF JPS o 4 100uF 6 3V 4 Ngh ore rod MISOIPWOKWPOTPPO PATIAD S L ba 12 10C7 PT7 PADO7 ANO7 Mess ters aF 4 ON JUMPER PINS ARE SHORT CIRCUIT Zig ocete PADOS ANDG Lan a OFF JUMPER PINS ARENT SHORT CIRCUIT 181 10carers PADOS ANOS al PE014012 I2 100373 PADOG ANDS DEN tions es Marang un sue H At locap12 PADOZIANO2 sav tom ma H 40 octeni PADOTIAND A 4 Pass 2 at di 10C0 PTO PADOO ANOO 4 piss ma 5 pe mica 8 91 porn Panisso 8 19217 MASTER 100nF or xl a iD PeeiaDs pseiscko 35 Rrs z 5V 100nF D5 la pa BS 28 Pasiaps PSBIMOSIO kai ad a a d g 1281 pea aDa PS SDUMISOO 1H a PB3 AD3 PS1 TXD0 HID us Br PB3IADS PSHUTEDO Foe Rao MBRS140TS 7AHCTIGI25GW e PEZIAD2 PSOIRXDO 83 tok 24 pg0 aDo PS2 RXD1 21 S ria s 5 Riz 9v co 3m id 3 a 2 PETIXCLKSNNOACC PMORXBIRXCANO 195 lt ma me Wake gt vec GND PESMODB IPIPE1 PM1 TXB TXCANO 104 s0 se PES MODAIIPIPEO PMZIRXCAN 103 maaan tee eee 8 inn un amp 4_____ slo 4 Tt pm 28 PEAECLK PNarxGani 192 J pa R PESILSTRENTAGLOn PMARXCANZ 101 lt As 4 T PE2RWn PMS TXCAN2 190 LK Soop nieces PEWRan PMBRXCANS PEB Dara Ww PEO XIROn PM7 TXCAN3 82 DATA _ as j vcc our EXTAL Pusikwusisparexcans 22 Beets ha R PUTIKWJTISCLI
63. e LIN Messages 5 2 5 Error Handling DRM047 Rev 0 Replaces function that provides see Section 5 LIN Master Software Description e Send frmPosCmd e Receive frmPosStatus and frmAppStatus All variables surrounding this bubble are described in Section 7 3 LIN bus Control 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 Designer Reference Manual MOTOROLA LIN Master Software Description 45 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Master Software Description Loop2 Control enableTxPosition_Loop2 enableRxPosStatus_Loop2 enableRxStatus_Loop2 periodeSendMin Loop2 periodeSendReq Loop2 Loop2 Send and Receive LIN messages positionReqManual_Loop2 lt frequencyReq Loop2 ctrIFlag Loop2 periodeSend Loop2 positionReq Loop2 positionReqSent Loop2 positionAct Loop2 TxPositionError Loop2 frequencyAct Loop2 RxPosStatusError Loop2 uAppFlags Loop2 RxStatusError Loop2 uAppErrFlags Loop2 analogValue Loop2 Figure 5 3 PC Master Mode Data Flow Chart Part2 5 2 6 Master Mode Program Flow Provides actions described in Section 2 3 2 Master Mode From Figure 5 4 it can be seen that in this
64. e com 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 NOTE NOTE DRM047 Rev 0 Figure C 1 describes the LIN Leveller signals and frames 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 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 fo
65. e 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 lt has some additional sensor inputs This could be used for some applications with a Hall sensor or analog signal feedback The LIN Stepper Controller does not use any sensor feedback The schematics of the LIN Stepper Board s displayed in Figure 3 4 It uses the LIN Enhanced Stepper Board PCB layout but some components are not populated DRM047 Rev 0 Designer Reference Manual MOTOROLA Hardware Description 29 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Hardware Description lt D d 33 i 1 fe 2 As EE re J1 c2 c3 JN os 31G fe o n 330u 35 100n u1 a 4 NG Hee 28 2 5 ee 9 POWER_HDR4 abo ef 20 LN m1 H 6 100p 42 Fy PTEVRxD 26 ee OND RxD HB2 7 54 23 1 PTA0 KBDO 29 27 PTA1 KBD1 HB3 i gt 0 357 PTA2 KBD2 aY 0 99 PTA3 KBD3 ab 0 57 PTA4 KBD4 HB4 O PTAB SSB SSB 2 StH pretian1 Hs 28 to _PTB4
66. ed 7 DATA Bidirectional TxD signal is held in low level RxD and TxD signals are held in TTL levels 8 MON1 Output High impedance state el p 9 p Set by JP1 on Master Board Designer Reference Manual DRM047 Rev 0 48 LIN Master Software Description For More Information On This Product Go to www freescale com MOTOROLA Freescale Semiconductor Inc LIN Master Software Description Data Flow Table 5 1 Debug Line Output Master Board signals Pin number Pin name Pin type Hi DTR Low level DIR E Debugging and programming S OV 9 MON2 Output High impedance state Set by JP2 on Master Board 10 MON3 Output High impedance state tar Set by JP3 on Master Board Debug mode functionality was successfully tested at frequencies up to 20 kHz on the DATA pin MONs RS232 LIN PTP PTS Debug Programming Control PTH PTA PTM Debug line Figure 5 5 Debug Mode Data Flow Chart 5 2 12 Pass Mode Program Flow Is based on an endless software loop that copies the RxD signal RS232 to the LIN SIO wire and then copies the LIN SIO wire signal back to TxD RS232 see Figure 5 6 Functionality of the Exchange DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Master Software Description 49 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Master Software Description data procedure was successfully tested with data
67. ed if LIN bus protocol is implemented in the personal computer 2 4 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 computer and embedded applications based on an MCU or DSP The principle of the PC master software is shown in Figure 2 2 Designer Reference Manual DRM047 Rev 0 24 System Concept MOTOROLA For More Information On This Product Go to www freescale com NOTE DRM047 Rev 0 Freescale Semiconductor Inc System Concept Personal Computer Personal Computer LIN Master API ee Sees transferred LIN Master variables any LIN Master variables sai 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 read
68. eescale com Freescale Semiconductor Inc 5 2 10 Debug Mode Program Flow LIN Master Software Description 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 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 Table 5 1 Debug Line Output Master Board signals Pin number Pin name Pin type DTR High level DTR Low level Reset Debugging and programming 1 CLOCK Output High impedance state 19 6608MHz clock 2 GND Power Ground Ground Connected to ground discharging capacitors of Open collector output 3 MDD Output Slave Board gt push supply transistor is turned off voltage line to OV IRQIN low level gt OV IRQIN low level gt OV Gi MRQOUT Cue IRQIN high level gt 5V IRQIN high level gt 9V 5 IRQIN Input 5V pull up 5V pull up Input 6 RSTB not used OV pull down OV pull down Communication is open
69. elD Configuration Frames OxFF gt lt 0 255 gt With the exception of the Sleep Service the node reacts only if the u8 rd nodelD is equal with the frmMaster defined nodelD parameter broad Master t Request gas Ox3C config Axis This signal is used only for LIN Reconfig 0x00 A1_1 If any node 0x00 0x01 A1 2 Node ID parameter u8 rd nodelD 0x01 F h 0x02 A2 6 and _u8_rd_service LIN Reconfig 0x02 u8 rd configLINAxis a 0x03 A3 the node is reconfigured to the defined 0x03 lt 0x04 axis 0X0 OxFF gt Reserved see Section 6 1 9 Reconfig LIN OxFF gt and Section 4 1 Axis and Signal Providers and Acceptors If any node Node ID parameter _u8_rd_nodelD and _u8_rd_service Download 0x00 0 PARAMS_CONFIG respectively 0x01 1 PARAM_SPEED u8 rd paramArray and u8 rd service upload 0x02 2 PARAM_RESET_POS the following data signals 0x03 3PARAM_PARK_POSITIO u8 rd datax addresses the space N defined by u8 rd paramArray as shown in Figure C 1 DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Frames and Signals 103 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Frames and Signals Table C 2 LIN Leveller Configuration Frames Continued paramArray 0 data0 3 RESERVED Signal Signal Frame Raw Provi p Name Signal Name Signal Functionality Description Value Normali
70. ementation From the above equations for the Real Value Real Value UWord16 Value Real Quantity Range Max EQ 5 MAX_U16 1 Real Value SWord16 Value Real Quantity Range Max EQ 6 MAX_S16 1 Real Value UByte Value Real Quantity Range Max EQ 7 MAX_U8 1 i Real Value SByte Value Real Quantity Range Max EQ 8 MAXSU8 1 According to the variable type the equations EQ1 to EQ8 also can be converted to the EQ9 and EQ11 System Variable X Real Value X__ EQ 9 Resolution Quantity X where Resolution Quantity X Real Quantity X Range Max EQ 10 MAX Type Variable X where System Variable X is the system variable Real Value X is the physical value of the quantity represented by Variable X Resolution Quantity X resolution of the system variable X in real It represents the physical value represented by LSB bit of the Variable X 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 Real Value X Resolution Quantity X System Variable X EQ 11 DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Stepper Software Description 67 For More information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description 6 3 2 Scaling of Time Scaling of time variables is according to
71. er paramRAM paramROM BASE_ADDR_PARAM_RAM 0 nodelD nodelD AppConfiByte1 AppConfiByte1 u8 rd A currentBlockRun currentBlockRun uo ro paramaray RESERVED MCU RESERVED frequencyStart Reset frequencyStart acceleration acceleration periodStopTimeoutL periodStopTimeoutL effective address periodStopTimeoutH periodStopTimeoutH BASE_ADDR_PARAM_RAM positionStallL positionStallL paramAray 4 X positionStallH positionStallH positionResetReqL positionResetReqL positionResetReqH positionResetReqH u8 rd data0 positionParkL Store positionParkL u8 rd data1 positionParkH FLASH positionParkH u8 rd data2 positionCorrectionL y _PositionCorrectionL u8 rd data3 positionCorrectionH positionCorrectionH possible extension possible extension BASE ADDR PARAM RAM1127 Figure C 1 Configuration Parameters Addressing C 4 Possible Software Extension Programming via LIN The principle of the parameters configuration could be possibly enhanced via LIN bus software programming The software FLASH memory could be split into two segments e resident software segment with LIN driver e re programmable software segment Designer Reference Manual DRM047 Rev 0 108 LIN Frames and Signals MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN
72. er does not use any sensors Therefore the connector J4 is not displayed in Figure 3 4 However the LIN Enhanced Stepper Board Figure A 2 was designed for possible use of Hall sensors or analog signals There is a place for connector J4 resistors R2 R1 Table 3 3 Connector J4 Signals Pin No Input Output Signal range 1 GND VSS_A GND 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 o a ee a DRM047 Rev 0 34 Hardware Description For More information On This Product Go to www freescale com MOTOROLA 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 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 Aii A12 A2 A3 The signal provider and acceptor is determined by the preprogrammed axis A special meaning is given to
73. ference Manual MOTOROLA LIN Stepper Software Description 61 For More Information On This Product Go to www freescale com 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 e Initializes the LIN reconfiguration RAM buffer fLINReconfigBufRAM e Presets the LIN reconfiguration RAM buffer according to u8 rd configLINAxis message e 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 6 2 1 MCU Init Designer Reference Manual Figure 6 6 shows the application states After an MCU reset the MCU Initialization states provide the initialization of all processes In this state the application provides all system module initialization after reset e sets CONFIG register e sets clock module to 4 9152 MHz bus frequency e copies configuration parameters from FLASH memory sParameterRAM sParameterROM e initializes uAppFlags1 Byte 0 uAppErrFlags Byte
74. ge HID headlamp levelling system which controls the stepper motors in the lamp module to compensate for the motion of the 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 Figure 1 1 System Concept Designer Reference Manual MOTOROLA Introduction 13 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Introduction 1 2 Summary 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 ca
75. get device of PosCmd frame Select Axis axisRxPosStatus Loop2 Target device of PosStatus frame axisRxStatus Loop2 Target device of AppStatus frame Calculated period periodeSendMin periodeSendMin Loop2 range lt 0 2555 value in milliseconds Desired period periodeSendReq periodeSendReq Loop2 range lt 0 2555 value in milliseconds Real period periodeSend periodeSend Loop2 range lt 0 2555 value in milliseconds Included in frame PosCmd data positionReq positionReq Loop2 field length 16 bits Included in frame PosCmd frequencyReq frequencyReq Loop2 data field length 8 bits page range lt OHz 2500 Hz gt ClrFlag ClrFlag_Loop2 AppinitFlag AppinitFlag Loop2 Included in frame PosCmd PosResetFlag PosResetFlag Loop2 data field lengih 1 bit each LightOnFlag LightOnFlag Loop2 Ag Na Included in frame PosStatus positionAct positionAct Loop2 data field length 16 bits Included in frame PosStatus frequencyAct frequencyAct Loop2 data field length 8 bits Included in frame PosStatus AppFlage vAppF lags haope data field length 8 bits Designer Reference Manual DRM047 Rev 0 82 User Interface Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description Programming and Configuration Table 7 2 LIN bus Control Page and Variable Watch Variables Comparison Loop2 LIN
76. h LIN Stepper software the LIN bus slave stepper motor control software for 908E625 described in this AN slave stepper board hardware for LIN slave stepper controller The PCB layout is same as LIN Enhanced Stepper Board Some parts are not populated slave stepper board hardware for LIN Master with sensor connector and other components master board hardware for LIN Master microcomputer unit printed circuit board part of 908E625 with H bridges LIN physical layer high side switch connected to the MCU part with SPI interface In some references the Power Die chip is called Cairone Serial Communication Interface module outside Motorola called also UART the device which send the slave task of the bus signal Designer Reference Manual Introduction 17 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Introduction Designer Reference Manual DRM047 Rev 0 18 Introduction MOTOROLA For More information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 Section 2 System Concept 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
77. ing e initializes timers DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Stepper Software Description 63 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description e clears system errors e 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 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 positionReg sParameterRAM positionResetRqValue So the positionReq is not set according to the _u16_rd_positionReq This state is used with the App Position Reset Set Stall for position initialization 6 2 5 App Position Reset Set Stall Provides setting positionAct sParameterRAM positionStall and so provides the actual position reset 6 2 6 App Prepare
78. ing or modification The user can simply specify which of them will be read modified and the period of each variable reading 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 Designer Reference Manual MOTOROLA System Concept 25 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Concept Designer Reference Manual 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 DRM047 Rev 0 26 System Concept MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 Section 3 Hardware Description 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 depending on position of the jumper on the MODE SELECTION header currently PCM gt PC master mode After each change of mode the RESET button must be pressed Figure 3 1 Master Board DRM047 Rev 0 Designer Reference Manual
79. ion Ss _ decelDistance _ lt DECEL_RESERVE No DECEL RESERVE gt lt positionDif_ lt positionDif_ Yes Yes frequencyReq gt gt frequencyReq gt lt No gp Ni frequencyActLowHigh 7 7 frequencyActLowHigh oe Yes Yes y v y v frequencyActLowHig frequencyActLowHigh frequencyActLowHig frequencyActLowHig Frequency Frequency Frequency Frequency Acceleration Deceleration Deceleration Acceleration a N gt ja NT v periodStep 1 frequencyAct y timeMotStep periodStep v Return Figure 6 3 Motor Position and Speed Control Service Updated Actual Position DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Stepper Software Description 57 For More Information On This Product Go to www freescale com 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 lt 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 frequencyActLowHigh Frequency N Acceleration frequencyActLowHigh acceleration positionDecelDistance Na frequencyReq WA
80. l dna is a trademark of Motorola Inc All other product or service names are the property of their respective owners Motorola Inc is an Equal Opportunity Affirmative Action Employer Motorola Inc 2003 DRM047 For More Information On This Product Go to www freescale com
81. lDistance is incremented during speed acceleration The actual and required position difference is compared with the positionDecelDistance with the DECEL_RESERVE to find the point where the speed deceleration ramp must start down to frequencyStart DECEL_RESERVE DECEL_AFTERRAMP_RESERVE 2 DECEL_NUMERICAL_RESERVE where DECEL_RESERVE overall deceleration ramp reserve steps DECEL_AFTERRAMP_RESERVE number of steps with starting frequency after deceleration ramp steps 2 reserve for following acceleration requires1 acceleration step and 1 deceleration step steps DECEL_NUMERICAL_RESERVE deceleration reserve to cover the difference between acceleration and deceleration ramps caused by numerical rounding steps Service of the Updated Requests is shown in Figure 6 2 It provides the necessary Position and Speed control functionality when the position request value is updated by LIN message DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Stepper Software Description 55 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description Updated Requests SS i l lt StepRun StopTimeout lt r No Y positionDif positionReq positionAct pa a Yes jositionDif 0 No Yes v Step Start Bs Return Figure 6 2 Motor Position and Speed Control Service U
82. levelling control with a very competitive system cost thanks to e LIN bus communication protocol which is a cost effective bus system based on standard SCI UART communication and Designer Reference Manual MOTOROLA Conclusion 89 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Conclusion e 908E625 device as an integrated solution which makes the slave nodes easy with a low number of components Designer Reference Manual DRM047 Rev 0 90 Conclusion MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 Section 9 References 1 PC Master Software User Manual 2 LIN Specification Package Revision 1 2 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 Ge
83. lly loading the master software as described in the previous section configure the system as shown in Figure E 2 and described in Section E 1 Hardware Setup The application software is delivered as the lin stepper mcp project file with C source and header files in the sub folder lin_stepper Using Metrowerks CodeWarrior the executable S19 file lin stepper sx can be DRM047 Rev 0 118 System Setup MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Freescale Semiconductor Inc System Setup Building and Uploading the Application created in the folder lin_leveller lin_stepper bin Prior to the compile the target must be set according to required the axis see Figure E 3 This sets the LIN signal drivers to receive the required signals The executable file is then downloaded into the MCU from the PC with 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 PROGO8SZ 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 baud Metrowerks CodeWarrior File Edit View Search Project Debug Processor Expert Window Help Bes EocxRBAARESTHRIATE DE CE OY SS gt Files Link Order
84. mmunication time The Loop2 timer ECT channel2 output 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 DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Master Software Description 43 For More Information On This Product Go to www freescale
85. mode N PC master a na 3 ug Recorder S a PR Exchange data between RS232 and LIN N Reload k variables request a Programming and Run request Configuration request o ti Control LIN communication according to change of variables by means of PC master PC master SE Exchange data between RS232 and Debug line Send Sleep Wake up LIN frames Wait for Periode timing interrupt Periode ti Send Receive interrupts C Send Receive Programming and LIN C LIN frames Configuration frames Wait for Periode timing interrupts Figure 5 1 Software State Diagram 5 1 4 Master Mode Initialize Performs e Turn on LIN supply voltage e Initialize LIN driver including initialization of SCIO and ECT channelo0 e Set up ECT channel1 Loop1 timing as an output compare e Enable ECT channel1 output compare interrupt e Set all program flow control and state variables DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Master Software Description 41 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Master Software Description 5 1 5 Debug Mode Initialization Sets e MONs according to pin states on Port P see Figure 3 1 e All program flow control and state variables 5 1 6 Pass Mode Initialization e Turns on LIN supply voltage 5 2 Data Flow Four possible modes of the Ma
86. n 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 1 3 HID Headlamp Levelling Designer Reference Manual 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 DRM047 Rev 0 14 Introduction MOTOROLA For More Information On This Product Go to www freescale com 1 4 LIN bus DRM047 Rev 0
87. nd V Receive V Receive ly Send V Receive V Receive Error None Error None Error None Error None Error None Error None Select Axis Select Axis Periode Periode periodeSendMin ms 15 periodeSendMin ms 15 periodeSend ms 30 37 Frames are synchronized with periodeSend periodeSendReq ms po periodeSend ms 20 Frame Data positionReq jo positionAct Jo analogValue 0x00 Frame Data frequencyReg Hz 770 frequencyAct pi AppErrFlags positionReq fo positionAct O analogvalue 0x00 ClrFlag E Hz HighTemperature frequencyReq mo frequencyAct pa AppErrFlags ApplnitFlag I AppFlags C HB_OverCur Hz Hz C HighTemperature PosResetFlag C StepRun E pecs CirFlag AppFlags HB_OverCur LightOnFlag FF StopTimeout a ApplnitFlag T Steprun HighVoltage PositPark PowerDieError p fp C StopTimeout C LowVoltage i LINTxRxError osResetFlag F PowsxDiEE C PositResetDone 5 LightOnFlag T PositPark owerDieError AppInitDone C sicurrLim nA C PositResetDone LINTxRxError Lighton StopSpeederror AppiritDone C SICurrLim C StallDetected C LightOn C StopSpeedError C RotDirSign ELN AA po RotDirSign The period of the curve look up table read out is identical with the period of the signals sending periodSend Display Graphical Recorder SLEEP STOP Park Position Figure 7 2 LIN bus
88. ner Reference Manual DRM047 DRM047 Rev 0 Table 3 1 3 2 3 3 6 1 7 1 7 2 7 3 C 1 C 2 D 1 E 1 List of Tables Title Page Connector J2 Signals 66k ieasdede ends cide GRAB donee 32 Connecior JS Signa ac ace re op heh Soe ee deen tee ee gaee 33 Connector JA Signals CA 34 Debug Line Output oo co ce PSA eRe Ce GAGA ke Rae alee 48 Stepper Controller Software Memory Utilization 70 LIN bus Control Page and Variable Watch Variables Comparison Loop ites GNG APAPAP 80 LIN bus Control Page and Variable Watch Variables Comparison L00p2 bn cia eeeh 2rd PARAAN 81 LIN bus Control Page and Variable Watch Variables Comparison Status Notes and State Buttons 83 LIN Leveller Messaging icc c deca ei ce sce ee sewed ewes 98 LIN Leveller Configuration Frames 103 Stepper Controller Software Data Variables 111 Master and Slave Boards Jumper Settings 117 Designer Reference Manual MOTOROLA 11 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 Rev 0 12 MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 1 1 Overview DRM047 Rev 0 Section 1 Introduction This reference design describes the development of a LIN based High Intensity Dischar
89. neral Purpose IC 908E625ACDWB D 10 MC68HC908EY16 Data Sheet MC68HC908EY16 D 11 LIN Physical Interface MC33399 12 16 bit MCU MC9S12DP256B DRM047 Rev 0 Designer Reference Manual MOTOROLA References 91 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc References Designer Reference Manual DRM047 Rev 0 92 References MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 Appendix A Hardware Schematics A 1 LIN Master Board Schematic z z I z z 7 Di MBRSt40TS u w2 10H 100uH I 2 swe GND I up Wage bs D2 5 com Dc MBRS140T3 MBRS140T3 K 108 sckamwrmwerPP7 Pavana me Pk EE ng id y 110 SS2PWSIKWPE PPE PAT AD9 3G R5 Toap vec 8 R
90. o interprets the LIN signals and sets some Power Die variables using the SPI Driver DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Stepper Software Description 51 For More Information On This Product Go to www freescale com 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 u16 rd positionReq signal and is used for Position and Speed control process Similarly frequencyReq is created from u8 rd frequencyRegq Actual position positionAct from the Position Sensing process is passed to the LIN message I u16 wr positionAct signal Similarly for frequencyActLowHigh and u16 wr frequencyAct Designer Reference Manual DRM047 Rev 0 52 LIN Stepper Software Description For More Information On This Product Go to www freescale com MOTOROLA _u8_wr_AppFlags1 u8 wr AppErrFlags Freescale Semiconductor Inc LIN Stepper Software Description LIN Steppe
91. o main possible setups The first is for a LIN HID demo application see Figure E 1 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 e HID lamp system with two slave boards e Master board e Personal computer e 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 DRM047 Rev 0 Designer Reference Manual MOTOROLA System Setup 115 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Setup Personal Computer 12V Power Supply Master Board Slave Board HID Lamp system Figure E 1 LIN HID Demo Application Designer Reference Manual DRM047 Rev 0 116 System Setup MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Setup Jumper Settings of Master and Slave Boards Slave Board Power Supply Personal Computer Figure E 2 Programming and Debugging Application Detail E 2 Jumper Settings of Master and Slave Boards The jumper settings depend on the desired device functionality and are specified by Table E 1 Table E 1 Master and Slave Boards Jumper Settings System Setup LIN HID demo application Programming and Configuration Master Board jumper heade
92. on 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 DRM047 Rev 0 20 System Concept MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Concept LIN Stepper Controller 2 2 LIN Stepper Controller DRM047 Rev 0 The LIN Stepper Controller is the LIN bus slave node It does the following e controls bi phase bipolar stepper motors to a required position with automatic speed acceleration and deceleration e communicates with the master node via LIN bus e provides LIN bus clock synchronization the slave node uses internal on chip oscillator with no external components e provides parameters configuration programming via LIN bus when requested by LIN bus configuration signals e provides LIN signals reconfiguration via LIN bus to a required axis when requested by LIN bus configuration signals 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 posi
93. onH the relative position Correction is used to correct the actual position by sending this signals High Byte x H lt 0xCO Ox3F gt x HL lt 16384 16383 gt Designer Reference Manual DRM047 Rev 0 106 LIN Frames and Signals For More Information On This Product Go to www freescale com MOTOROLA Freescale Semiconductor Inc LIN Frames and Signals LIN Leveller Configuration Frames Table C 2 LIN Leveller Configuration Frames Continued Signal Signal Frame Raw Provi p Name Signal Name Signal Functionality Description Value Normalized Value Range der tor s ID Range Axis The frame frmSlaveResponse provides the LIN Stepper Controller previously addressed initiated with frmMasterRequest of u8 rd service 0x80 Upload u8 rd nodelD node ID parameter Service Byte Specifies the Master Request Frame service The application uses this Command 0x00 Sleep i k 0x00 Frame user defined service as 20x01 lt 0x01 _u8_wr_service specified in Section 9 References Ox7ES 0x7Fs Reserved 2 0x80 0x80 Upload parameters The service byte S gt M the meaning of the next signals in the frmMasterRequest frame Node ID Current LIN Stepper Controller node ID see lt 0 u8 wr nodelD u8 rd nodelD and OxFF gt lt 0 255 gt 1 o Appendix C 3 LIN Leveller O i 3 5 frmSlave Configuration Frames 838 Q Response 0x00 A1
94. onfiguration process covers two functions e Parameters Configuration provides upload and download of the control parameter e 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 configuration messaging frames and signals is in Appendix C 1 LIN Leveller Basic Frames Appendix C 3 LIN Leveller Configuration Frames Designer Reference Manual MOTOROLA Messaging Scheme Description 37 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Messaging Scheme Description Designer Reference Manual DRM047 Rev 0 38 Messaging Scheme Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Designer Reference Manual DRM047 Section 5 LIN Master Software Description The software is described in terms of e General State machine diagram e Data flow chart for each Master Board mode 5 1 State Machine Figure 5 1 presents a general description of the implemented software The main routine consists of MCU Initialization and Mode selection procedures 5 1 1 MCU Initialization Provides initialization of the microcontroller e Ports A H pull up pull down M wired or P pull up S initialization e Phase Locked Loop setup Core is running on 48MHz e Enable glob
95. otor is not stopped This can cause the actual position to be lost 0 False 1 True bool rd PosResetFlagA1 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 positionResetRq Value 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 0 False 1 True Designer Reference Manual DRM047 Rev 0 98 LIN Frames and Signals For More Information On This Product Go to www freescale com MOTOROLA Freescale Semiconductor Inc LIN Frames and Signals LIN Leveller Basic Frames Table C 1 LIN Leveller Messaging Continued Signal j Signal Accep Frame Name Raw Normalized Provi Signal Name Signal Functionality Description Value Value der tor s ID Range Range Light On Flag The LIN Stepper Controller acceptor controls the High Master At frmPosCmaAT _bool_rd_LightOnFlagA1 Side switch of the power output So A12 0x20
96. pdated Requests Service of the Updated Actual Position is shown in Figure 6 3 It provides the necessary Position and Speed control functionality when the actual position value is updated step done or when stop timeout is scheduled Designer Reference Manual DRM047 Rev 0 56 LIN Stepper Software Description MOTOROLA For More information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Description LIN Stepper Software Data Flow Updated Actuals Ng Pa No positionDif Ng 7 itionReq positionAct pesmen n Pesmenn itionDecelAfterRamp lt Yes ae E g Yes _positionDif 0 gt No NG frequencyAct Stop Timeout Stop Block oA Frequency Deceleration Begin Set tepRun flag gt No StopTimeout fla 1 pah CA PE HG E iS a pre NIT Return Return Yes Yes Step Start Return lt lt positionDif gt 0 gt No Yes pa 7 positive rotation No 4 ted negative rotation direction direction nDecelAfterRamp Yes Yes Po Reverse Timeout No No Begin Y frequencyActLowHig 5 Frequency pra HON EL Pa a Return Bad s __ decelDistance _ Decelerat
97. position positionAct update e handles changes after required frequency frequencyReq update e ads time instant PERIOD STOP TIMEOUT MS after deceleration ramp The functionality of the Position and Speed Control Processes can be explained using Figure 6 2 Figure 6 3 and Figure 6 4 NOTE Speed frequency control is based on the fact that identical constant acceleration is used for acceleration as for deceleration Therefore the number of steps for speed acceleration is almost the same as for speed deceleration 1 Before the motor stops the speed must be at frequencyStart in order not to lose the position In addition according to dynamic behavior oscillation the motor is better stabilized at stop if it provides few steps with the frequencyStart speed 2 Therefore we apply the reserve constant DECEL AFTERRAMP RESERVE The last issue is a numerical reserve DECEL NUMERICAL RESERVE Because acceleration and deceleration ramps are calculated from previous commutation step reserve the number of steps for acceleration ramp is higher than deceleration ramps steps In order to fulfil condition 1 there is 3 DECEL NUMERICAL RESERVE Designer Reference Manual DRM047 Rev O 54 LIN Stepper Software Description For More Information On This Product Go to www freescale com MOTOROLA Freescale Semiconductor Inc LIN Stepper Software Description LIN Stepper Software Data Flow The variable positionDece
98. r Jumper to position marked as PCM Jumper to position marked as D J2 click on the Reset button SW1 click on the Reset bottom SW1 Slave po JIIPEE header Short jumper pins Open jumper pins DRM047 Rev 0 Designer Reference Manual MOTOROLA System Setup For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Setup E 3 Required Software Tools The application requires the following software development tools e Metrowerks CodeWarrior for HCO8 microcontrollers version 2 1 or later e PEMICRO PROGO8SZ Flash EEprom Programmer HC08 devices using MONO8 version 1 68 e Metrowerks CodeWarrior for HC12 microcontrollers with BDM support version 2 0 or later e Microsoft Internet Explorer e PC Master software tool E 4 Building and Uploading the Application E 4 1 LIN Master the application software is delivered in the folder lin_leveller The master software is located in the sub folder lin_master The slave software is located in the sub folder lin_stepper 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 Designer Reference Manual After successfu
99. r More Information On This Product Go to www freescale com MOTOROLA Freescale Semiconductor Inc Hardware Description Slave Board Table 3 1 Connector J2 Signals Pin No AHA Pin Name Description MON08 mode 10 In PTB4 AD4 MON08 mode Rca via 10k resistor 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 Table 3 2 Connector J3 Signals Pin No Input Output Signal range 1 GND GND GND HB1 a out motor phase 1 1 Nas HB2 3 Qu motor phase 1 2 HB3 t oui motor phase 2 1 upan 5 In HB4 motor phase 2 1 6 In High Side 0 5V 3 2 5 Power Supply and Decoupling 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 DRM047 Rev 0 Designer Reference Manual MOTOROLA Hardware Description 33 For More Information On This Product Go to www freescale com 3 2 6 Hall Port and Se Designer Reference Manual Freescale Semiconductor Inc Hardware Description nsor The LIN Stepper Controll
100. r Software Data Flow LIN Messages bool rd ApplnitFlag bool rd ClrFlag bool rd PosResetFlag bool rd LightOnFlag u8 rd frequencyReq u16 rd positionReq u8 wr frequencyAct u16 wr positionAct aa eAppState sParameterRAM Slave App Control lag EFE positionAct frequencyActLowHigh fun calls A positionReq frequencyReq a sParameterRAM curentBlockRun uAppFlags1 erlMR sParameterRAM uAppConfigByte1 UAppErrFlags erSYSCTL erSYSSTAT pm fun fun periodStep calls i sgi Motor Stepping calls Position and Control Speed Control fun calls erHBOU erHBCTL uMotStepControlFlags positionAct timeMotStep POUT IFR IMR SYSCTL SYSSTAT HBOUT erHBCTL DRM047 Rev 0 calls Position Timer Sensing Motor Step Figure 6 1 LIN Stepper Software Data Flow 1 Designer Reference Manual MOTOROLA LIN Stepper Software Description For More Information On This Product Go to www freescale com 53 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 e linear acceleration and deceleration ramps from frequencyStart to frequencyReq with ramp steepness acceleration deceleration e handles changes after required positionReq position update e handles changes after actual
101. r information about scaling Designer Reference Manual MOTOROLA LIN Frames and Signals 97 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Frames and Signals Table C 1 LIN Leveller Messaging Signal Provi der Signal Accep tor s Axis Frame Name ID Signal Name Signal Functionality Description Raw Value Range Normalized Value Range Master frmPosCmdA1 0x20 l_u16_rd_positionReqA1 Required absolute Position The LIN Stepper Controller acceptor provides automatic control of the actual position to this value lt 0xC000 Ox3FFF gt lt 16384 16383 gt _u8_rd_frequencyRegA1 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 X lt 0x00 OxFF gt f x RESOLU TION_FR EQUENC Y_HZ x Hz _bool_rd_flagClrA1 Clear Error Flag The LIN Stepper Controller acceptor provides all system error clear 0 False 1 True bool rd ApplnitFlagA1 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 m
102. r position reset motor position Reset positionResetRqValue Request position for position reset sParameterRAM Pr motor Stall position positionStall ah for position reset periodStopTimeou Period Stop Timeout after motor deceleration acceleration frequency acceleration constant frequencyStart motor Start Minimum stepping frequency data0 3 RESERVED curentBlockRun current limitation for motor block run state UAppConfigByte1 Application Configuration Byte 1 nodelD Flag motor rotation direction at positive speed RotDir24AtPosit HB2 gt HB4 uAppConfigByte1 AccelEnbl Flag motor speed Acceleration Enabled Flag full step stepper operation FullStep 1 full stepping 0 half s same as sParameterROM sParameterRAM System Control Register PYSG TE ErSYoCTL in Power Die see Section 9 References 9 System Status Register Sie AE GTSVSSTAT in Power Die see Section 9 References 9 Designer Reference Manual DRM047 Rev 0 112 LIN Stepper Software Data Variables MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Stepper Software Data Variables Possible Software Extension Programming via LIN Table D 1 Stepper Controller Software Data Variables Continued Name Components Description Application Error Flags register See Table C 1 _u8_wr_AppErrFlagsA1_1 for details on each components HighTemperature HTF
103. rs Manual or automatic generation of the required position of LIN stepper In the case of automatic generation a read out of a predefined signal curve simulation of real application is provided 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 Designer Reference Manual MOTOROLA System Concept 23 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Concept The personal computer provides software download or debugging with a dedicated programming e g Pemicro or debugging software e g Metrowerks Hiwave Debugger 2 3 4 Pass Mode Master board acts as a gateway between RS232 and LIN bus copy signals between RS232 and LIN bus The mode can be us
104. s set to Manual The Error notes can be 7 4 5 Low Time Cases 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 If the time dedicated to Loop1 communication requests is always shorter than the time necessary for Loop2 communication the priority rule of Loop1 is dismissed and loop requests are satisfied in order following each other This state is signalled by the note Frames are not Designer Reference Manual DRM047 Rev 0 76 User Interface Description MOTOROLA For More Information On This Product Go to www freescale com 7 5 Recorder DRM047 Rev O Freescale Semiconductor Inc User Interface Description Recorder 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 st
105. ster 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 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 displayed above the bubble by the LIN bus e Sleep frame e Wake up frame e Frames for configuration of the LIN bus network e Programing parameters displayed below the bubble of LIN Stepper Controller Designer Reference Manual DRM047 Rev 0 42 LIN Master Software Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Master Software Description Data Flow The meanings of the variables above and below the bubbles are described in Section 7 7 Programming and Configuration excluding LIN SleepWakeRegq 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 co
106. terface Description The master serves two messaging loops Each loop can handle up to three signal frames frmPosCmd frmPosStatus frmAppStatus Each of the three signal frames can be chosen according to a required axis Any of the three frames can be disabled Loop1 sends signals with period periodeSend Loop1 This period can be modified by the control page see Figure 7 2 If all three frames are enabled the LIN Master controls consecutive sending of Loop1 frames frmPosCmd frmPosStatus frmAppStatus immediately after each other Then it waits to get the periodeSend Loop1 between sending If Loop2 is also enabled the three frames of Loop2 are sent after Loop1 The details are described in the Section 7 User Interface Description The default value of the periodeSend Loop1 is 30 ms Designer Reference Manual DRM047 Rev 0 36 Messaging Scheme Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Messaging Scheme Description LIN Leveller Configuration Messaging 4 3 LIN Leveller Configuration Messaging DRM047 Rev 0 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 u8 rd nodelD signal see Appendix C 3 LIN Leveller Configuration Frames The c
107. the horizontal Axis1 It is expected that one control signal is sufficient for both right and left headlamp Therefore two nodes with signal sets Axis1 1 and Axis1 2 are acceptors for Axis1 signals This uses and demonstrates the LIN bus multicast concept There are two ways to program the LIN Stepper Controller node to a dedicated axis 1 Setting appropriate target Axis1 1 Axis1 2 Axis2 Axis3 in the lin stepper mcp file This will create the compiled code with the required setting DRM047 Rev 0 Designer Reference Manual MOTOROLA Messaging Scheme Description 35 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Messaging Scheme Description 2 using LIN reconfiguration as described in Appendix C 3 LIN Leveller Configuration Frames or Section 6 1 9 Reconfig 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 e frmPosCmd The frames provided by slave nodes are e frmPosStatus e 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 In
108. tion 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 e node ID number O to 255 e uAppConfigByte1 Designer Reference Manual MOTOROLA System Concept 21 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc System Concept 2 3 LIN Master Designer Reference Manual e motor block and run current limitation e motor stepping start frequency e motor stepping acceleration e period motor stop time out e motor stall position e motor parking position e motor position correction Four groups of LIN signal frames are defined to control the dedicated axis e Axis 1_1 to be used as horizontal axis right lamp signals group e Axis 1_2 to be used as horizontal axis left lamp signals group e Axis 2 to be used as vertical axis right lamp signals group e Axis 3 to be used as
109. unication 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 Designer Reference Manual MOTOROLA Introduction 15 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc Introduction 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 proto
110. user must guarantee that there will be no other nodes with the same node ID connected to one LIN bus C 3 LIN Leveller Configuration Frames The Master Request and Slave Response frames were used for the LIN Stepper Controller configuration The configuration allows on LIN adaptation of the LIN Stepper software Each configuration frame is used to configure the LIN Stepper Controller with node ID equal to the u8 rd nodelD 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 u8 rd paramArray defines the section of the parameters sent in four data signals u8 rd datax It is also described in Section 6 1 8 Config Param Before the Store service the parameters updated in the configuration are stored in paramRAM volatile structure The service u8 rd service Store FLASH provides storing of all RAM parameters arrays paramRAM to paramROM The paramROM is in the FLASH memory and is copied to the paramRAM after any MCU reset The service u8 rd service MCU Reset forces the reset of dedicated LIN Stepper Controller DRM047 Rev 0 Designer Reference Manual MOTOROLA LIN Frames and Signals 101 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc LIN Frames an
111. 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 e PC master mode PCM e Master mode M e Debug mode D e Pass mode P DRM047 Rev 0 22 System Concept MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc 2 3 1 PC Master Mode 2 3 2 Master Mode 2 3 3 Debug Mode DRM047 Rev 0 System Concept LIN Master 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 two timing loops Possibly fully control the position of up to two independent LIN steppe
112. ware Description 3 2 3 Software Download and Debugging Designer Reference Manual Connector J2 is used for software download or debugging This is based on so called MONO8 mode see Section 9 References 10 Section 10 Monitor ROM The signals PTB4 AD4 PTB3 AD3 PTA1 KB1 PTAO KBO 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 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 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 oid Pin Name Description MON08 mode 1 PTC4 OSC 19 6608kHz 2 VSS Ground GND 3 VDD 5V supply 5V 4 In IRQ_IN MCU IRQ Input 9V 5 Out IRQ RQ Sin jumper JP1 open 6 In RST MCU Reset input falling edge serial 7 In Out PTAO KBO MONO8 mode communication 19 200 kBaud 8 In PTA1 KB1 MON08 mode GND 9 In PTB3 AD3 MONO8 mode GND DRM047 Rev 0 32 Hardware Description Fo
113. y 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 DRM047 Rev 0 78 User Interface Description MOTOROLA For More Information On This Product Go to www freescale com Freescale Semiconductor Inc User Interface Description Oscilloscope 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 EE Master pmp PCMaster s10 x File Edit View Scope Item Project Help Go Gia S esim mri f6 aleea iili l Ele E8 Slave control WE Configuration and Programming E Oscilloscope positionReg_Loop1 482 Recorder positionRegSent_Loop1 p1 positionAct Loop1 positionReqSent_Loop2 Position_Loo positionReq Loop2
114. zed Value Range tor s der Axi ID Range xis in case paramArray 0 PARAMS_CONFIG the data signals has the below described meaning the signal is interpreted according to the u8 rd paramArray signal paramArray 0 node ID This signal changes current Lue td datao Stepper Controller node ID to this lt 0 0xF lt 0 255 gt new node ID F gt Caution Beginning the next configuration frames the configured node will react only when the signal _u8_rd_nodelD this new node ID the signal is interpreted according to the _u8_rd_paramArray signal paramArray 0 uAppConfiByte1 bit3 RotDir24AtPosit motor rotation direction at motor positive direction signature flag 0 0 False _u8_rd_datat RotDirSign is phase HB2 gt HB4 1 1 True bit6 AccelEnbl motor speed Acceleration Enabled bit7 FulllStep full step stepper frmMaster operation F Request 1 full stepping broad 0 half stepping Master east 0x3C Block current Limitation oxtY OxOY off no current 0x1Y no limitation OxZ2 aa Ox3Y 0xZ2 no limitation Ox4Y 0x3Y 60mA Ox5Y 0x4Y 250mA Sap F Ox5Y 350MA the signal is interpreted according to Ox6Y the _u8_rd_paramArray signal Ox7Y 0X6 C 00M nites nag 0x7Y 700mA u8 rd data2 paramArray 0 R currentBlockRun defines the current 0xZO ee Bey Ae Run current Limitation limitation when motor is running or 0xZ1 MEER 0xZ0 no limitation stopped 0xZ2 Boek 0xZ1 no limitation 0xZ3 ek a 0xZ4 0xZ2 no limitation Ox
Download Pdf Manuals
Related Search
Related Contents
Brickcom OB-500AF surveillance camera Robertshaw 300-203 Owner's Manual 全文 - 裁判所 JVC LT-Z26SX5 User's Manual Sony RDHGTK33iP User's Manual Yocto-4-20mA-Rx, Mode d`emploi Lenco iPod tower 1 Milwaukee 48-59-0255 User's Manual 取扱説明書 iSIM Active Filter Designer Overview Copyright © All rights reserved.
Failed to retrieve file