communicates46sw.com
46sw.com 时间:2021-04-08 阅读:(
)
FreescaleSemiconductor,Inc.
,2006.
Allrightsreserved.
FreescaleSemiconductorApplicationNoteAN3008Rev.
1,05/2006TableofContentsThisapplicationnotedescribesthedesignofaDCmotordrivebasedonFreescale'sPowerPCMPC5554microcontroller.
TheapplicationdesigntakesadvantageoftheEnhancedTimeProcessingUnit(eTPU)module,whichisusedasamotorcontrolco-processor.
TheeTPUcompletelyhandlesthemotorcontrolprocessing(excludingcommutationprocessing),eliminatingthemicroprocessoroverheadforotherduties.
TheconceptoftheapplicationistocreateaspeedandcurrentclosedloopDCdriverusinganoptical,Hall-likepositionsensor.
ItservesasanexampleofaDCmotorcontrolsystemdesignusingaFreescalemicroprocessorwiththeeTPU.
ItalsoillustratestheusageofdedicatedmotorcontroleTPUfunctionsthatareincludedintheDCmotorcontroleTPUfunctionset.
Thisapplicationnotealsoincludesbasicmotortheory,systemdesignconcept,hardwareimplementation,andmicroprocessorandeTPUsoftwaredesign,includingtheFreeMASTERvisualizationtool.
1PowerPCMPC5554andeTPUAdvantagesandFeatures22TargetMotorTheory.
43SystemConcept.
64SoftwareDesign165ImplementationNotes386MicroprocessorUsage397SummaryandConclusions408References41DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554CoversMPC5554andalleTPU-EquippedDevicesby:MilanBrejl&MichalPrinc&PavelSustekSystemApplicationEngineersRoznovCzechSystemCenterDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1PowerPCMPC5554andeTPUAdvantagesandFeaturesFreescaleSemiconductor2Figure1.
UsingMPC5554DEMO,33395EvaluationMotorBoard,andDCMotor1PowerPCMPC5554andeTPUAdvantagesandFeatures1.
1PowerPCMPC5554MicrocontrollerTheMPC5554microcontrollerisafamilyofnextgenerationpowertrainmicrocontrollersbasedonthePowerPCBookEarchitecture.
Featuringtwo32channelseTPUengines,32Kbytesofcache,64KbytesofinternalSRAM,2MbytesofinternalFlashmemory,a64-channeleDMAcontroller,3FlexCANmodules,3UARTsandfourDSPImodules,theMPC5554familyhasbeendesignedforapplicationsthatrequirecomplex,real-timecontrol.
This32-bitdeviceisbasedonthePowerPCoperatingatacorefrequencyupto132MHz.
On-chipmodulesinclude:High-performance32-bitPowerPCBookE-compliantcoreMemorymanagementunit(MMU)with24-entryfullyassociativetranslationlook-asidebuffer(TLB)2MBofembeddedFlashmemorywithErrorCorrectionCoding(ECC)PowerPCMPC5554andeTPUAdvantagesandFeaturesDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor364KBon-chipL2staticRAMwithECC32KBofcachethatcanbeconfiguredasadditionalRAMnexusIEEE-ISTO5001classmulticoredebugcapabilitiesTwoenhancedtimeprocessorunits(eTPUs)64-channeleDMA(EnhancedDirectMemoryAccess)controllerInterruptcontroller(INTC)capableofhandling286satiable-priorityinterruptsourcesFrequencymodulatedphase-lockedloop(FMPLL)toassistinelectromagneticinterference(EMI)managementEnhancedqueuedanalog-to-digitalconverter(eQADC)Fourdeserialserialperipheralinterface(DSPI)modulesThreecontrollerareanetwork(FlexCAN)modulesTwoenhancedserialcommunicationinterface(eSCI)modulesEighty-eightchannelsoftimedI/OCrossbarswitch(XBAR)EnhancedmodularI/Osystem(eMIOS)Formoreinformation,refertoReference1.
1.
2eTPUModuleTheeTPUisanintelligent,semi-autonomousco-processordesignedfortimingcontrol,I/Ohandling,serialcommunications,motorcontrol,andenginecontrolapplications.
ItoperatesinparallelwiththehostCPU.
TheeTPUprocessesinstructionsandreal-timeinputevents,performsoutputwaveformgeneration,andaccessesshareddatawithoutthehostCPU'sintervention.
Consequently,thehostCPUsetupandservicetimesforeachtimereventareminimizedoreliminated.
TheeTPUontheMPC5554microcontrollerhastwoengineswithupto32timerchannelsforeach.
Inadditionithas16Kbytesofcodememoryand3Kbytesofdatamemorythatstoressoftwaremodulesdownloadedatboottimeandthatcanbemixedandmatchedasrequiredforanyspecificapplication.
TheeTPUprovidesmorespecializedtimerprocessingthanthehostCPUcanachieve.
ThisispartiallyduetotheeTPUimplementation,whichincludesspecificinstructionsforhandlingandprocessingtimeevents.
Inaddition,channelconditionsareavailableforusebytheeTPUprocessor,thuseliminatingmanybranches.
TheeTPUcreatesnohostCPUoverheadforservicingtimingevents.
Formoreinformation,refertoReference9.
DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1TargetMotorTheoryFreescaleSemiconductor42TargetMotorTheoryADCmotorisarotatingelectricmachinewherethestatorofapermanentmagnetDCmotoriscomposedoftwoormorepermanentmagnetpolepieces.
Therotoriscomposedofwindingswhichareconnectedtoamechanicalcommutator.
Theoppositepolaritiesoftheenergizedwindingandthestatormagnetattractandtherotorwillrotateuntilitisalignedwiththestator.
Justastherotorreachesalignment,thebrushesmoveacrossthecommutatorcontactsandenergizethenextwinding(seeFigure2).
Noticethatthecommutatorisstaggeredfromtherotorpoles.
IftheconnectionsofaDCmotorarereversed,themotorwillchangedirections.
Figure2.
DCMotor—CrossSection2.
1DigitalControlofaDCMotorForthecommonDCmotor,a2-phasepowerstageisused(seeFigure3).
Thepowerstageutilizesfourpowertransistorsthatoperateineitheranindependentorcomplementarymode.
Inbothmodes,thepowerstageenergizestwomotorphasesconcurrently.
ThevoltageisappliedtotheDCmotorusingapulsewidthmodulation(PWM)technique.
Therearetwobasictypesofpowertransistorswitchingschemes:independentandcomplementary.
Bothswitchingmodesareabletoworkinbipolarorunipolarmode.
ThepresentedapplicationutilizesthecomplementarybipolarPWMmode.
FormoreinformationaboutPWMtechniques,refertoReference17.
StatorRotorwinding(inslots)ShaftRotorAirgapPermanentmagnetsTargetMotorTheoryDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor5Figure3.
2-PhaseDCMotorPowerStage(H-Bridge)2.
1.
1SpeedandCurrentControlThemotorspeeddependsontheamplitudeoftheappliedvoltage.
TheamplitudeoftheappliedvoltageisadjustedusingthePWMtechnique.
Therequiredspeediscontrolledbyaspeedcontroller,whichisimplementedasaconventionalproportional-integral(PI)controller.
ThedifferencebetweentheactualandrequiredspeedsisinputtothePIcontrollerwhichthen,basedonthisdifference,controllerstherequiredDC-buscurrent.
TherequiredDC-buscurrentiscontrolledbyacurrentcontroller,whichisalsoimplementedasaconventionalproportional-integral(PI)controller.
ThedifferencebetweentheactualandrequiredDC-buscurrentisinputtothePIcontrollerwhichthen,basedonthisdifference,controlsthedutycycleofthePWMpulses,whichcorrespondtothevoltageamplituderequiredtomaintainthedesiredspeed.
Thecurrentcontroller,whichistheinner-loopcontroller,isupdatedmorefrequently,forexampleeveryPWMperiod,comparedtothespeedcontroller,whichistheouter-loopcontroller.
Thespeedcontroller,aswellasthecurrentcontroller,calculatesthePIalgorithmgivenintheequationbelow:AftertransformingtheequationintoadiscretetimedomainusinganintegralapproximationwiththeBackwardEulermethod,wegetthefollowingequationsforthenumericalPIcontrollercalculation:ut()Kcet()1TI-----eτ()τd0t∫+=uk()uPk()uIk()+=uPk()Kcek()=uIk()uIk1–()Kc+TTI-----ek()=DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor6where:3SystemConcept3.
1SystemOutlineThesystemisdesignedtodriveaDCmotor.
Theapplicationmeetsthefollowingperformancespecifications:VoltagecontrolofaDCmotorTargetedatPowerPCMPC5554DEMOEvaluationBoard(MPC554DEMO),InterfaceBoardwithUNI-3,33395EvaluationMotorBoard,and24V,3200RPM,DCmotorControltechniqueincorporates:—VoltageDCmotorcontrolwithspeedandcurrentclosedloop—Bothdirectionsofrotation—4-quadrantoperation—Startfromanymotorpositionwithoutrotoralignment—Minimumspeedof200RPM—Maximumspeedof1200RPM(limitedbypowersupply)Manualinterface(start/stopswitch,up/downpushbuttoncontrol,LEDindication)FreeMASTERcontrolinterface(speedset-up)FreeMASTERmonitor—FreeMASTERgraphicalcontrolpage(requiredspeed,actualmotorspeed,start/stopstatus,faultstatus)—FreeMASTERspeedcontrolscope(observesrequired,ramp,andactualspeeds,requiredDC-buscurrent)—FreeMASTERcurrentcontrolscope(observesrequiredandactualDC-buscurrents,appliedvoltage)—DetaildescriptionofalleTPUfunctionsusedintheapplication(monitoringofchannelregistersandallfunctionparametersinrealtime)DCbusover-currentfaultprotectione(k)=Inputerrorinstepkw(k)=Desiredvalueinstepkm(k)=Measuredvalueinstepku(k)=Controlleroutputinstepkup(k)=ProportionaloutputportioninstepkuI(k)=IntegraloutputportioninstepkuI(k-1)=Integraloutputportioninstepk-1TI=IntegraltimeconstantT=SamplingtimeKc=ControllergainSystemConceptDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor73.
2ApplicationDescriptionAstandardsystemconceptischosenforthemotorcontrolfunction(seeFigure4).
Thesystemincorporatesthefollowinghardware:EvaluationBoardMPC5554DEMOInterfaceBoardwithUNI-333395EvaluationMotorBoardDCmotorwithoptical,Hall-likesensorsPowerSupply12VDC,2.
7AmpsTheeTPUmodulerunsthemaincontrolalgorithm.
The2-phasePWMoutputsignalsfora2-phaseinverteraregeneratedaccordingtofeedbacksignalsfromopticalsensorsandtheinputvariablevalues,providedbythemicroprocessorCPU.
Figure4.
SystemConceptThesystemprocessingisdistributedbetweentheCPUandtheeTPU,whichbothruninparallel.
TheCPUperformsthefollowingtasks:Periodicallyscanstheuserinterface(ON/OFFswitch,upanddownbuttons,FreeMASTER).
Basedontheuserinput,ithandlestheapplicationstatemachineandcalculatestherequiredspeeds,whichispassedtotheeTPU.
PeriodicallyreadsapplicationdatafromeTPUdataRAMinordertomonitorapplicationvariables.
Intheeventofanovercurrentfault,thePWMoutputsareimmediatelytemporarilydisabledbytheeTPUhardware.
Then,afteraninterruptlatency,theCPUdisablesthePWMoutputspermanentlyanddisplaysthefaultstate.
DCMotorDriveeTPUenable/disablePWMsignalsrequiredspeedApplicationStateMachineON/OFFswitchstatusdatamonitoringFaultLEDCPUHardware912VDC÷ON/OFFDOWNUPUARTFreeMASTERRemoteControlRS232GPIOPWMSignalsFaultSignalStatusLEDADCTriggerADConverterBLDCmotorHallSensorSignalsPowerStageEMIOSOver-currentinterruptDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor8TheeTPUperformsthefollowingtasks:FoureTPUchannels(PWMF)areusedtogeneratePWMoutputsignals.
ThreeeTPUchannels(HD)areusedtoprocessopticalsensorsignals.
Oneachincomingedge,arevolutionperiodiscalculated.
eTPUcontrolsaspeedclosedloop.
Theactualmotorspeediscalculatedbasedontherevolutionperiodandcomparedwiththerequiredspeed,providedbytheCPUandpassedthrougharamp.
ThespeedPIcontrolalgorithmprocessestheerrorbetweentherequiredandactualspeed.
ThePIcontrolleroutputispassedtothecurrentcontrollerasanewlycorrectedvalueoftherequiredDC-buscurrentvalue.
eTPUcontrolsacurrentclosedloop.
TheactualDC-buscurrentissampledbyanexternalADconverter,andtheconvertedvalueistransferredbyDMAtotheeTPU.
Theactualvalueiscomparedwiththerequiredspeed,providedbythespeedcontroller.
ThecurrentPIcontrolalgorithmprocessestheerrorbetweentherequiredandactualcurrent.
ThePIcontrolleroutputispassedtothePWMgeneratorasanewlycorrectedvalueoftheappliedmotorvoltage.
SystemConceptDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor9Figure5.
TheApplicationandFreeMASTERScreen3.
2.
1UserInterfaceTheapplicationisinterfacedbythefollowing:ON/OFFswitchontheInterfaceBoardwithUNI-3Up/DownbuttonsontheInterfaceBoardwithUNI-3,orFreeMASTERrunningonaPCconnectedtotheMPC5554DEMOviaanRS232serialcable.
TheON/OFFswitchaffectstheapplicationstateandenablesanddisablesthePWMphases.
Whentheswitchisintheoff-position,novoltageisappliedtothemotorwindings.
WhentheON/OFFswitchisinDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor10theon-position,themotorspeedcanbecontrolledeitherbytheUpandDownbuttonsontheInterfaceBoard,orbytheFreeMASTERonthePC.
TheFreeMASTERalsodisplaysacontrolpage,real-timevaluesofapplicationvariables,andtheirtimebehaviourusingscopes.
FreeMASTERsoftwarewasdesignedtoprovideanapplication-debugging,diagnostic,anddemonstrationtoolforthedevelopmentofalgorithmsandapplications.
ItrunsonaPCconnectedtotheMPC5554DEMOviaanRS232serialcable.
AsmallprogramresidentinthemicroprocessorcommunicateswiththeFreeMASTERsoftwaretoreturnstatusinformationtothePCandprocesscontrolinformationfromthePC.
FreeMASTERsoftware,executingonaPC,usespartofMicrosoftInternetExplorerastheuserinterface.
Note,thatFreeMASTERversion1.
2.
31.
1orhigherisrequired.
TheFreeMASTERapplicationcanbedownloadedfromhttp://www.
freescale.
com.
FormoreinformationaboutFreeMASTER,refertoReference8.
3.
3HardwareImplementationandApplicationSetupAspreviouslystated,theapplicationrunsontheMPC5554familyofPowerPCmicroprocessorsusingthefollowing:MPC5554DEMOInterfaceBoardwithUNI-333395EvaluationMotorBoardDCmotorwithoptical,Hall-likesensorsPowerSupply,12VDC,minimum2.
7AmpsFigure6showstheconnectionoftheseparts.
AllsystempartsaresuppliedbyFreescaleanddocumentedaccordingtoreferences.
3.
3.
1PowerPCMPC5554EvaluationBoard(MPC5554DEMO)ThisboardisnotintendedtobeafullevaluationboardfortheMPC5554,butshowsaminimalsystemforlearningaboutthenewMPC5500familyofproduct.
TheFLASHmemoryplacedontheMPC5554hasthreeaddressspaces.
Lowandmidaddressspacesare256-Kbytesandhighaddressspacesis1.
5Mbyteinsize.
Itgivesatotalmemoryspaceof2Mbytes.
Formoreinformation,refertoReference2.
Table1listsallMPC5554DEMOjumpersettingsusedintheapplication.
SystemConceptDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor11Figure6.
ConnectionofApplicationPartsTable1.
.
MPC5554DEMOJumperSettings.
JumperSettingCAN_SELSettingCONFIGSWITCHSettingJP1-1JP1-2JP2JP3JP4JP5VRH_ENSRAM_SELVSTBY_SWITCH1-21-21-231-21-231-21-21-23ON123456121212121212123456ONOFFONOFFONOFFDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor123.
3.
2FlashingtheMPC5554DEMOTheeSysFlasherutilitycanbeusedforprogrammingcodeintotheFLASHmemoryontheMPC5554DEMO.
Checkforcorrectsettingofswitchesandjumpers.
Theflashingprocedureisasfollows:1.
RunMetrowerksMPC55xxV1.
5b2andopentheproject.
ChoosetheIntflashtargetandcompiletheapplication.
Afilesimple_eflash.
elf.
S19,whichwillbeloadedintoFLASHmemory,iscreatedintheprojectdirectorybin.
2.
RuntheeSysFlasherapplication.
IntheTargetConfigurationwindowselectthetypeoftheBDMCommunicationasP&EWiggler.
ClickOKtoclosethewindow.
3.
GototheProgramsectionbyclickingthe"ProgramFlash"button(seeFigure7).
SelecttheBinaryImage,setAddressas0x0andcheckthe"Verifyafterprogram"option(seeFigure8).
Pressthe"Program"andselectintflash.
binfile.
Finally,press"Open"buttonatthebottomofthewindowtostartloadingthecodeintotheFLASHmemory.
4.
Ifthecodehasbeenprogrammedcorrectly,removetheBDMinterfaceandpushtheRESETbuttonontheMPC5554Demo.
TheapplicationshouldnowrunfromtheFLASH.
Figure7.
eSysFlasherTargetConfigurationWindowTheeSYSFlasherapplicationcanbedownloadedfromhttp://www.
freescale.
comSystemConceptDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor13Figure8.
eSysFlasherProgramWindow3.
3.
3InterfaceBoardwithUNI-3ThisboardenablestoconnectthepowerstagewithamotortotheMPC5554DEMOBoardandcanbeusedbysoftwareandhardwaredeveloperstotestprogramsandtools.
ItsupportsalgorithmsthatuseHallsensors,LEMsensors,encoderfeedbackandBack-EMF(electromotiveforce)signalsforsensorscontrol.
InputconnectionsaremadeviaconnectorsonthebottomsideoftheboardandheadersontheMPC5554DEMOBoard.
Outputconnectionsaremadevia40-pinUNI-3connectorandexpansionheaders.
Powerrequirementsaremetbyinputconnectors.
Figure9.
InterfaceBoardwithUNI-3Formoreinformation,refertoReference4.
DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor143.
3.
4SettingOvercurrentLevelTheover-currentfaultsignalisconnectedtotheeMIOSOutputDisableInputpin(eMIOS10)thatenables,togetherwithapropereTPUconfiguration,handlingthefaultbyeTPUhardware.
ThisconnectionispartoftheMPC5554.
Inordertoenablehandlingthefaultalsobyasoftware,thefaultsignal,availableoneMIOS10pingeneratesinterruptrequesttotheCPUincaseofafault.
Theover-currentlevelissetbythetrimmerR24(I_SEN)ontheInterfaceBoardwithUNI-3(seeFigure10).
Reference4describeswhatvoltagemustthetrimmerdefinefortheover-currentcomparator.
Dothefollowingstepsinordertosetuptheover-currentlevelproperlywithoutmeasuringthevoltage:1.
ConnectallsystempartsaccordingtoFigure6.
2.
Downloadandstarttheapplication.
3.
TurnON/OFFswitchON.
UsingUpandDownbuttonssettherequiredspeedtothemaximum.
4.
AdjusttheR24trimmer.
YoucanfindalevelfromwhichtheredLEDstartstolightandthemotorspeedstartstobelimited.
Setthetrimmerlevelsomewhathigher,sothatthemotorcanrunatthemaximumspeed.
5.
TurntheON/OFFswitchOFF.
6.
TurnON/OFFswitchON.
UsingUpandDownbuttonssettherequiredspeedtothemaximum.
7.
Iftheapplicationgoestothefaultstateduringtheacceleration,adjusttheR24trimmerlevelsomewhathigher,sothatthemotorcangettothemaximumspeed.
theFigure10.
OvercurrentLevelTrimmeronInterfaceBoardwithUNI-3(R24)3.
3.
533395EvaluationBoardThe33395EvaluationMotorBoardisa12-volt,8-amppowerstage,whichissuppliedwitha40-pinribboncable.
IncombinationwiththeMPC5554EVBandInterfaceBoardwithUNI-3,itprovidesanout-of-the-boxsoftwaredevelopmentplatformforsmallbrushlessDCmotors.
Thepowerstageenablessensingavarietyoffeedbacksignalssuitablefordifferentmotorcontroltechniques.
Itmeasuresallthethreephasecurrents,reconstructsDC-buscurrentfromthem,DC-busvoltage,Back-EMFvoltageswithzerocrosssensing.
AlltheanalogsignalsareadaptedtobedirectlysampledbytheA/Dconverter.
ThisSystemConceptDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor15single-boardpowerstagecontainsananalogbridgegatedriverintegratedcircuitry,sensingandcontrolcircuitry,powerN-MOSFETtransistors,DC-Busbrakechopper,aswellasvariousinterfaceconnectorsforthesupplyandthemotor.
Formoreinformation,refertoReference5.
Figure11.
33395EvaluationMotorBoard3.
3.
6DCMotorwithOptical,Hall-likeSensorsTheenclosedmotorisalow-voltageDCmotor.
Theadditionalequipmentwhichenablestomeasuremotorspeedisattachedtothismotor(seeFigure12).
Itdealswiththefollowingparts:Adiskwithblackandwhitesectorsonitssurface.
Thediskisattachedtothemotorshaft.
AgroupofthreephotomicrosensorsEE-SY313thatareplacedonthespecialpositionsensorboardatthedistanceof5mmfromtheon-shaftdisk.
ThedescribedequipmentreplacesHallsensorswhicharewidelyusedformotionsystempositionsensing.
Eachphotomicrosensorgeneratesthesignalindependenceonthechangingcolor(blackorwhite)oftheon-shaftdisk.
ThiswaythreeHall-likesensorsignalsareproduced.
DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor16Figure12.
OpticalSensorsUsedfortheMotionSystemPositionSensing3.
3.
7PowerSupplyThepowersupply12V/2.
7A,isalsousedtopowerthe3-PhaseMicroPowerStage.
Theapplicationisscaledforthis12Vpowersupply.
4SoftwareDesignThissectiondescribesthesoftwaredesignoftheDCmotordriveapplication.
ThesystemprocessingisdistributedbetweentheCPUandtheeTPU,whichruninparallel.
TheCPUandeTPUtasksaredescribedintermsofthefollowing:CPU—SoftwareFlowchart—ApplicationStateDiagram—eTPUApplicationAPIeTPU—eTPUBlockDiagram—eTPUTimingSoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor17TheCPUsoftwareusesseveralready-to-useFreescalesoftwaredrivers.
ThecommunicationbetweenthemicroprocessorandtheFreeMASTERonPCishandledbysoftwareincludedinfmaster.
c/.
hfiles.
TheeTPUmoduleusesthegeneraleTPUutilities,eTPUfunctioninterfaceroutines(eTPUfunctionAPI),andeTPUapplicationinterfaceroutines(eTPUapplicationAPI).
Thegeneralutilities,includedintheetpu_util.
c/.
hfiles,areusedforinitializationofglobaleTPUmoduleandenginesettings.
TheeTPUfunctionAPIroutinesareusedforinitializationoftheeTPUchannelsandinterfacingeacheTPUfunctionduringrun-time.
AneTPUapplicationAPIencapsulatesseveraleTPUfunctionAPIs.
TheuseofaneTPUapplicationAPIeliminatestheneedtoinitializeeacheTPUfunctionseparatelyandtohandlealleTPUfunctioninitializationsettings,andsoensuresthecorrectcooperationofeTPUfunctions.
Figure13.
eTPUProjectStructureCPUCodeeTPUFunctionSourceCode,compiledbyByteCraftETPU_Cetpuc.
hetpuc_common.
hCodeGeneratedbyeTPUCompileretpu__auto.
hetpu_set3.
hetpu_.
cetpuc_set3.
cetpu_util.
c/.
hetpu_struct.
hStandardeTPUUtilitiesetpu_.
c/.
heTPUFunctionAPIetpu_app_.
c/.
heTPUApplicationAPI_etpu_gct.
c/.
hUsereTPUInitializationCodeUserApplicationmain.
cInitializationMethods:my_system_etpu_init();my_system_etpu_start();Run-TimeMethodsRun-TimeMethodsAN2940-46SWgeneratedbyeTPUGCTtheonlycodewrittenbytheuserAN2892AN2954-57SWAN2864SWAN2958SWSoftwareLevelSourceCodeFilesOrigineTPUCodeUserwrittencodeFreescalesuppliedcodeGeneratedcodeByteCraftsuppliedcodeDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor184.
1CPUSoftwareFlowchartFigure14.
CPUSoftwareFlowchartAfterreset,theCPUsoftwareinitializesperipherals,interrupts,andpins,andstartstheeTPUmodule.
Atthispoint,theCPUandtheeTPUruninparallel.
ThefollowingCPUprocessingisincorporatedintwoperiodictimerinterruptsandonefaultinterrupt.
4.
1.
1TimerInterruptServiceRoutineThetimerinterruptishandledbythetimer_isrfunction.
Thefollowingactionsareperformedperiodically,intimer_isr:ReadtheON/OFFswitchstatusHandletheapplicationstatemachineTheapplicationstatediagramisdescribedindetailbelow.
ServicetheUpandDownbuttonsandtheStatusLEDbytheApplicationButtonsAndStatusLedfunctionReadthedatastructurethroughtheeTPUapplicationAPIroutinefs_etpu_app_dcmhscl1_get_data(see4.
3).
RESETInitializeinterruptsandpinswaitReadON/OFFswitchstatusHandleapplicationstatemachineServiceUp/DownbuttonsandStatusLEDReadapplicationdatastructureRe-initializeallDMABCRxregistersTimer3InterruptHandleovercurrentfaultFaultInterruptFreeMasterDispatcherFreeMasterTimerInterruptFreeMasterRecordereTPUChannelInterruptHandleeTPUglobalexceptioneTPUGlobalExceptionInterruptSoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor194.
1.
2FreeMASTERInterruptServiceRoutineTheFreeMASTERinterruptserviceroutineiscalledfmasterDispatcher.
Thisfunctionisimplementedinfmaster.
c.
4.
1.
3eTPUChannelInterruptServiceRoutineThisinterrupt,whichisraisedeveryPWMperiodbythePWMMDCeTPUfunctionrunningoneTPUchannel7,ishandledbytheetpu_ch7_isrfunction.
ThisfunctioncallsfmasterRecorder,implementedinfmaster.
c,enablingtheconfigurationofapplicationvariabletimecourseswithaPWM-periodtimeresolution.
4.
1.
4FaultInterruptServiceRoutineTheover-currentfaultinterrupt,whichisraisedbyeMIOSinputfunctionrunningoneMIOSchannel10,ishandledbytheemios_isrfunction.
Thefollowingactionsareperformedinordertoswitchthemotoroff:ResettherequiredspeedDisablethegenerationofPWMsignalsSwitchtheFaultLEDonEnterAPP_STATE_MOTOR_FAULTSetFAULT_OVERCURRENT4.
1.
5eTPUGlobalExceptionInterruptServiceRoutineTheglobalexceptioninterruptishandledbytheetpu_globalexception_isrfunction.
Thefollowingsituationscancausethisinterruptassertion:MicrocodeGlobalExceptionisassertedIllegalInstructionFlagisassertedSCMMISCFlagisassertedThefollowingactionsareperformedinordertoswitchthemotoroff:ResettherequiredspeedDisablethegenerationofPWMsignalsEnterAPP_STATE_GLOBAL_FAULTBasedontheeTPUglobalexceptionsource,setFAULT_MICROCODE_GE,FAULT_ILLEGAL_INSTR,orFAULT_MISC.
4.
2ApplicationStateDiagramTheapplicationstatediagramconsistsofsevenstates(seeFigure15).
Afterreset,theapplicationgoesfirstlytoAPP_STATE_INIT.
WheretheON/OFFswitchisintheOFFposition,theAPP_STATE_STOPfollows,otherwisetheAPP_STATE_MOTOR_FAULTisenteredandtheON/OFFswitchmustbeturnedDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor20OFFtogetfromAPP_STATE_MOTOR_FAULTtoAPP_STATE_STOP.
ThenthecyclebetweenAPP_STATE_STOP,APP_STATE_ENABLE,APP_STATE_RUN,andAPP_STATE_DISABLEcanberepeated,dependingontheON/OFFswitchposition.
APP_STATE_ENABLEandAPP_STATE_DISABLEstatesareintroducedinordertoensurethesafetransitionsbetweentheAPP_STATE_STOPandAPP_STATE_RUNstates.
Wheretheover-currentfaultinterruptisraised(seeredlineonFigure15),theAPP_STATE_MOTOR_FAULTisentered.
ThisfaultisclearedbymovingtheON/OFFswitchtotheOFFpositionandthusenteringtheAPP_STATE_STOP.
WheretheeTPUglobalexceptioninterruptisraised(seegraylineonFigure15),theAPP_STATE_GLOBAL_FAULTisentered.
TheglobalfaultisclearedbymovingtheON/OFFswitchtotheOFFpositionandthusenteringtheAPP_STATE_INIT.
Figure15.
ApplicationStateDiagramThefollowingparagraphsdescribetheprocessingineachoftheapplicationstates.
4.
2.
1APP_STATE_INITThisstateispassedthroughonly.
Itisenteredeitherafterareset,oraftertheAPP_STATE_GLOBAL_FAULT.
Thefollowingactionsareperformedinordertoinitialize(re-initialize)theapplication:Callmy_system_etpu_initroutineforeTPUmoduleinitializationGeteTPUfunctionsDATARAMaddressesforFreeMASTERGettheaddressesofchannelconfigurationregistersforFreeMASTERON/OFFswitchmovedOFFAPP_STATE_ENABLEAPP_STATE_RUNAPP_STATE_MOTOR_FAULTAPP_STATE_DISABLEAPP_STATE_STOPresetAPP_STATE_INITON/OFFswitchmovedOFFON/OFFswitchmovedONAPP_STATE_GLOBAL_FAULTON/OFFswitchmovedOFFover-currentfaultinterruptSoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor21InitializeFreeMASTERCallmy_system_etpu_startroutineforeTPUStart.
Atthispoint,theCPUandtheeTPUruninparallel.
DependingontheON/OFFswitchposition,enterAPP_STATE_STOPorAPP_STATE_MOTOR_FAULT4.
2.
1.
1InitializationandStartofeTPUModuleTheeTPUmoduleisinitializedusingthemy_system_etpu_initfunction.
Later,afterinitializationofallotherperipherals,theeTPUisstartedbymy_system_etpu_start.
ThesefunctionsusethegeneraleTPUutilitiesandeTPUfunctionAPIroutines.
Boththemy_system_etpu_initandmy_system_etpu_startfunctions,includedindcmhscl1_etpu_gct.
cfile,aregeneratedbyeTPUGraphicalConfigurationTool.
TheeTPUGraphicalConfigurationToolcanbedownloadedfromhttp://www.
freescale.
com/webapp/sps/site/prod_summary.
jspcode=eTPU.
Formoreinformation,refertoReference16.
Themy_system_etpu_initfunctionfirstconfigurestheeTPUmoduleandmotorsettings.
Someofthesesettingsincludethefollowing:channelfiltermode=three-samplemodechannelfilterclock=etpuclkdiv64Theinputsignals(fromHallsensors)arefilteredbychannelfilters.
Thefiltersettingsguaranteefilteringallnoisepulsesuptoawidthof1usandpasspulsesfromawidthof1.
5us(at128MHzsystemclock).
TCR1source=etpuclkdiv2TCR1prescaler=1TheTCR1internaleTPUclockissettoitsmaximumrateof64MHz(at128MHzsystemclock),correspondingtothe16nsresolutionofgeneratedPWMsignals.
TCR2source=etpuclkdiv8TCR2prescaler=64TheTCR2internaleTPUclockissettoarateof250kHz(at128MHzsystemclock).
TheTCR2clocksettingsareoptimizedformotorspeedcalculationprecision.
Afterconfiguringthemoduleandenginesettings,themy_system_etpu_initfunctioninitializestheeTPUchannels.
Channel1-Halldecoder(HD)-PhaseAChannel2-Halldecoder(HD)-PhaseBChannel3-Halldecoder(HD)-PhaseCChannel5-speedcontroller(SC)Channel6-currentcontroller(CC)Channel7-PWMmasterforDCmotors(PWMMDC)Channel8-PWMfullrange(PWMF)-PhaseA-basechannelChannel10-PWMfullrange(PWMF)-PhaseB-basechannelDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor22Channel14-analogsensingforDCmotors(ASDC)TheseeTPUchannelsareinitializedbythefs_etpu_app_dcmhscl1_initeTPUapplicationAPIfunction(see4.
3).
Theapplicationsettingsareasfollows:—PWMphases-typeisfullrangecomplementarypairs—PWMfrequency20kHz—PWMdead-time1s—Motorspeedrange1400RPM—Motorspeedminimum50RPM—DC-busvoltage9V—Numberofmotorpolepairs8—MotorspeedcalculatedusingHDrevolutionperiod—Speedcontrollerupdatefrequency1250Hz—SpeedcontrollerPIparameters:P-gainis0.
256(0x0020C4*2-15),andI-gainis0.
005127(0x0000A8*2-15).
Thecontrollerparameterswereexperimentallytuned.
—Rampparameters:0.
3storampupfromzerotothemaximumspeed,0.
3storampdownfromthemaximumspeedtozero.
—CurrentcontrollerPIparameters:P-gainis25.
6(0x0CCCCC*2-15),andI-gainis0(0x000000*2-15).
Thecontrollerparameterswereexperimentallytuned.
—DC-buscurrentmeasurementrangeis14.
55A—ASDCfunctiontriggersA/Dconverteronhigh-lowedge—DC-buscurrentmeasurementtimeincludingA/DconversiontimeandDMAtransfertimeis11us—p_ASDC_result_queuepointercontainstheaddressofthemeasuredsampleofDC-buscurrent—MeasuredsampleofDC-buscurrentisshiftedleftby8bits—DC-buscurrentsampleoffsetwithinASDC_result_queueis0Themy_system_etpu_startfunctionfirstappliesthesettingsforthechannelinterruptenableandchanneloutputdisableoptions,thenenablestheeTPUtimers,thusstartingtheeTPU.
SoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor23Figure16.
eTPUConfigurationUsingtheeTPUGraphicalConfigurationTool4.
2.
1.
2InitializationofFreeMASTERCommunicationPriortotheFreeMASTERinitialization,itisnecessarytosetpointerstotheeTPUfunctionsDATARAMbasesandConfigurationRegisterbases.
Basedonthesepointers,whicharereadbyFreeMASTERduringtheinitialization,thelocationsofalleTPUfunctionparametersandConfigurationRegistersaredefined.
ThisisessentialforcorrectFreeMASTERoperation!
DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor24FreeMASTERconsistsofsoftwarerunningonaPCandonthemicroprocessor,connectedviaanRS-232serialport.
AsmallprogramresidentinthemicroprocessorcommunicateswiththeFreeMASTERonthePCinordertoreturnstatusinformationtothePC,andprocessescontrolinformationfromthePC.
ThemicroprocessorpartoftheFreeMASTERisinitializedbytwofunctions:iniFmasterUartandfmasterInit.
Bothfunctionsareincludedinfmaster.
c,whichautomaticallyinitializestheUARTdriverandinstallsallnecessaryservices.
4.
2.
2APP_STATE_STOPInthisstate,thePWMsignalsaredisabledandthemotorisoff.
Themotorshaftcanberotatedbyhand,whichenablestheusertoexplorethefunctionalityoftheHalldecoder(HD)eTPUfunction,towatchvariablesproducedbytheHD,andtoseeoptical,Hall-likesensorsignalsinFreeMASTER.
WhentheON/OFFswitchisturnedon,theapplicationgoesthroughAPP_STATE_ENABLEtoAPP_STATE_RUN.
4.
2.
3APP_STATE_ENABLEThisstateispassedthroughonly.
Thefollowingactionsareperformedinordertoswitchthemotordriveon:Resettherequiredspeed.
EnablethegenerationofPWMsignalsbycallingthefs_etpu_app_dcmhscl1_enableapplicationAPIroutine.
Thisroutinealsoperformsthemotoralignment.
IfthePWMphasesweresuccessfullyenabled,theeMIOSchannel10isconfiguredasinput,interruptonfallingedge,andAPP_STATE_RUNisentered.
WherethePWMphaseswerenotsuccessfullyenabled,theapplicationstatedoesnotchange.
4.
2.
4APP_STATE_RUNInthisstate,thePWMsignalsareenabledandthemotorison.
TherequiredmotorspeedcanbesetusingtheUpandDownbuttonsontheInterfaceorbyusingFreeMASTER.
ThelatestvalueisperiodicallywrittentotheeTPU.
WhentheON/OFFswitchisturnedoff,theapplicationgoesthroughAPP_STATE_DISABLEtoAPP_STATE_STOP.
4.
2.
5APP_STATE_DISABLEThisstateispassedthroughonly.
Thefollowingactionsareperformedinordertoswitchthemotordriveoff:ResettherequiredspeedDisablethegenerationofPWMsignalsIfPWMphasesweresuccessfullydisabled,APP_STATE_STOPisentered.
WherePWMphaseswerenotsuccessfullydisabled,theapplicationstateremainsthesame.
SoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor254.
2.
6APP_STATE_MOTOR_FAULTThisstateisenteredaftertheover-currentfaultinterruptserviceroutine.
TheapplicationwaitsuntiltheON/OFFswitchisturnedoff.
ThisclearsthefaultandtheapplicationenterstheAPP_STATE_STOP.
4.
2.
7APP_STATE_GLOBAL_FAULTThisstateisenteredaftertheeTPUglobalexceptioninterruptserviceroutine.
TheapplicationwaitsuntiltheON/OFFswitchisturnedoff.
ThisclearsthefaultandtheapplicationenterstheAPP_STATE_INIT.
4.
3eTPUApplicationAPITheeTPUapplicationAPIencapsulatesseveraleTPUfunctionAPIs.
TheeTPUapplicationAPIincludesCPUmethodswhichenableinitialization,control,andmonitoringofaneTPUapplication.
TheuseofeTPUapplicationAPIfunctionseliminatestheneedtoinitializeandseteacheTPUfunctionseparatelyandensurescorrectcooperationoftheeTPUfunctions.
TheeTPUapplicationAPIisdeviceindependentandhandlesonlytheeTPUtasks.
InordertoshortentheeTPUapplicationnames,abbreviatedapplicationnamesareintroduced.
Theabbreviationsinclude:Motortype(DCM=DCmotor,BLDCM=brushlessDCmotor,PMSM=permanentmagnetsynchronousmotor,ACIM=ACinductionmotor,SRM=switchedreluctancemotor,SM=steppermotor)Sensortype(H=Hallsensors,E=shaftencoder,R=resolver,S=sincos,X=sensorless)Controltype(OL=openloop,PL=positionloop,SL=speedloop,CL=currentloop,SVC=speedvectorcontrol,TVC=torquevectorcontrol)Basedonthesedefinitions,theDCMHSCL1isanabbreviationfor'DCMotorwithHallSensors,SpeedandCurrentClosedLoops'eTPUmotor-controlapplication.
AsthereareseveralDCmotorapplicationswithHallsensors,speedandcurrentclosedloops,thenumeral1denotesthefirstsuchapplicationinorder.
TheDCMHSCL1eTPUapplicationAPIisdescribedinthefollowingparagraphs.
Thereare5basicfunctionsaddedtotheDCMHSCL1applicationAPI.
Theroutinescanbefoundintheetpu_app_dcmhscl1.
c/.
hfiles.
AllDCMHSCL1applicationAPIroutineswillbedescribedinorderandarelistedbelow:Initializationfunction:int32_tfs_etpu_app_dcmhscl1_init(dcmhscl1_instance_t*dcmhscl1_instance,uint8_tPWM_master_channel,uint8_tPWM_phaseA_channel,uint8_tPWM_phaseB_channel,uint8_tHD_phaseA_channel,uint8_tHD_phaseB_channel,uint8_tHD_phaseC_channel,uint8_tSC_channel,DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor26uint8_tCC_channel,uint8_tASDC_channel,uint8_tPWM_phases_type,uint32_tPWM_freq_hz,uint32_tPWM_dead_time_ns,int32_tspeed_range_rpm,int32_tspeed_min_rpm,int32_tdc_bus_voltage_mv,uint8_tpole_pairs,uint8_tperiod_measured,uint32_tSC_freq_hz,int32_tSC_P_gain,int32_tSC_I_gain,uint32_tSC_ramp_time_ms,int32_tCC_P_gain,int32_tCC_I_gain,int32_tdc_bus_current_range_ma,uint8_tASDC_polarity,uint24_tASDC_measure_time_us,uint32_t*ASDC_result_queue,uint8_tASDC_bit_shift,uint8_tASDC_queue_offset,uint32_tASDC_filter_time_constant_us)Changeoperationfunctions:int32_tfs_etpu_app_dcmhscl1_enable(dcmhscl1_instance_t*dcmhscl1_instance,uint8_tsc_configuration,uint8_tcc_configuration)int32_tfs_etpu_app_dcmhscl1_disable(dcmhscl1_instance_t*dcmhscl1_instance)voidfs_etpu_app_dcmhscl1_set_speed_required(dcmhscl1_instance_t*dcmhscl1_instance,int32_tspeed_required_rpm)Valuereturnfunctions:voidfs_etpu_app_dcmhscl1_get_data(dcmhscl1_instance_t*dcmhscl1_instance,dcmhscl1_data_t*dcmhscl1_data)SoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor274.
3.
1int32_tfs_etpu_app_dcmhscl1_init(.
.
.
)ThisroutineisusedtoinitializetheeTPUchannelsfortheDCmotorwithspeedandcurrentclosedloopsapplication.
Thisfunctionhasthefollowingparameters:dcmhscl1_instance(dcmhscl1_instance_t*)-Thisisapointertodcmhscl1_instance_tstructure,whichisfilledbyfs_etpu_app_dcmhscl1_init.
Thisstructuremustbedeclaredintheuserapplication.
Wheretherearemoreinstancesoftheapplicationrunningsimultaneously,theremustbeaseparatedcmhscl1_instance_tstructureforeachone.
PWM_master_channel(uint8_t)-ThisisthePWMmasterchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
PWM_phaseA_channel(uint8_t)-ThisisthePWMphaseAchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
Inthecaseofcomplementarysignalgeneration(PWM_phases_type==FS_ETPU_APP_DCMHSCL1_COMPL_PAIRS),thecomplementarychannelisonechannelhigher.
PWM_phaseB_channel(uint8_t)-ThisisthePWMphaseBchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
Inthecaseofcomplementarysignalgeneration(PWM_phases_type==FS_ETPU_APP_DCMHSCL1_COMPL_PAIRS),thecomplementarychannelisonechannelhigher.
HD_phaseA_channel(uint8_t)-ThisistheHalldecoderphaseAchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
HD_phaseB_channel(uint8_t)-ThisistheHalldecoderphaseBchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
HD_phaseC_channel(uint8_t)-ThisistheHalldecoderphaseCchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
SC_channel(uint8_t)-Thisisthespeedcontrollerchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
CC_channel(uint8_t)-Thisisthecurrentcontrollerchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
ASDC_channel(uint8_t)-ThisistheanalogsensingforDCmotors(ASDC)channelnumber.
0-31forETPU_A,and64-95forETPU_B.
PWM_phases_type(uint8_t)-ThisparameterdeterminesthetypeofallPWMphases.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_DCMHSCL1_SINGLE_CHANNELS,orFS_ETPU_APP_DCMHSCL1_COMPL_PAIRS.
PWM_freq_hz(uint32_t)-ThisisthePWMfrequencyinHz.
PWM_dead_time_ns(uint32_t)-ThisisthePWMdead-timeinns.
speed_range_rpm(int32_t)-Thisisthemaximummotorspeedinrpm.
speed_min_rpm(int32_t)-Thisistheminimum(measurable)motorspeedinrpm.
dc_bus_voltage_mv(int32_t)-ThisistheDC-busvoltageinmV.
pole_pairs(uint8_t)-Thisisthenumberofmotorpole-pairs.
DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor28period_measured(uint8_t)-Thisoptiondefinesthetypeofperiodmeasurementforspeedcalculation.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_DCMHSCL1_REV_PERIOD,orFS_ETPU_APP_DCMHSCL1_SECTOR_PERIOD.
SC_freq_hz(uint32_t)-ThisisthespeedcontrollerupdatefrequencyinHz.
TheassignedvaluemustbeequaltothePWM_freq_hzdividedby1,2,3,4,5,.
.
.
SC_P_gain(fract24_t)-ThisisthespeedcontrollerP-gainin24-bitsignedfractionalformat(9.
15).
0x008000correspondsto1.
00x000001correspondsto0.
0000305(30.
5*10-6)0x7FFFFFcorrespondsto255.
9999695SC_I_gain(fract24_t)-ThisisthespeedcontrollerI-gainin24-bitsignedfractionalformat(9.
15).
0x008000correspondsto1.
00x000001correspondsto0.
0000305(30.
5*10-6)0x7FFFFFcorrespondsto255.
9999695SC_ramp_time_ms(uint32_t)-Thisparameterdefinestherequiredspeedramptimeinms.
Astepchangeoftherequiredspeedfrom0tospeed_range_rpmissloweddownbytheramptotakethedefinedtime.
CC_P_gain(fract24_t)-ThisisthecurrentcontrollerP-gainin24-bitsignedfractionalformat(9.
15).
0x008000correspondsto1.
00x000001correspondsto0.
0000305(30.
5*10-6)0x7FFFFFcorrespondsto255.
9999695CC_I_gain(fract24_t)-ThisisthecurrentcontrollerI-gainin24-bitsignedfractionalformat(9.
15).
0x008000correspondsto1.
00x000001correspondsto0.
0000305(30.
5*10-6)0x7FFFFFcorrespondsto255.
9999695dc_bus_current_range_ma(int32_t)-ThisistheDC-buscurrentmeasurementrangeinmA.
ASDC_polarity(uint8_t)-ThisisthepolaritytoassigntotheASDCfunction.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_DCMHSCL1_ASDC_PULSE_HIGHorFS_ETPU_APP_DCMHSCL1_ASDC_PULSE_LOW.
ASDC_measure_time_us(uint24_t)-Timefromthefirst(triggering)edgetothesecondedge,atwhichtheresultqueueissupposedtobereadyintheDATA_RAM(inus).
ThisvaluedependsontheA/DconversiontimeandDMAtransfertime.
ASDC_result_queue(uint32_t*)-Pointertotheresultqueue.
Resultqueueisanarrayof16-bitwordsthatcontainsthemeasuredvalues.
ASDC_bit_shift(uint8_t)-Thisparameterdefineshowtoaligndatafromtheresultqueueintofract24(orint24).
Thisparametershouldbeassignedavaluesof:FS_ETPU_APP_DCMHSCL1_ASDC_SHIFT_LEFT_BY_8,SoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor29FS_ETPU_APP_DCMHSCL1_ASDC_SHIFT_LEFT_BY_10,FS_ETPU_APP_DCMHSCL1_ASDC_SHIFT_LEFT_BY_12,orFS_ETPU_APP_DCMHSCL1_ASDC_SHIFT_LEFT_BY_16.
ASDC_queue_offset(uint8_t)-PositionoftheI_DC_BUSsampleintheresultqueue.
Offsetisdefinedinbytes.
ASDC_filter_time_constant_us(uint32_t)-ThisthetimeconstantofthefilterwhichapplieswhenprocessingtheI_DC_BUSsamples,inus.
4.
3.
2int32_tfs_etpu_app_dcmhscl1_enable(.
.
.
)ThisroutineisusedtoenablethegenerationofPWMsignalsandtostartspeedandcurrentcontrollers.
Thisfunctionhasthefollowingparameters:dcmhscl1_instance(dcmhscl1_instance_t*)-Thisisapointertodcmhscl1_instance_tstructure,whichisfilledbyfs_etpu_app_dcmhscl1_init.
sc_configuration(uint8_t)-ThisistherequiredconfigurationoftheSC.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_DCMHSCL1_SPEED_LOOP_OPENED,orFS_ETPU_APP_DCMHSCL1_SPEED_LOOP_CLOSED.
cc_configuration(uint8_t)-ThisistherequiredconfigurationoftheCC.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_DCMHSCL1_CURRENT_LOOP_OPENED,orFS_ETPU_APP_DCMHSCL1_CURRENT_LOOP_CLOSED.
4.
3.
3int32_tfs_etpu_app_dcmhscl1_disable(dcmhscl1_instance_t*dcmhscl1_instance)ThisroutineisusedtodisablethegenerationofPWMsignalsandtostopspeedandcurrentcontrollers.
Thisfunctionhasthefollowingparameter:dcmhscl1_instance(dcmhscl1_instance_t*)-Thisisapointertodcmhscl1_instance_tstructure,whichisfilledbyfs_etpu_app_dcmhscl1_init.
4.
3.
4voidfs_etpu_app_dcmhscl1_set_speed_required(.
.
.
)Thisroutineisusedtosettherequiredmotorspeed.
Thisfunctionhasthefollowingparameters:dcmhscl1_instance(dcmhscl1_instance_t*)-Thisisapointertodcmhscl1_instance_tstructure,whichisfilledbyfs_etpu_app_dcmhscl1_init.
speed_required_rpm(int32_t)-Thisistherequiredmotorspeedinrpm.
DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor304.
3.
5voidfs_etpu_app_dcmhscl1_get_data(.
.
.
)Thisroutineisusedtogettheapplicationstatedata.
Thisfunctionhasthefollowingparameters:dcmhscl1_instance(dcmhscl1_instance_t*)-Thisisapointertodcmhscl1_instance_tstructure,whichisfilledbyfs_etpu_app_dcmhscl1_init.
dcmhscl1_data(dcmhscl1_data_t*)-Thisisapointertodcmhscl1_data_tstructureofapplicationstatedata,whichisupdated.
4.
4eTPUBlockDiagramTheeTPUfunctionsusedtodrivetheDCmotorwithspeedandcurrentclosedloopsarelocatedinthemotor-controlsetofeTPUfunctions(set3-DCmotors).
TheeTPUfunctionswithinthesetserveasbuildingblocksforvariousmotor-controlapplications.
Thefollowingparagraphsdescribethefunctionalityofeachblock.
Figure17.
BlockDiagramofeTPUProcessing4.
4.
1PWMGenerator(PWMMDC+PWMF)ThegenerationofPWMsignalsformotor-controlapplicationswitheTPUisprovidedbythreeeTPUfunctions:PWM-MasterforDCMotors(PWMMDC)PWM-FullRange(PWMF)PWM-Commuted(PWMC)ThePWMMasterforDCMotors(PWMMDC)functioncalculatesaPWMdutycycleandupdatesthethreePWMphases.
ThephasesmaybedriveneitherbythePWMFullRange(PWMF)function,whichenablesafull(0%to100%)duty-cyclerange,orbythePWMCommuted(PWMC)function,whichenablesswitchingthephaseONandOFF.
ThePWMFfunctionisusedinthedescribedapplication.
PWMFASDCSCrequiredspeedrequiredcurrentADCTriggerDC-buscurrentCPUeTPUHardwareMotorInverterCCPWMMDCappliedvoltageduty-cyclesFaultfaultinterruptOutputDisableHDrevolutionperiodHallSensorsEMIOSSoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor31ThePWMFfunctiongeneratesthePWMsignals.
ThePWMMDCfunctioncontrolstwoPWMFfunctions,twoPWMphases,anddoesnotgenerateanydrivesignal.
ThePWMMDCcanbeexecutedevenonaneTPUchannelnotconnectedtoanoutputpin.
Figure18.
FunctionalityofPWMMDC+PWMFFormoredetailsaboutthePWMMDC,PWMF,andPWMCeTPUfunctions,refertoReference12.
4.
4.
2HallDecoder(HD)TheHalldecodereTPUfunctionisintendedtoprocesssignalsgeneratedbyHallsensorsinmotioncontrolsystems.
TheHDfunctionusesthreeadjacenteTPUchannelsconfiguredasinputs.
TheHDfunctioncalculatesthefollowingparametersfortheCPU:Sector-determinesthepositionofthemotionsysteminoneofthesectors.
Direction-determinesthedirectionofthemotionsystem.
Adirectionvalue0meansapositive(incremental)direction,othervaluesmeananegative(decremental)direction.
Revolutioncounter-determinesthenumberofmotionsystemelectricalrevolutions.
Therevolutioncounterisincrementedordecrementedoneachrevolution,basedonthecurrentdirection.
Revolutionperiod-determinestheTCRtimeofthelastrevolution.
Theparametervalueisupdatedeachtimethesectorischanged.
Therevolutionperiodismeasuredfromthelastedgeofasimilartype(low-high/high-low),onthesamechannel,tothecurrentedge.
Sectorperiod-determinestheTCRtimebetweenthelasttwochangesofthesector.
Theparametervalueisupdatedeachtimethesectorischanged.
Thesectorperiodismeasuredfromthelastedgetothecurrentedge.
Lastedgetime-storestheTCRtimeofthelastincomingedge.
PWMMDCupdateupdateperiodapplied_voltagePWMFpolarity:active-highORactive-lowvariablePWMperiodscenter-alignedORedge-alignedsinglechannelORcomplementarypairPWMFupdatenoupdatenoupdatenewinputvaluesnewinputvaluesDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor32Figure19.
FunctionalityofHDFormoredetailsabouttheHDeTPUfunction,refertoReference10.
4.
4.
3SpeedController(SC)ThespeedcontrollereTPUfunctionisnotintendedtoprocessinputoroutputsignals.
ItspurposeistocontrolanothereTPUfunction'sinputparameter.
TheSCfunctioncanbeexecutedevenonaneTPUchannelnotconnectedtoanoutputpin.
TheSCfunctionincludesageneralPIDcontrolleralgorithm.
Thecontrollercalculatesitsoutputbasedontwoinputs:ameasuredvalueandarequiredvalue.
Themeasuredvalue(theactualmotorspeed)iscalculatedbasedoninputsprovidedbytheHDfunction.
Therequiredvalueisanoutputofthespeedramp,whoseinputisaSCfunctionparameter,andcanbeprovidedbytheCPUoranothereTPUfunction.
Inthemotor-controleTPUfunctionset,thisfunctionmostlyprovidesthespeedouter-loop.
Figure20.
FunctionalityofSCFormoredetailsabouttheSCeTPUfunction,refertoReference11.
directionHDsectorrevolution_periodsector_periodrevolution_counteromega_actualomega_rampomega_desiredapplied_voltageSCtimerequested_valuePIcontrollerrampperiodrevolution_periodomega_actualscaling_factorsector_periodSoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor334.
4.
4CurrentController(CC)ThecurrentcontrollereTPUfunctionisnotintendedtoprocessinputoroutputsignals.
ItspurposeistocontrolanothereTPUfunction'sinputparameter.
TheCCfunctioncanbeexecutedevenonaneTPUchannelnotconnectedtoanoutputpin.
TheCCfunctionincludesageneralPIDcontrolleralgorithm.
Thecontrollercalculatesitsoutputbasedontwoinputs:ameasuredvalue,andadesiredvalue.
Themeasuredvalue(theactualDC-buscurrent)isusuallyprovidedbytheanalogsensingforDCmotors(ASDC)function,thatpreprocessesthemeasuredanalogvalues.
ThedesiredvalueisaCCfunctionparameter,andcanbeprovidedbytheCPUoranothereTPUfunction.
Inthemotor-controleTPUfunctionset,thisfunctionmostlyprovidesthecurrentclosedloop.
Figure21.
FunctionalityofCCFormoredetailsabouttheCCeTPUfunction,refertoReference13.
4.
4.
5AnalogSensingforDCMotors(ASDC)TheanalogsensingforDCmotorseTPUfunction(ASDC)isusefulforpreprocessinganalogvaluesthataremeasuredbytheADconverterandtransferredtotheeTPUdatamemorybyDMAtransfer.
TheASDCfunctionisalsousefulfortriggeringtheADconverterandsynchronizingothereTPUfunctions.
AlltheabovementionedASDCfeaturesareutilizedintheapplication.
TheASDCisinitializedtoruninPWMsynchronizedmode,e.
g.
thefirstASDCedgeissynchronizedwiththebeginningofthePWMperiod.
Simultaneously,theASDCmanagestosynchronizetheSCfunction(outerloopcontroller)bygeneratingthelinktotheSCchannelevery16thASDCperiodandtosynchronizetheCCfunction(interloopcontroller)bygeneratingthelinktotheCCchanneleveryASDCperiod.
TheASDCfunctionpreprocessestheDC-buscurrentanalogvalueandpassestheadjustedvalueasaninputtotheCCfunction.
ProcessingoftheDC-buscurrentanalogvalueincludesbitshiftingandfiltering.
I_actualI_desiredappliedvoltageCCI_desiredPIcontrollerDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor34Figure22.
FunctionalityofASDCInordertoensureperiodicsamplingoftheDC-busvoltageandthequicktransferofthemeasureddatafromtheADconvertertotheETPUDATARAM,severalperipheralmodulesareused:AninternalanalogtodigitalconverterisusedforsamplingoftheDC-buscurrentanalogvalue.
3directmemoryaccess(DMA)channelsareusedasfollows:—DMAchannel0isusedforthetransferoftheconfigurationword(0x80000000)fromeqadcCQueue0totheCFPR(CFIFOPushRegister)oftheeQADCmodule.
ThisoperationtriggerstheeQADCconvertersampling.
TheDMAchannel0transferisinitiatedbyaDMArequestgeneratedbyDMAchannel30.
—DMAchannel1isusedforthetransferoftheresultfromtheRFPR(resultFIFOpopregister)totheeTPUmemorywherepointsp_ASDC_result_queuepointer.
TheDMAchannel30transferisinitiatedbyaDMArequestgeneratedbyQADCmoduleaftertheconversionisfinished.
—DMAchannel30isusedforthetransferoftheconfigurationword(0x0410)totheCFCR(commandFIFOcontrolregister).
ThissetthestartbitandtheQADCsinglescanmode.
TheDMAchannel30transferisinitiatedbyaDMArequestgeneratedbyeTPU_Achannel14.
Whenthetransferiscomplete,thelinktoDMAchannel0ismadeAllsettingismadeusingtheQuickStartConfigurationTool,refertoReference3.
ASDCADCresultqueuePre-processedanalogvaluesDMAtransferADconverterAbBADCtriggerADCtriggerADCtriggerlinktoouterloopcontrollerlinktoinnerloopcontrollerlinktoinnerloopcontrollerafilterfilterbitshiftbitshift-offset-offsetsignswitchsignswitchSoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor354.
5eTPUTimingeTPUprocessingisevent-driven.
Onceaneventservicebegins,itsexecutioncannotbeinterruptedbyanothereventservice.
Theothereventserviceshavetowait,whichcausesaservicerequestlatency.
Themaximumservicerequestlatency,orworstcaselatency(WCL),differsforeacheTPUchannel.
TheWCLisaffectedbythechannelpriorityandactivityonotherchannels.
TheWCLofeachchannelmustbekeptbelowarequiredlimit.
Forexample,theWCLofthePWMFchannelsmustbelowerthanthePWMperiod.
AtheoreticalcalculationofWCLs,foragiveneTPUconfiguration,isnotatrivialtask.
ThemotorcontroleTPUfunctionsintroduceadebuggingfeaturethatenablestheusertocheckchannellatenciesusinganoscilloscope,andeliminatesthenecessityoftheoreticalWCLcalculations.
Asmentionedearlier,someeTPUfunctionsarenotintendedtoprocessanyinputoroutputsignalsfordrivingthemotor.
Thesefunctionsturntheoutputpinhighandlow,sothatthehigh-timeidentifiestheperiodoftimeinwhichthefunctionexecutionisactive.
Anoscilloscopecanbeusedtodeterminehowmuchthechannelactivitypulsevariesintime,whichindicatesthechannelservicelatencyrange.
Forexample,whentheoscilloscopetimebaseissynchronizedwiththePWMperiods,thebehaviorofatestedchannelactivitypulsecanbedescribedbyoneofthefollowingcases:ThepulseisasynchronouswiththePWMperiods.
ThismeansthatthetestedchannelactivityisnotsynchronizedwiththePWMperiods.
ThepulseissynchronouswiththePWMperiodsandstable.
ThismeansthatthetestedchannelactivityissynchronouswiththePWMperiodsandisnotdelayedbyanyservicelatency.
ThepulseissynchronouswiththePWMperiodsbutitspositionvariesintime.
ThismeansthatthetestedchannelactivityissynchronouswiththePWMperiodsandtheservicelatencyvariesinthistimerange.
DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor36Figure23.
OscilloscopeScreenshotandExplanationofPWMMDCTimingFigure23andFigure24explaintheapplicationeTPUtiming.
Theoscilloscopescreen-shotsdepictatypicalsituationdescribedbelow.
AliveviewontheoscilloscopescreenenablestheusertoseethevariationofSC,CCandPWMMDCactivitypulses,whichdeterminesthechannelservicelatencyranges.
InFigure23,signals2(cyan)and3(pink)arePWMsignalsofonephase.
Itisacomplementarypairofcentre-alignedPWMsignals.
Thebasechannel(2)isofactive-highpolarity,whilethecomplementarychannel(3)isactive-low.
ThePWMperiodis50s,whichcorrespondstoaPWMfrequencyof20kHz.
Signal2(cyan)isgeneratedbythePWMmasterforDCmotors(PWMMDC)eTPUfunction.
ItspulsesdeterminetheactivityofthePWMMDC.
ThenarrowPWMMDCpulsesoccuraftereachCCactivityandtheydeterminetheservicetimeofanCCrequesttoupdatethenewvalueofappliedmotorvoltage.
ThewidepulsesoccureachPWMperiodandtheydeterminethePWMupdate.
AnewvalueofappliedmotorvoltageisprocessedduringthePWMupdate.
Thefs_etpu_pwmmdc_init_3phfunctionparameterupdate_timeenablestheusertoadjustthepositionofthePWMupdatepulserelativetothePWMperiodframe.
Theactivitypulsehasascheduledupdate_timepriortotheendoftheperiodframe,sothattheupdateisfinishedbytheendoftheperiodframe,evenintheworstcaselatency.
Reference12describeshowtosettheupdate_timevalue.
PWMMDCupdatesPWMperiodsPWMFPWMFPWMMDClinksfromCCSoftwareDesignDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor37Figure24.
OscilloscopeScreenshotandExplanationofASDC,SC,andCCTimingFigure24explainsthetimingofASDC,SC,andCCeTPUfunctions.
Signal4(green)isthePWMsignalofonebasechannel,asinFigure23.
Signal3(pink)isgeneratedbytheASDCeTPUfunction.
TheASDCfunctiontriggerstheADconverterbygeneratingaDMArequestonahigh-lowedge(activelowpolarityofASDC)andsimultaneouslysendingthelinktotheSCchannelevery16thASDCperiod(seeFigure24).
ThepositionoftheASDCfirstedgeissynchronizedwiththebeginningofthePWMperiod.
ThetimebetweenthePWMperiodbeginningandtheASDCfirstedgeequalstoone-quarterofthePWMperiod.
TheASDCpulsewidthdeterminesthetimenecessarytosampletheDC-buscurrentandtotransferthissampledvaluetotheeTPUdatamemory.
ASDCstartsmeasuredsamplepreprocessingatthetimeofthesecondedgewhenasampleissupposedtobereadyintheeTPUdatamemory.
ImmediatelyaftertheDC-buscurrentsamplepreprocessing,ASDCfunctionsendsthelinktotheCCchanneltostartPIcontrollercalculation.
ThiswaytheCCsynchronizationisensured.
Signal2(cyan)isgeneratedbythespeedcontroller(SC)eTPUfunction.
ItspulsesdeterminetheactivityoftheSC.
ThepulsewidthdeterminesthetimenecessarytocalculatethemotorspeedfromarevolutionPWMperiodsCCperiodCCSCPWMFASDCASDCedge_offsetCCactivitySCactivityDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1ImplementationNotesFreescaleSemiconductor38periodmeasuredbytheHalldecoder(HD),calculatetherequiredspeedramp,andapplytheSC-PIcontrolleralgorithm.
TheSCoutput-thenewvalueofdesiredcurrent-ispassedtothecurrentcontroller.
Thiscalculationisperformedperiodicallyata1250Hzrate,whichisevery16thPWMperiod.
Signal1(blue)isgeneratedbythecurrentcontroller(CC)eTPUfunction.
ItspulsesdeterminetheactivityoftheCC.
ThepulsewidthdeterminesthetimenecessarytoapplytheCC-PIcontrolleralgorithm.
TheCCoutput-thenewvalueofappliedmotorvoltage-ispassedtothePWMgenerator.
Thiscalculationisperformedperiodicallyata20kHzrate,whichiseveryPWMperiod.
ThesignalsfromtheopticalsensorscomeasynchronouslywiththePWMperiods.
TheHalldecoder(HD)eTPUfunctionprocessesthesesignalstransitionsandprovidesthecalculateddatatothespeedcontrollereTPUfunction.
5ImplementationNotes5.
1ScalingofQuantitiesTheDCmotorcontrolalgorithmrunningoneTPUusesa24-bitfractionalrepresentationforallrealquantitiesexcepttime.
The24-bitsignedfractionalformatisrepresentedusing1.
23format(1signbit,23fractionalbits).
Themostnegativenumberthatcanberepresentedis-1.
0,whoseinternalrepresentationis0x800000.
Themostpositivenumberis0x7FFFFFor1.
0-2-23.
Thefollowingequationshowstherelationshipbetweenrealandfractionalrepresentations:where:FractionalValueisafractionalrepresentationoftherealvalue[fract24]RealValueistherealvalueofthequantity[V,A,RPM,etc.
]RealQuantityRangeisthemaximalrangeofthequantity,definedintheapplication[V,RPM,etc.
]5.
1.
1PIControllerParametersThePIcontrollerparametersaresetina32-bitextendedfractionalformat9.
23.
Thisformatenablestheusertosetvaluesintherangeof-256.
0to256.
0-2-23.
Internally,theparametervalueistransformedintooneoftwo24-bitformats,either9.
15,or1.
23,basedonthevalue.
5.
2SpeedCalculationThespeedcontroller(SC)eTPUfunctioncalculatestheangularmotorspeedusingpc_scandlast_edgeparametersoftheQDeTPUfunction.
Thefollowingequationapplies:FractionalValueRealValueRealQuatityRange-=omega_actualposition_differencetime_difference-scaling_factor=MicroprocessorUsageDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor39where:omega_actual[fract24]istheactualangularspeedasafractionofthemaximumspeedrangeposition_difference[int24]isthedifferencebetweentheupdatedvalueofQDpositioncounterandthepreviousvalue,whichwascapturedbySCinthepreviousSCperiod.
Infacttheposition_differenceisreadablefrompc_scparameteroftheQDfunction.
AfterSCreadsthenewupdatedvalueitresetsthispc_scparameterswhichensuresthattheposition_differenceisavailableinthepc_scparameternexttimeSCreadsit.
time_difference[int24]isthedifferencebetweentheupdatedvalueofQDlast_edgeandthepreviousvalue,whichwascapturedbySCinthepreviousSCperiodscaling_factorispre-calculatedusingthefollowingequation:where:etpu_tcr_freq[Hz]isafrequencyoftheinternaleTPUtimer(TCR1orTCR2)usedomega_max[RPM]isamaximalspeedrangepc_per_revisanumberofQDpositioncounterincrementsperonerevolutionTheinternaleTPUtimer(TCR1orTCR2)frequencymustbesetsothatthecalculationofomega_actualbothfitsintothe24-bitsarithmeticanditsresolutionissufficient.
6MicroprocessorUsageTable2showshowmuchmemoryisneededtoruntheapplication.
TheeTPUmoduleusageintermsoftimeloadcanbeeasilydeterminedbasedonthefollowingfacts:AccordingtoReference12,themaximumeTPUloadproducedbyPWMgenerationis946eTPUcyclesperonePWMperiod.
ThePWMfrequencyissetto20kHz,thusthePWMperiodis3750AccordingtoReference11,thespeedcontrollercalculationtakes232eTPUcycles.
Thecalculationisperformedevery16thPWMperiod.
AccordingtoReference10,theprocessingofoneHallsignaltransitiontakes56eTPUcycles.
TheHallsignaltransitionscomeasynchronouslytothePWMperiods.
Sixtransitionsareprocessedperoneelectricalmotorrevolution.
Table2.
MemoryUsageinBytesMemoryAvailableUsedFLASH2M33116RAM64K3460eTPUcodeRAM16K6120eTPUdataRAM3K632scaling_factor30256etpu_tcr_freqomega_maxpc_per_rev=DCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1SummaryandConclusionsFreescaleSemiconductor40AccordingtoReference14,theASDCmaximumeTPUloadtakes42+80eTPUcycles(boththefirstandthenthesecondedgeprocessingisperformed).
TheASDCfunctionprocessingisexecutedeveryPWMperiod.
AccordingtoReference13,thecurrentcontrollercalculationtakes138eTPUcycles.
ThecalculationisperformedeveryPWMperiod.
ThevaluesofeTPUloadbyeachofthefunctionsareinfluencedbycompilerefficiency.
Theabovenumbersaregivenforguidanceonlyandaresubjecttochange.
Foruptodateinformation,refertotheinformationprovidedinthelatestreleaseavailablefromFreescale.
ThevaluesofeTPUloadbyeachofthefunctionsareinfluencedbycompilerefficiency.
Theabovenumbersaregivenforguidanceonlyandaresubjecttochange.
Foruptodateinformation,refertotheinformationprovidedinthelatestreleaseavailablefromFreescale.
ThepeakoftheeTPUtimeloadoccurswhenthespeedcontrollercalculation,thecurrentcontrollercalculation,ASDCprocessing,andaHallsignaltransitionareprocessedwithinonePWMperiod.
Thispeakvaluemustbekeptbelow100%,whichensuresthatallprocessingfitsintothePWMperiod,noservicelatencyislongerthanthePWMperiod,andthusthegeneratedPWMsignalsarenotaffected.
Table3showstheeTPUmoduletimeloadinseveraltypicalsituations.
7SummaryandConclusionsThisapplicationnoteprovidestheuserwithadescriptionofthedemoapplicationDCmotorwithspeedandcurrentclosedloop.
TheapplicationalsodemonstratesusageoftheeTPUmoduleonthePowerPCMPC5554,whichresultsinaCPUindependentmotordrive.
Lastly,thedemoapplicationistargetedattheMPC5554familyofdevices,butitcouldbeeasilyreusedwithanydevicethathasaneTPU.
Table3.
eTPUTimeLoadSituationAverageTimeLoad[%]PeakTimeLoadWithinPWMPeriod[%]MotorSpeed100RPM30.
1037.
39MotorSpeed1000RPM30.
1237.
39ReferencesDCMotorwithSpeedandCurrentClosedLoops,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor418ReferencesTable4.
References1.
MPC5554ReferenceManual,MPC5554RM2.
MPC5554DEMOUser'sManual,MPC5554DEMOEVBUM3.
MPC5550QuickStartUser'sManual4.
InterfaceBoardwithUNI-3User'sManual5.
33395EvaluationMotorBoardDesignerReferenceManualDRM33395/D6.
MCG'sMotorsweb:http://www.
mcg-net.
com7.
QuadratureEncoderHEDS-5640A06distributor'sweb:http://www.
agilent.
com/semiconductors8.
FreeMASTERwebpage,http://www.
freescale.
com,searchkeyword"FreeMASTER"9.
EnhancedTimeProcessingUnitReferenceManual,ETPURM10.
"UsingtheHallDecoder(HD)eTPUFunction,"AN284111.
"UsingtheSpeedController(SC)eTPUFunction,"AN284312.
"UsingtheDCMotorControlPWMeTPUFunctions,"AN248013.
"UsingtheCurrentController(CC)eTPUFunction,"AN284414.
"UsingtheAnalogSensingforDCMotors(ASDC)eTPUFunction,"AN284615.
"UsingtheDCMotorControleTPUFunctionSet(set3),"AN295816.
eTPUGraphicalConfigurationTool,http://www.
freescale.
com,searchkeyword"ETPUGCT"17.
DSP56F80xMCPWMModuleinMotorControlApplications,AN1927HowtoReachUs:HomePage:www.
freescale.
comE-mail:support@freescale.
comUSA/EuropeorLocationsNotListed:FreescaleSemiconductorTechnicalInformationCenter,CH3701300N.
AlmaSchoolRoadChandler,Arizona85224+1-800-521-6274or+1-480-768-2130support@freescale.
comEurope,MiddleEast,andAfrica:FreescaleHalbleiterDeutschlandGmbHTechnicalInformationCenterSchatzbogen781829Muenchen,Germany+441296380456(English)+46852200080(English)+498992103559(German)+33169354848(French)support@freescale.
comJapan:FreescaleSemiconductorJapanLtd.
HeadquartersARCOTower15F1-8-1,Shimo-Meguro,Meguro-ku,Tokyo153-0064,Japan0120191014or+81354379125support.
japan@freescale.
comAsia/Pacific:FreescaleSemiconductorHongKongLtd.
TechnicalInformationCenter2DaiKingStreetTaiPoIndustrialEstateTaiPo,N.
T.
,HongKong+80026668080support.
asia@freescale.
comForLiteratureRequestsOnly:FreescaleSemiconductorLiteratureDistributionCenterP.
O.
Box5405Denver,Colorado802171-800-441-2447or303-675-2140Fax:303-675-2150LDCForFreescaleSemiconductor@hibbertgroup.
comInformationinthisdocumentisprovidedsolelytoenablesystemandsoftwareimplementerstouseFreescaleSemiconductorproducts.
Therearenoexpressorimpliedcopyrightlicensesgrantedhereundertodesignorfabricateanyintegratedcircuitsorintegratedcircuitsbasedontheinformationinthisdocument.
FreescaleSemiconductorreservestherighttomakechangeswithoutfurthernoticetoanyproductsherein.
FreescaleSemiconductormakesnowarranty,representationorguaranteeregardingthesuitabilityofitsproductsforanyparticularpurpose,nordoesFreescaleSemiconductorassumeanyliabilityarisingoutoftheapplicationoruseofanyproductorcircuit,andspecificallydisclaimsanyandallliability,includingwithoutlimitationconsequentialorincidentaldamages.
"Typical"parametersthatmaybeprovidedinFreescaleSemiconductordatasheetsand/orspecificationscananddovaryindifferentapplicationsandactualperformancemayvaryovertime.
Alloperatingparameters,including"Typicals",mustbevalidatedforeachcustomerapplicationbycustomer'stechnicalexperts.
FreescaleSemiconductordoesnotconveyanylicenseunderitspatentrightsnortherightsofothers.
FreescaleSemiconductorproductsarenotdesigned,intended,orauthorizedforuseascomponentsinsystemsintendedforsurgicalimplantintothebody,orotherapplicationsintendedtosupportorsustainlife,orforanyotherapplicationinwhichthefailureoftheFreescaleSemiconductorproductcouldcreateasituationwherepersonalinjuryordeathmayoccur.
ShouldBuyerpurchaseoruseFreescaleSemiconductorproductsforanysuchunintendedorunauthorizedapplication,BuyershallindemnifyandholdFreescaleSemiconductoranditsofficers,employees,subsidiaries,affiliates,anddistributorsharmlessagainstallclaims,costs,damages,andexpenses,andreasonableattorneyfeesarisingoutof,directlyorindirectly,anyclaimofpersonalinjuryordeathassociatedwithsuchunintendedorunauthorizeduse,evenifsuchclaimallegesthatFreescaleSemiconductorwasnegligentregardingthedesignormanufactureofthepart.
FreescaleandtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.
Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.
FreescaleSemiconductor,Inc.
2004.
Allrightsreserved.
AN3008Rev.
105/2006
819云互联 在本月发布了一个购买香港,日本独立服务器的活动,相对之前的首月活动性价比更高,最多只能享受1个月的活动 续费价格恢复原价 是有些颇高 这次819云互联与机房是合作伙伴 本次拿到机房 活动7天内购买独立服务器后期的长期续费价格 加大力度 确实来说这次的就可以买年付或者更长时间了…本次是5个机房可供选择,独立服务器最低默认是50M带宽,不限制流量,。官网:https://ww...
virmach送来了夏季促销,价格低到爆炸,而且在低价的基础上还搞首年8折,也就是说VPS低至7.2美元/年。不过,这里有一点要说明:你所购买的当前的VPS将会在09/30/2021 ~ 04/30/2022进行服务器转移,而且IP还会改变,当前的Intel平台会换成AMD平台,机房也会变动(目前来看以后会从colocrossing切换到INAP和Psychz),采取的是就近原则,原来的水牛城可能...
弘速云怎么样?弘速云是创建于2021年的品牌,运营该品牌的公司HOSU LIMITED(中文名称弘速科技有限公司)公司成立于2021年国内公司注册于2019年。HOSU LIMITED主要从事出售香港vps、美国VPS、香港独立服务器、香港站群服务器等,目前在售VPS线路有CN2+BGP、CN2 GIA,该公司旗下产品均采用KVM虚拟化架构。可联系商家代安装iso系统。点击进入:弘速云官方网站地址...
46sw.com为你推荐
多家五星酒店回应网传名媛拼单拼多多商家出钱叫买家好评会被处罚吗硬盘的工作原理硬盘的工作原理?是怎样存取数据的?云计算什么是云计算?www.20ren.com求此欧美艳星名字http://www.sqsmm.com/index.php?album-read-id-1286.html8090lu.com《8090》节目有不有高清的在线观看网站啊?www.se222se.com请问http://www.dibao222.com这个网是做什么dadi.tv电视机如何从iptv转换成tv?pp43.com登录www.bdnpxzl.com怎么进入网站后台啊汴京清谈汴京还被称为什么?m.yushuwu.com至尊影视网www.xuexiyu.com 怎么只收录首页啊
成都主机租用 arvixe bandwagonhost 香港机房 缓存服务器 发包服务器 gg广告 毫秒英文 工作站服务器 江苏双线服务器 免费外链相册 群英网络 稳定空间 zcloud ncp alexa世界排名 windowsserverr2 认证机构 傲盾代理 paypal登陆 更多