immediately46sw.com

46sw.com  时间:2021-04-08  阅读:()
FreescaleSemiconductor,Inc.
,2006.
Allrightsreserved.
FreescaleSemiconductorApplicationNoteAN3007Rev.
1,05/2006TableofContentsThisapplicationnotedescribesthedesignofa3-phaseBrushlessDC(BLDC)motordrivebasedonFreescale'sPowerPCMPC5554microcontroller.
TheapplicationdesigntakesadvantageoftheEnhancedTimeProcessingUnit(eTPU)module,whichisusedasamotorcontrolco-processor.
TheeTPUcompletelyhandlesthemotorcontrolprocessing,eliminatingthemicroprocessoroverheadforotherduties.
BLDCmotorsareverypopularinawidearrayofapplications.
ComparedtoaDCmotor,theBLDCmotorusesanelectriccommutator,replacingthemechanicalcommutatorandmakingitmorereliablethantheDCmotor.
InBLDCmotors,rotormagnetsgeneratetherotor'smagneticflux,allowingBLDCmotorstoachievehigherefficiency.
Therefore,BLDCmotorsmaybeusedinhigh-endwhitegoods(refrigerators,washingmachines,dishwashers,etc.
),high-endpumps,fans,andotherappliancesthatrequirehighreliabilityandefficiency.
Theconceptoftheapplicationistocreateaspeed-closedloopBLDCdriverusingaHallpositionsensor.
ItservesasanexampleofaBLDCmotorcontrolsystemdesignusingaFreescalemicroprocessorwiththeeTPU.
Italso1PowerPCMPC5554andeTPUAdvantagesandFeatures22TargetMotorTheory.
43SystemConcept.
84SoftwareDesign185ImplementationNotes436MicroprocessorUsage477SummaryandConclusions488References49BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554CoversMPC5554andalleTPU-EquippedDevicesby:MilanBrejl&MichalPrinc&PavelSustekSystemApplicationEngineersRoznovCzechSystemCenterBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1PowerPCMPC5554andeTPUAdvantagesandFeaturesFreescaleSemiconductor2illustratestheusageofdedicatedmotorcontroleTPUfunctionsthatareincludedintheDCmotorcontroleTPUfunctionset.
Thisapplicationnotealsoincludesbasicmotortheory,systemdesignconcept,hardwareimplementation,andmicroprocessorandeTPUsoftwaredesign,includingtheFreeMASTERvisualizationtool.
Figure1.
UsingtheMPC5554DEMO,33395EvaluationMotorBoard,andPittmanBLDCMotor1PowerPCMPC5554andeTPUAdvantagesandFeatures1.
1PowerPCMPC5554MicrocontrollerTheMPC5554microcontrollerisafamilyofnextgenerationpowertrainmicrocontrollersbasedonthePowerPCBookEarchitecture.
Featuringtwo32channelseTPUengines,32Kbytesofcache,64KbytesofinternalSRAM,2MbytesofinternalFlashmemory,a64-channeleDMAcontroller,3FlexCANmodules,3UARTsandfourDSPImodules,theMPC5554familyhasbeendesignedforapplicationsthatrequirecomplex,real-timecontrol.
PowerPCMPC5554andeTPUAdvantagesandFeaturesBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor3This32-bitdeviceisbasedonthePowerPCoperatingatacorefrequencyupto132MHz.
On-chipmodulesinclude:High-performance32-bitPowerPCBookE-compliantcoreMemorymanagementunit(MMU)with24-entryfullyassociativetranslationlook-asidebuffer(TLB)2MBofembeddedFlashmemorywithErrorCorrectionCoding(ECC)64KBon-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,refertoReference8.
BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1TargetMotorTheoryFreescaleSemiconductor42TargetMotorTheoryAbrushlessDC(BLDC)motorisarotatingelectricmachinewherethestatorisaclassicthree-phasestator,likethatofaninductionmotor,andtherotorhassurface-mountedpermanentmagnets(seeFigure2).
Figure2.
BLDCMotor—CrossSectionInthisrespect,theBLDCmotorisequivalenttoareversedDCcommutatormotor,inwhichthemagnetrotateswhiletheconductorsremainstationary.
IntheDCcommutatormotor,thecurrentpolarityisalteredbythecommutatorandbrushes.
UnlikethebrushlessDCmotor,thepolarityreversalisperformedbypowertransistorsswitchinginsynchronizationwiththerotorposition.
Therefore,BLDCmotorsoftenincorporateeitherinternalorexternalpositionsensorstosensetheactualrotorposition,orthepositioncanbedetectedwithoutsensors.
2.
1DigitalControlofaBLDCMotorTheBLDCmotorisdrivenbyrectangularvoltagestrokescoupledwiththegivenrotorposition(seeFigure3).
Thegeneratedstatorfluxinteractswiththerotorflux,whichisgeneratedbyarotormagnetanddefinesthetorqueandthusthespeedofthemotor.
Thevoltagestrokesmustbeproperlyappliedtotwophasesofthethree-phasewindingsystemsothattheanglebetweenthestatorfluxandtherotorfluxiskeptascloseto90°aspossible,togetthemaximumgeneratedtorque.
Therefore,themotorrequireselectroniccontrolforproperoperation.
StatorStatorwinding(inslots)ShaftRotorAirgapPermanentmagnetsTargetMotorTheoryBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor5Figure3.
VoltageStrokesAppliedtothe3-PhaseBLDCMotorForthecommon3-phaseBLDCmotor,astandard3-phasepowerstageisused(seeFigure4).
Thepowerstageutilizessixpowertransistorsthatoperateineitheranindependentorcomplementarymode.
Inbothmodes,the3-phasepowerstageenergizestwomotorphasesconcurrently.
Thethirdphaseisunpowered(seeFigure3).
Thus,wegetsixpossiblevoltagevectorsthatareappliedtotheBLDCmotorusingaPulseWidthModulation(PWM)technique(seeFigure5).
Therearetwobasictypesofpowertransistorswitchingschemes:independentandcomplementary.
Bothswitchingmodesareabletoworkinbipolarorunipolarmode.
ThepresentedapplicationutilizesthecomplementarybipolarPWMmode.
FormoreinformationaboutPWMtechniques,refertoReference16.
Figure4.
3-PhaseBLDCPowerStage306090120150180210240270300330ElectricalangleVoltagePhaseAPhaseBPhaseC+UDCB-UDCB+UDCB-UDCB+UDCB-UDCBQ1PWM_Q5Q6Q4C1Phase_CPWM_Q1PWM_Q4PWM_Q3Phase_BGNDQ2UDCBPWM_Q2Phase_AQ3PWM_Q6Q5BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1TargetMotorTheoryFreescaleSemiconductor62.
1.
1CommutationCommutationprovidesthecreationofarotationalfield.
Asmentionedearlier,forproperoperationofaBLDCmotor,itisnecessarytokeeptheanglebetweenthestatorandrotorfluxascloseto90°aspossible.
Wegetatotalofsixpossiblestatorfluxvectorswithasix-stepcontrol.
Thestatorfluxvectormustbechangedatspecificrotorpositions,whichareusuallysensedbytheHallsensors.
TheHallsensorsgeneratethreesignalsthatalsoconsistofsixstates.
EachoftheHallsensors'statescorrespondtoacertainstatorfluxvector.
AlloftheHallsensorsstates,withcorrespondingstatorfluxvectors,areillustratedinFigure5.
Figure5.
StatorFluxVectorsatSix-StepControlThenexttwofiguresdepictthecommutationprocess.
TheactualrotorpositioninFigure6correspondstotheHallsensorsstateABC[110](seeFigure5).
PhaseAisconnectedtothepositiveDCbusvoltagebythetransistorQ1;phaseCisconnectedtothegroundbytransistorQ6,andphaseBisunpowered.
Assoonastherotorreachesacertainposition(seeFigure7),theHallsensorsstatechangesitsvaluefromABC[110]toABC[100].
AnewvoltagepatternisselectedandappliedtotheBLDCmotor.
Asshownbelow,whenusingthesix-stepcontroltechnique,itisdifficulttokeeptheanglebetweentherotorfluxandthestatorfluxpreciselyat90°inasix-stepcontroltechnique.
Theactualanglevariesfrom60°to120°.
Thecommutationprocessisrepeatedpereach60electricaldegreesandiscriticaltomaintainitsangular(time)accuracy.
Anydeviationcausestorqueripples,resultinginspeedvariation.
TargetMotorTheoryBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor7Figure6.
SituationRightBeforeCommutation(Counter-ClockwiseMotion)Figure7.
SituationRightAfterCommutation2.
1.
2SpeedControlCommutationensurestheproperrotorrotationoftheBLDCmotor,whilethemotorspeedonlydependsontheamplitudeoftheappliedvoltage.
TheamplitudeoftheappliedvoltageisadjustedusingthePWMtechnique.
Therequiredspeediscontrolledbyaspeedcontroller,whichisimplementedasaconventionalProportional-Integral(PI)controller.
ThedifferencebetweentheactualandrequiredspeedsisinputtothePIcontrollerwhichthen,basedonthisdifference,controlsthedutycycleofthePWMpulseswhichcorrespondtothevoltageamplituderequiredtomaintainthedesiredspeed.
BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor8Figure8.
SpeedControllerThespeedcontrollercalculatesthePIalgorithmgivenintheequationbelow:AftertransformingtheequationintoadiscretetimedomainusinganintegralapproximationwiththeBackwardEulermethod,wegetthefollowingequationsforthenumericalPIcontrollercalculation:where:3SystemConcept3.
1SystemOutlineThesystemisdesignedtodrivea3-phaseBLDCmotor.
Theapplicationmeetsthefollowingperformancespecifications:VoltagecontrolofaBLDCmotorusingHallsensorsTargetedatPowerPCMPC5554DEMOEvaluationBoard(MPC554DEMO),InterfaceBoardwithUNI-3,33395EvaluationMotorBoard,andPittmanBLDCmotor(N2311)e(k)=Inputerrorinstepkw(k)=Desiredvalueinstepkm(k)=Measuredvalueinstepku(k)=Controlleroutputinstepkup(k)=ProportionaloutputportioninstepkuI(k)=IntegraloutputportioninstepkuI(k-1)=Integraloutputportioninstepk-1TI=IntegraltimeconstantT=SamplingtimeKc=ControllergainSpeedControllerPWMGeneratorωdesiredPWMOutputDutyCycleωactualωerrorPowerStage-ΣCommutationHallSensorsut()Kcet()1TI-----eτ()τd0t∫+=uk()uPk()uIk()+=uPk()Kcek()=uIk()uIk1–()Kc+TTI-----ek()=SystemConceptBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor9Controltechniqueincorporates:—VoltageBLDCmotorcontrolwithspeed-closedloop—Bothdirectionsofrotation—4-quadrantoperation—Startfromanymotorpositionwithoutrotoralignment—Minimumspeedof300RPM—Maximumspeedof10000RPM(limitedbypowersupply)Manualinterface(Start/Stopswitch,Up/Downpushbuttoncontrol,LEDindication)FreeMASTERcontrolinterface(speedset-up,speedloopclose/openchoice)FreeMASTERmonitor—FreeMASTERgraphicalControlPage(requiredspeed,actualmotorspeed,start/stopstatus,faultstatus)—FreeMASTERSpeedControlScope(observesrequired,ramp,andactualspeeds,appliedvoltage)—DetaildescriptionofalleTPUfunctionsusedintheapplication(monitoringofchannelregistersandallfunctionparametersinrealtime)DCBusover-currentfaultprotection3.
2ApplicationDescriptionAstandardsystemconceptischosenforthemotorcontrolfunction(seeFigure9).
Thesystemincorporatesthefollowinghardware:EvaluationBoardMPC5554DEMOInterfaceBoardwithUNI-333395EvaluationMotorBoardPittmanBLDCMotorN2311withHallsensorsPowerSupply12VDC,2.
7AmpsTheeTPUmodulerunsthemaincontrolalgorithm.
The3-phasePWMoutputsignalsfora3-phaseinverteraregeneratedaccordingtofeedbacksignalsfromHallsensorsandtheinputvariablevalues,providedbythemicroprocessorCPU.
BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor10Figure9.
SystemConceptThesystemprocessingisdistributedbetweentheCPUandtheeTPU,whichbothruninparallel.
TheCPUperformsthefollowingtasks:Periodicallyscanstheuserinterface(ON/OFFswitch,UpandDownbuttons,FreeMASTER).
Basedontheuserinput,ithandlestheapplicationstatemachineandcalculatestherequiredspeeds,whichispassedtotheeTPU.
PeriodicallyreadsapplicationdatafromeTPUDATARAMinordertomonitorapplicationvariables.
Intheeventofanovercurrentfault,thePWMoutputsareimmediatelytemporarilydisabledbytheeTPUhardware.
Then,afteraninterruptlatency,theCPUdisablesthePWMoutputspermanentlyanddisplaysthefaultstate.
TheeTPUperformsthefollowingtasks:SixeTPUchannels(PWMC)areusedtogeneratePWMoutputsignals.
ThreeeTPUchannels(HD)areusedtoprocessHallsensorsignals.
Oneachincomingedge,arevolutionperiodiscalculatedandthePWMoutputsignalsarecommuted.
OneeTPUchannel(BC)isusedforcontrollingtheDC-busbreak.
eTPUcontrolsaspeedclosedloop.
Theactualmotorspeediscalculatedbasedontherevolutionperiodandcomparedwiththerequiredspeed,providedbytheCPUandpassedthrougharamp.
ThespeedPIcontrolalgorithmprocessestheerrorbetweentherequiredandactualspeed.
ThePIcontrolleroutputispassedtothePWMgeneratorasanewlycorrectedvalueoftheappliedmotorvoltage.
BLDCMotorsDriveeTPUenable/disablePWMsignalsrequiredspeedApplicationStateMachineON/OFFswitchstatusdatamonitoringFaultLEDCPUHardware3-PhasePowerStageBLDCmotor912VDC÷ON/OFFDOWNUPUARTFreeMasterRemoteControlRS232GPIOHallSensorSignalsPWMSignalsFaultSignalStatusLEDDC-busbreakcontrolEMIOSOver-currentinterruptSystemConceptBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor11Figure10.
TheApplicationandFreeMASTERScreen3.
2.
1UserInterfaceTheapplicationisinterfacedbythefollowing:ON/OFFswitchontheInterfaceBoardwithUNI-3Up/DownbuttonsontheInterfaceBoardwithUNI-3,orFreeMASTERrunningonaPCconnectedtotheMPC5554DEMOviaanRS232serialcable.
BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor12TheON/OFFswitchaffectstheapplicationstateandenablesanddisablesthePWMphases.
Whentheswitchisintheoff-position,novoltageisappliedtothemotorwindings.
WhentheON/OFFswitchisintheon-position,themotorspeedcanbecontrolledeitherbytheUpandDownbuttonsontheInterfaceBoard,orbytheFreeMASTERonthePC.
TheFreeMASTERalsodisplaysacontrolpage,real-timevaluesofapplicationvariables,andtheirtimebehaviorusingscopes.
FreeMASTERsoftwarewasdesignedtoprovideanapplication-debugging,diagnostic,anddemonstrationtoolforthedevelopmentofalgorithmsandapplications.
ItrunsonaPCconnectedtotheMPC5554DEMOviaanRS232serialcable.
AsmallprogramresidentinthemicroprocessorcommunicateswiththeFreeMASTERsoftwaretoreturnstatusinformationtothePCandprocesscontrolinformationfromthePC.
FreeMASTERsoftware,executingonaPC,usespartofMicrosoftInternetExplorerastheuserinterface.
Note,thatFreeMASTERversion1.
2.
31.
1orhigherisrequired.
TheFreeMASTERapplicationcanbedownloadedfromhttp://www.
freescale.
com.
FormoreinformationaboutFreeMASTER,refertoReference7.
3.
3HardwareImplementationandApplicationSetupAspreviouslystated,theapplicationrunsontheMPC5554familyofPowerPCmicroprocessorsusingthefollowing:MPC5554DEMOInterfaceBoardwithUNI-333395EvaluationMotorBoardPittmanN23113-phaseBLDCmotorPowerSupply,12VDC,minimum2.
7AmpsFigure11showstheconnectionoftheseparts.
AllsystempartsaresuppliedbyFreescaleanddocumentedaccordingtoreferences.
3.
3.
1PowerPCMPC5554EvaluationBoard(MPC5554DEMO)ThisboardisnotintendedtobeafullevaluationboardfortheMPC5554,butshowsaminimalsystemforlearningaboutthenewMPC5500familyofproduct.
TheFLASHmemoryplacedontheMPC5554hasthreeaddressspaces.
Lowandmidaddressspacesare256-Kbytesandhighaddressspacesis1.
5Mbyteinsize.
Itgivesatotalmemoryspaceof2Mbytes.
Formoreinformation,refertoReference2.
Table1listsallMPC5554DEMOjumpersettingsusedintheapplication.
SystemConceptBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor13Figure11.
ConnectionofApplicationPartsTable1.
.
MPC5554DEMOJumperSettings.
JumperSettingCAN_SELSettingCONFIGSWITCHSettingJP1-1JP1-2JP2JP3JP4JP5VRH_ENSRAM_SELVSTBY_SWITCH1-21-21-231-21-231-21-21-23ON123456121212121212123456ONOFFONOFFONOFFBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor143.
3.
2FlashingtheMPC5554DEMOTheeSysFlasherutilitycanbeusedforprogrammingcodeintotheFLASHmemoryontheMPC5554DEMO.
Checkforcorrectsettingofswitchesandjumpers.
Theflashingprocedureisasfollows:1.
RunMetrowerksMPC55xxV1.
5b2andopentheproject.
ChoosetheIntflashtargetandcompiletheapplication.
Afilesimple_eflash.
elf.
S19,whichwillbeloadedintoFLASHmemory,iscreatedintheprojectdirectorybin.
2.
RuntheeSysFlasherapplication.
IntheTargetConfigurationwindowselectthetypeoftheBDMCommunicationasP&EWiggler.
ClickOKtoclosethewindow.
3.
GototheProgramsectionbyclickingthe"ProgramFlash"button(seeFigure12).
SelecttheBinaryImage,setAddressas0x0andcheckthe"Verifyafterprogram"option(seeFigure13).
Pressthe"Program"andselectintflash.
binfile.
Finally,press"Open"buttonatthebottomofthewindowtostartloadingthecodeintotheFLASHmemory.
4.
Ifthecodehasbeenprogrammedcorrectly,removetheBDMinterfaceandpushtheRESETbuttonontheMPC5554Demo.
TheapplicationshouldnowrunfromtheFLASH.
Figure12.
eSysFlasherTargetConfigurationWindowTheeSYSFlasherapplicationcanbedownloadedfromhttp://www.
freescale.
com.
SystemConceptBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor15Figure13.
eSysFlasherProgramWindow3.
3.
3InterfaceBoardwithUNI-3ThisboardenablestoconnectthepowerstagewithamotortotheMPC5554DEMOBoardandcanbeusedbysoftwareandhardwaredeveloperstotestprogramsandtools.
ItsupportsalgorithmsthatuseHallsensors,LEMsensors,encoderfeedbackandBack-EMF(electromotiveforce)signalsforsensorscontrol.
InputconnectionsaremadeviaconnectorsonthebottomsideoftheboardandheadersontheMPC5554DEMOBoard.
Outputconnectionsaremadevia40-pinUNI-3connectorandexpansionheaders.
Powerrequirementsaremetbyinputconnectors.
Figure14.
InterfaceBoardwithUNI-3Formoreinformation,refertoReference5BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SystemConceptFreescaleSemiconductor163.
3.
4SettingOvercurrentLevelTheover-currentfaultsignalisconnectedtotheeMIOSOutputDisableInputpin(eMIOS10)thatenables,togetherwithapropereTPUconfiguration,handlingthefaultbyeTPUhardware.
ThisconnectionispartoftheMPC5554.
Inordertoenablehandlingthefaultalsobyasoftware,thefaultsignal,availableoneMIOS10pingeneratesinterruptrequesttotheCPUincaseofafault.
Theover-currentlevelissetbythetrimmerR24(I_SEN)ontheInterfaceBoardwithUNI-3(seeFigure15).
Reference5describeswhatvoltagemustthetrimmerdefinefortheover-currentcomparator.
Dothefollowingstepsinordertosetuptheover-currentlevelproperlywithoutmeasuringthevoltage:1.
ConnectallsystempartsaccordingtoFigure11.
2.
Downloadandstarttheapplication.
3.
TurnON/OFFswitchON.
UsingUpandDownbuttonssettherequiredspeedtothemaximum.
4.
AdjusttheR24trimmer.
YoucanfindalevelfromwhichtheredLEDstartstolightandthemotorspeedstartstobelimited.
Setthetrimmerlevelsomewhathigher,sothatthemotorcanrunatthemaximumspeed.
5.
TurntheON/OFFswitchOFF.
6.
TurnON/OFFswitchON.
UsingUpandDownbuttonssettherequiredspeedtothemaximum.
7.
Iftheapplicationgoestothefaultstateduringtheacceleration,adjusttheR24trimmerlevelsomewhathigher,sothatthemotorcangettothemaximumspeed.
theFigure15.
OvercurrentLevelTrimmeronInterfaceBoardwithUNI-3(R24)3.
3.
533395EvaluationBoardThe33395EvaluationMotorBoardisa12-volt,8-amppowerstage,whichissuppliedwitha40-pinribboncable.
IncombinationwiththeMPC5554EVBandInterfaceBoardwithUNI-3,itprovidesanout-of-the-boxsoftwaredevelopmentplatformforsmallbrushlessDCmotors.
Thepowerstageenablessensingavarietyoffeedbacksignalssuitablefordifferentmotorcontroltechniques.
ItmeasuresalltheSystemConceptBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor17threephasecurrents,reconstructsDC-buscurrentfromthem,DC-busvoltage,Back-EMFvoltageswithzerocrosssensing.
AlltheanalogsignalsareadaptedtobedirectlysampledbytheA/Dconverter.
Thissingle-boardpowerstagecontainsananalogbridgegatedriverintegratedcircuitry,sensingandcontrolcircuitry,powerN-MOSFETtransistors,DC-Busbrakechopper,aswellasvariousinterfaceconnectorsforthesupplyandthemotor.
Figure16.
33395EvaluationMotorBoardFormoreinformation,refertoReference4.
3.
3.
6BLDCMotorwithHallSensorsTheenclosedmotorisalow-voltagePittmanBLDCmotor(N2311).
ThemotoriscapableofbeingcontrolledbyHallsensortechniques.
BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor18ThemotorcharacteristicsinTable2applytooperationat25°C.
Figure33depictsthemotortiming.
Formoremotorspecifications,refertoReference6.
3.
3.
7PowerSupplyThepowersupply12V/2.
7A,isalsousedtopowerthe3-PhaseMicroPowerStage.
Theapplicationisscaledforthis12Vpowersupply.
4SoftwareDesignThissectiondescribesthesoftwaredesignoftheBLDCmotordriveapplication.
ThesystemprocessingisdistributedbetweentheCPUandtheeTPU,whichruninparallel.
TheCPUandeTPUtasksaredescribedintermsofthefollowing:CPU—SoftwareFlowchart—ApplicationStateDiagram—eTPUApplicationAPIeTPU—eTPUBlockDiagram—eTPUTimingTable2.
PittmanBLDCMotor(N2311)MotorCharacteristicsCharacteristicSymbolMinTypeMaxUnitsReferenceWindingVoltageVt——9.
6VSpeed@Vt——12000RPMTorqueConstantKt—0.
007—Nm/AKt—1.
082—oz-in/AVoltageConstantKe—0.
8—V/kRPMTerminalResistanceRt0.
13—0.
18WWindingInductanceL——mHContinuousCurrentIcs——9.
96ANoLoadCurrent@VtIps—1.
20—ANumberofPolesJm—8——TemperatureRating-10—8014—176SoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor19TheCPUsoftwareusesseveralready-to-useFreescalesoftwaredrivers.
ThecommunicationbetweenthemicroprocessorandtheFreeMASTERonaPCishandledbysoftwareincludedinfmaster.
c/.
hfiles.
TheeTPUmoduleusesthegeneraleTPUutilities,eTPUfunctioninterfaceroutines(eTPUfunctionAPI),andeTPUapplicationinterfaceroutines(eTPUapplicationAPI).
Thegeneralutilities,includedintheetpu_util.
c/.
hfiles,areusedforinitializationofglobaleTPUmoduleandenginesettings.
TheeTPUfunctionAPIroutinesareusedforinitializationoftheeTPUchannelsandinterfacingeacheTPUfunctionduringrun-time.
AneTPUapplicationAPIencapsulatesseveraleTPUfunctionAPIs.
TheuseofaneTPUapplicationAPIeliminatestheneedtoinitializeeacheTPUfunctionseparatelyandtohandlealleTPUfunctioninitializationsettings,andsoensuresthecorrectcooperationofeTPUfunctions.
Figure17.
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-57SWAN2864SWAN2958SWSoftwareLevelSourceCodeFilesOrigineTPUCodeUserwrittencodeFreescalesuppliedcodeGeneratedcodeByteCraftsuppliedcodeBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor204.
1CPUSoftwareFlowchartFigure18.
CPUSoftwareFlowchartAfterreset,theCPUsoftwareinitializesinterruptsandpins.
ThefollowingCPUprocessingisincorporatedintwoperiodictimerinterrupts,oneperiodicaleTPUchannelinterrupt,andtwofaultinterrupts.
4.
1.
1TimerInterruptServiceRoutineThetimerinterruptishandledbythetimer_isrfunction.
Thefollowingactionsareperformedperiodically,intimer_isr:ReadtheON/OFFswitchstatusHandletheapplicationstatemachineTheapplicationstatediagramisdescribedindetailbelow.
ServicetheUpandDownbuttonsandtheStatusLEDbytheApplicationButtonsAndStatusLedfunctionReadthedatastructurethroughtheeTPUapplicationAPIroutinefs_etpu_app_bldcmhsl1_get_data(see4.
3).
4.
1.
2FreeMASTERInterruptServiceRoutineTheFreeMASTERinterruptserviceroutineiscalledfmasterDispatcher.
Thisfunctionisimplementedinfmaster.
c.
RESETInitializeinterruptsandpinswaitReadON/OFFswitchstatusHandleapplicationstatemachineServiceUp/DownbuttonsandStatusLEDReadapplicationdatastructureRe-initializeallDMABCRxregistersTimer3InterruptHandleovercurrentfaultFaultInterruptFreeMasterDispatcherFreeMasterTimerInterruptFreeMasterRecordereTPUChannelInterruptHandleeTPUglobalexceptioneTPUGlobalExceptionInterruptSoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor214.
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(seeFigure19).
Afterreset,theapplicationgoesfirstlytoAPP_STATE_INIT.
WheretheON/OFFswitchisintheOFFposition,theAPP_STATE_STOPfollows,otherwisetheAPP_STATE_MOTOR_FAULTisenteredandtheON/OFFswitchmustbeturnedOFFtogetfromAPP_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(seeBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor22redlineonFigure19),theAPP_STATE_MOTOR_FAULTisentered.
ThisfaultisclearedbymovingtheON/OFFswitchtotheOFFpositionandthusenteringtheAPP_STATE_STOP.
WheretheeTPUglobalexceptioninterruptisraised(seegraylineonFigure19),theAPP_STATE_GLOBAL_FAULTisentered.
TheglobalfaultisclearedbymovingtheON/OFFswitchtotheOFFpositionandthusenteringtheAPP_STATE_INIT.
Figure19.
ApplicationStateDiagramThefollowingparagraphsdescribetheprocessingineachoftheapplicationstates.
4.
2.
1APP_STATE_INITThisstateispassedthroughonly.
Itisenteredeitherafterareset,oraftertheAPP_STATE_GLOBAL_FAULT.
Thefollowingactionsareperformedinordertoinitialize(re-initialize)theapplication:Callmy_system_etpu_initroutineforeTPUmoduleinitializationGeteTPUfunctionsDATARAMaddressesforFreeMASTERGettheaddressesofchannelconfigurationregistersforFreeMASTERInitializeFreeMASTERCallmy_system_etpu_startroutineforeTPUStart.
Atthispoint,theCPUandtheeTPUruninparallel.
DependingontheON/OFFswitchposition,enterAPP_STATE_STOPorAPP_STATE_MOTOR_FAULTON/OFFswitchmovedOFFAPP_STATE_ENABLEAPP_STATE_RUNAPP_STATE_MOTOR_FAULTAPP_STATE_DISABLEAPP_STATE_STOPresetAPP_STATE_INITON/OFFswitchmovedOFFON/OFFswitchmovedONAPP_STATE_GLOBAL_FAULTON/OFFswitchmovedOFFover-currentfaultinterruptSoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor234.
2.
1.
1InitializationandStartofeTPUModuleTheeTPUmoduleisinitializedusingthemy_system_etpu_initfunction.
Later,afterinitializationofallotherperipherals,theeTPUisstartedbymy_system_etpu_start.
ThesefunctionsusethegeneraleTPUutilitiesandeTPUfunctionAPIroutines.
Boththemy_system_etpu_initandmy_system_etpu_startfunctions,includedinbldcmhsl1_etpu_gct.
cfile,aregeneratedbyeTPUGraphicalConfigurationTool.
TheeTPUGraphicalConfigurationToolcanbedownloadedfromhttp://www.
freescale.
com/webapp/sps/site/prod_summary.
jspcode=eTPU.
Formoreinformation,refertoReference15.
Themy_system_etpu_initfunctionfirstconfigurestheeTPUmoduleandmotorsettings.
Someofthesesettingsincludethefollowing:channelfiltermode=three-samplemodechannelfilterclock=etpuclkdiv32Theinputsignals(fromHallsensors)arefilteredbychannelfilters.
Thefiltersettingsguaranteefilteringallnoisepulsesuptoawidthof500nsandpasspulsesfromawidthof750ns(at128MHzsystemclock).
TCR1source=etpuclkdiv2TCR1prescaler=1TheTCR1internaleTPUclockissettoitsmaximumrateof64MHz(at128MHzsystemclock),correspondingtothe16nsresolutionofgeneratedPWMsignals.
TCR2source=etpuclkdiv8TCR2prescaler=20TheTCR2internaleTPUclockissettoarateof800kHz(at128MHzsystemclock).
TheTCR2clocksettingsareoptimizedformotorspeedcalculationprecision.
Afterconfiguringthemoduleandenginesettings,themy_system_etpu_initfunctioninitializestheeTPUchannels.
channel1-HallDecoder(HD)-PhaseAchannel2-HallDecoder(HD)-PhaseBchannel3-HallDecoder(HD)-PhaseCchannel5-SpeedController(SC)channel7-PWMMasterforDCMotors(PWMMDC)channel8-PWMCommuted(PWMC)-PhaseA-basechannelchannel10-PWMCommuted(PWMC)-PhaseB-basechannelchannel12-PWMCommuted(PWMC)-PhaseC-basechannelChannel14-AnalogsensingforDCmotors(ASDC)Channel15-breakcontroller(BCTheseeTPUchannelsareinitializedbythefs_etpu_app_bldcmhsl2_initeTPUapplicationAPIfunction(see4.
3).
Theapplicationsettingsareasfollows:—PWMphases-typeiscommutedcomplementarypairsBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor24—PWMfrequency20kHz—PWMdead-time1s—Motorspeedrange14000RPM—Motorspeedminimum300RPM—DC-busvoltage9V—Numberofmotorpolepairs4—MotorspeedcalculatedusingHDrevolutionperiod—Speedcontrollerupdatefrequency10kHz—PIcontrollerparameters:P-gainis0.
5(0x004000*2-15),andI-gainis0.
0078125(0x000100*2-15).
Thecontrollerparameterswereexperimentallytuned.
—Rampparameters:900mstorampupfromzerotothemaximumspeed,900mstorampdownfromthemaximumspeedtozero.
—Breakcontrollermode-PWM-basedbreakingsignalisgeneratedincaseofover-voltage.
—Breakcontrolsignalpolarityisactivehigh.
—DC-busvoltagelevel,atwhichbreakcontrolsignalisON,is110%ofthenominalDC-busvoltage—DC-busvoltagelevel,atwhichbreakcontrolsignalisOFF,is105%ofthenominalDC-busvoltage—ASDCfunctiontriggersA/Dconverteronhigh-lowedge—DC-busvoltagemeasurementtimeincludingA/DconversiontimeandDMAtransfertimeis11us—p_ASDC_result_queuepointercontainstheaddressofthemeasuredsampleofDC-busvoltage—MeasuredsampleofDC-busvoltageisshiftedleftby8bits—DC-busvoltagesampleoffsetwithinASDC_result_queueis0—ASDCEWMAfiltertimeconstantis450usThemy_system_etpu_startfunctionfirstappliesthesettingsforthechannelinterruptenableandchanneloutputdisableoptions,thenenablestheeTPUtimers,sostartingtheeTPU.
SoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor25Figure20.
eTPUConfigurationUsingtheeTPUGraphicalConfigurationTool4.
2.
1.
2InitializationofFreeMASTERCommunicationPriortotheFreeMASTERinitialization,itisnecessarytosetpointerstotheeTPUfunctionsDATARAMbasesandConfigurationRegisterbases.
Basedonthesepointers,whicharereadbyFreeMASTERduringtheinitialization,thelocationsofalleTPUfunctionparametersandConfigurationRegistersaredefined.
ThisisessentialforcorrectFreeMASTERoperation!
BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor26FreeMASTERconsistsofsoftwarerunningonaPCandonthemicroprocessor,connectedviaanRS-232serialport.
AsmallprogramresidentinthemicroprocessorcommunicateswiththeFreeMASTERonthePCinordertoreturnstatusinformationtothePC,andprocessescontrolinformationfromthePC.
ThemicroprocessorpartoftheFreeMASTERisinitializedbytwofunctions:iniFmasterUartandfmasterInit.
Bothfunctionsareincludedinfmaster.
c,whichautomaticallyinitializestheUARTdriverandinstallsallnecessaryservices.
4.
2.
1.
3InitializationofNecessaryPeripheralModulesSeveralperipheralmodulesneededforDC-busvoltagemeasurementprocessingmustbeinitialized:AninternalanalogtodigitalconverterisusedforsamplingtheDC-busvoltageanalogvalue.
InitializationoftheADConvertermoduleisdonebytheQuickStartConfigurationTool.
3DMAchannelsareusedtoperiodicallytransferdatafromADCtotheeTPUdatamemory.
InitializationoftheDMAmoduleisdonebytheQuickStartConfigurationTool.
ForadetaileddescriptionofQuickStartConfigurationTool,refertoReference3.
ForadetaileddescriptionofDC-busvoltagemeasurementanddatatransferprocessing,see4.
4.
54.
2.
2APP_STATE_STOPInthisstate,thePWMsignalsaredisabledandthemotorisoff.
Themotorshaftcanberotatedbyhand,whichenablestheusertoexplorethefunctionalityoftheHallDecoder(HD)eTPUfunction,towatchvariablesproducedbytheHD,andtoseeHallsensorsignalsinFreeMASTER.
WhentheON/OFFswitchisturnedon,theapplicationgoesthroughAPP_STATE_ENABLEtoAPP_STATE_RUN.
4.
2.
3APP_STATE_ENABLEThisstateispassedthroughonly.
Thefollowingactionsareperformedinordertoswitchthemotordriveon:ResettherequiredspeedEnablethegenerationofPWMsignalsIfthePWMphasesweresuccessfullyenabled,theeMIOSchannel10isconfiguredasinput,interruptonfallingedge,andAPP_STATE_RUNisentered.
WherethePWMphaseswerenotsuccessfullyenabled,theapplicationstatedoesnotchange.
SoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor274.
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.
4.
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.
TheuseofeTPUapplicationAPIfunctionseliminatestheneedtoinitializeandseteacheTPUfunctionseparately,andensurescorrectcooperationoftheeTPUfunctions.
TheeTPUapplicationAPIisdeviceindependentandhandlesonlytheeTPUtasks.
InordertoshortentheeTPUapplicationnames,abbreviatedapplicationnamesareintroduced.
Theabbreviationsinclude:motortype(DCM=DCMotor,BLDCM=BrushlessDCMotor,PMSM=PermanentMagnetSynchronousMotor,ACIM=ACInductionMotor,SRM=SwitchedReluctanceMotor,SM=StepperMotor)BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor28sensortype(H=HallSensors,E=ShaftEncoder,R=Resolver,S=Sincos,X=sensorless)controltype(OL=OpenLoop,PL=PositionLoop,SL=SpeedLoop,CL=CurrentLoop,SVC=SpeedVectorControl,TVC=TorqueVectorControl)Basedonthesedefinitions,theBLDCMHSL2isanabbreviationforBLDCMotorwithHallSensorsandSpeedClosedLoopeTPUmotor-controlapplication.
AsthereareseveralBLDCMotorapplicationswithHallSensorsandSpeedClosedLoop,thenumber2denotesthesecondsuchapplicationinorder.
Thissecondapplication,moreover,demonstratesthebreakcontrollereTPUfunctionusageforDC-busover-voltageprotection.
TheBLDCMHSL2eTPUapplicationAPIisdescribedinthefollowingparagraphs.
Thereare5basicfunctionsaddedtotheBLDCMHSL2applicationAPI.
Theroutinescanbefoundintheetpu_app_bldcmhsl2.
c/.
hfiles.
AllBLDCMHSL2applicationAPIroutineswillbedescribedinorderandarelistedbelow:Initializationfunction:int32_tfs_etpu_app_bldcmhsl2_init(bldcmhsl2_instance_t*bldcmhsl2_instance,uint8_tPWM_master_channel,uint8_tPWM_phaseA_channel,uint8_tPWM_phaseB_channel,uint8_tPWM_phaseC_channel,uint8_tHD_phaseA_channel,uint8_tHD_phaseB_channel,uint8_tHD_phaseC_channel,uint8_tSC_channel,uint8_tBC_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,uint8_tBC_mode,uint8_tBC_polarity,uint8_tBC_u_dc_bus_ON_perc,SoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor29uint8_tBC_u_dc_bus_OFF_perc,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_bldcmhsl2_enable(bldcmhsl2_instance_t*bldcmhsl2_instance,uint8_tconfiguration)int32_tfs_etpu_app_bldcmhsl2_disable(bldcmhsl2_instance_t*bldcmhsl2_instance)fs_etpu_app_bldcmhsl2_set_speed_required(bldcmhsl2_instance_t*bldcmhsl2_instance,int32_tspeed_required_rpm)Valuereturnfunctions:fs_etpu_app_bldcmhsl2_get_data(bldcmhsl2_instance_t*bldcmhsl2_instance,bldcmhsl2_data_t*bldcmhsl2_data)4.
3.
1int32_tfs_etpu_app_bldcmhsl2_init(.
.
.
)ThisroutineisusedtoinitializetheeTPUchannelsforthe"BLDCMotorwithSpeedClosedLoopandDC-BusBreakController"application.
Thisfunctionhasthefollowingparameters:bldcmhsl2_instance(bldcmhsl2_instance_t*)-Thisisapointertobldcmhsl2_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl2_init.
Thisstructuremustbedeclaredintheuserapplication.
Wheretherearemoreinstancesoftheapplicationrunningsimultaneously,theremustbeaseparatebldcmhsl2_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_BLDCMHSL2_COMPL_PAIRS),thecomplementarychannelisonechannelhigher.
BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor30PWM_phaseB_channel(uint8_t)-ThisisthePWMphaseBchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
Inthecaseofcomplementarysignalgeneration(PWM_phases_type==FS_ETPU_APP_BLDCMHSL2_COMPL_PAIRS),thecomplementarychannelisonechannelhigher.
PWM_phaseC_channel(uint8_t)-ThisisthePWMphaseCchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
Inthecaseofcomplementarysignalgeneration(PWM_phases_type==FS_ETPU_APP_BLDCMHSL2_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.
BC_channel(uint8_t)-Thisisthebreakcontrollerchannelnumber.
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_BLDCMHSL2_SINGLE_CHANNELS,orFS_ETPU_APP_BLDCMHSL2_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.
period_measured(uint8_t)-Thisoptiondefinesthetypeofperiodmeasurementforspeedcalculation.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL2_REV_PERIOD,orFS_ETPU_APP_BLDCMHSL2_SECTOR_PERIOD.
SC_freq_hz(uint32_t)-ThisisthespeedcontrollerupdatefrequencyinHz.
TheassignedvaluemustbeequaltothePWM_freq_hzdividedby1,2,3,4,5,.
.
.
SoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor31SC_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.
BC_mode(uint8_t)-Thisisthefunctionmode.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL2_BC_MODE_ON_OFF,orFS_ETPU_APP_BLDCMHSL2_BC_MODE_PWM.
BC_polarity(uint8_t)-ThisistheBCoutputpolarity.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL2_BC_ON_HIGH,orFS_ETPU_APP_BLDCMHSL2_BC_ON_LOW.
BC_u_dc_bus_ON_perc(uint8_t)-ThisistheproportionbetweenU_DC_BUS,abovewhichtheBCoutputisON,andthenominalU_DC_BUS,expressedinpercentage(usuallyabout130%).
BC_u_dc_bus_OFF_perc(uint8_t)-ThisistheproportionbetweenU_DC_BUS,belowwhichtheBCoutputisOFF,andthenominalU_DC_BUS,expressedinpercentage(usuallyabout110%).
ASDC_polarity(uint8_t)-ThisisthepolaritytoassigntotheASDCfunction.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL2_ASDC_PULSE_HIGHorFS_ETPU_APP_BLDCMHSL2_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_BLDCMHSL2_ASDC_SHIFT_LEFT_BY_8,FS_ETPU_APP_BLDCMHSL2_ASDC_SHIFT_LEFT_BY_10,FS_ETPU_APP_BLDCMHSL2_ASDC_SHIFT_LEFT_BY_12,orFS_ETPU_APP_BLDCMHSL2_ASDC_SHIFT_LEFT_BY_16.
ASDC_queue_offset(uint8_t)-PositionoftheU_DC_BUSsampleintheresultqueue.
Offsetisdefinedinbytes.
BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor32ASDC_filter_time_constant_us(uint32_t)-ThisthetimeconstantofthefilterwhichapplieswhenprocessingtheU_DC_BUSsamples,inus.
4.
3.
2int32_tfs_etpu_app_bldcmhsl2_enable(.
.
.
)ThisroutineisusedtoenablethegenerationofPWMsignals,commutationsonHallsignaltransitions,andtostartthespeedcontroller.
Thisfunctionhasthefollowingparameters:bldcmhsl2_instance(bldcmhsl2_instance_t*)-Thisisapointertobldcmhsl2_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl2_init.
configuration(uint8_t)-ThisistherequiredconfigurationoftheSC.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL2_SPEED_LOOP_OPENED,orFS_ETPU_APP_BLDCMHSL2_SPEED_LOOP_CLOSED.
4.
3.
3int32_tfs_etpu_app_bldcmhsl2_disable(bldcmhsl2_instance_t*bldcmhsl2_instance)ThisroutineisusedtodisablethegenerationofPWMsignals,commutationonHallsignaltransitions,andtostopthespeedcontroller.
Thisfunctionhasthefollowingparameter:bldcmhsl2_instance(bldcmhsl2_instance_t*)-Thisisapointertobldcmhsl2_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl2_init.
4.
3.
4fs_etpu_app_bldcmhsl2_set_speed_required(.
.
.
)Thisroutineisusedtosettherequiredmotorspeed.
Thisfunctionhasthefollowingparameters:bldcmhsl2_instance(bldcmhsl2_instance_t*)-Thisisapointertobldcmhsl2_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl2_init.
speed_required_rpm(int32_t)-Thisistherequiredmotorspeedinrpm.
4.
3.
5fs_etpu_app_bldcmhsl2_get_data(.
.
.
)Thisroutineisusedtogettheapplicationstatedata.
Thisfunctionhasthefollowingparameters:bldcmhsl2_instance(bldcmhsl2_instance_t*)-Thisisapointertobldcmhsl2_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl2_init.
bldcmhsl2_data(bldcmhsl2_data_t*)-Thisisapointertobldcmhsl2_data_tstructureofapplicationstatedata,whichisupdated.
SoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor334.
4eTPUBlockDiagramTheeTPUfunctionsusedtodrivetheBLDCmotorwithspeedclosedloopandDC-busbreakcontrollerarelocatedinthemotor-controlsetofeTPUfunctions(set3-DCmotors).
TheeTPUfunctionswithinthesetserveasbuildingblocksforvariousmotor-controlapplications.
Thefollowingparagraphsdescribethefunctionalityofeachblock.
Figure21.
BlockDiagramofeTPUProcessing4.
4.
1PWMGenerator(PWMMDC+PWMC)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.
ThePWMCfunctionisusedinthedescribedapplication.
ThePWMCfunctiongeneratesthePWMsignals.
ThePWMMDCfunctioncontrolsthreePWMCfunctions,threePWMphases,anddoesnotgenerateanydrivesignal.
ThePWMMDCcanbeexecutedevenonaneTPUchannelnotconnectedtoanoutputpin.
commutationHDPWMCPWMMDCSCappliedvoltagerequiredspeedrevolutionperiodHallSensorsMotorInverterCPUeTPUHardwareduty-cyclesFaultfaultinterruptOutputDisableASDCBCADCTriggerDC-BusBreakDC-busvoltageEMIOSBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor34Figure22.
FunctionalityofPWMMDC+PWMCFormoredetailsaboutthePWMMDC,PWMF,andPWMCeTPUfunctions,refertoReference11.
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.
TheHDfunctionalsoperformscommutationsofPWMCphases.
PWMMDCupdateupdateperiodapplied_voltagePWMCpolarity:active-highORactive-lowvariablePWMperiodscenter-alignedORedge-alignedsinglechannelORcomplementarypairPWMCPWMCupdatenoupdatenoupdatenewinputvaluesnewinputvaluesSoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor35Figure23.
FunctionalityofHDFormoredetailsabouttheHDeTPUfunction,refertoReference9.
4.
4.
3SpeedController(SC)TheSpeedControllereTPUfunctionisnotintendedtoprocessinputoroutputsignals.
ItspurposeistocontrolanothereTPUfunction'sinputparameter.
TheSCfunctioncanbeexecutedevenonaneTPUchannelnotconnectedtoanoutputpin.
TheSCfunctionincludesageneralPIDcontrolleralgorithm.
Thecontrollercalculatesitsoutputbasedontwoinputs:ameasuredvalue,andarequiredvalue.
Themeasuredvalue(theactualmotorspeed)iscalculatedbasedoninputsprovidedbytheHDfunction.
Therequiredvalueisanoutputofthespeedramp,whoseinputisaSCfunctionparameter,andcanbeprovidedbytheCPUoranothereTPUfunction.
Inthemotor-controleTPUfunctionset,thisfunctionmostlyprovidesthespeedouter-loop.
Figure24.
FunctionalityofSCFormoredetailsabouttheSCeTPUfunction,refertoReference10.
HDcommutationofPWMphasesPWMCPWMCPWMCsector_periodsector_periodsector_perioddirectionsectorrevolution_periodsector_periodrevolution_counteromega_actualomega_rampomega_desiredapplied_voltageSCtimerequested_valuePIcontrollerrampperiodrevolution_periodomega_actualscaling_factorsector_periodBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor364.
4.
4BreakController(BC)Thepurposeofthebreakcontroller(BC)eTPUfunctionistoeliminateDC-busovervoltagewhenamotorisdriveninthegeneratingmode.
TheBCfunctiongeneratestheDC-busbreakcontrolsignal(seeFigure25)basedontheactualDC-busvoltage.
Figure25.
FunctionalityofBCThedescribedapplicationusesthePWMmodeoftheBCfunction.
Inthismode,theBCfunctionswitchessoftlyusingaPWMsignal.
Theu_dc_bus_ONandu_dc_bus_OFFthresholdsdefinearamp(seeFigure26).
WhentheDC-busvoltageislowerthanu_dc_bus_OFF,thecontrolsignalisturnedoff.
Betweentheu_dc_bus_OFFandu_dc_bus_ONthresholds,aPWMsignalwithaduty-cyclelinearlyincreasingfrom0%to100%isgenerated.
Abovetheu_dc_bus_ONthreshold,thecontrolsignalisturnedon.
ThefunctionalityoftheBCisshowninfiguresFigure27,Figure28,Figure29.
Signal1(darkblueline)representstheDC-busvoltage,signal2(lightblueline)reflectstheDC-busbreakcontrolsignalgeneratedbytheBC.
Figure26.
PWMModeoftheBreakControllerFunctionH-BRIDGEACDCAC/DCDC-busDC-busbreakcontrolsignalDuty_cycle100%0%U_dc_busU_dc_bus_OFFU_dc_bus_ONSoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor37Figure27.
OscilloscopeScreenshotShowingDC-busVoltageCoursewhenaMotorReachestoGeneratingMode(WithoutActionofBreakController)Figure28.
OscilloscopeScreenshotShowingFunctionalityoftheBreakControllerBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor38Figure29.
OscilloscopeScreenshotShowingFunctionalityoftheBreakControllerinDetail(ZoomofDC-BusBreakControlSignal)FormoredetailsabouttheBCeTPUfunction,refertoReference12.
4.
4.
5AnalogSensingforDCMotors(ASDC)TheanalogsensingforDCmotorseTPUfunction(ASDC)isusefulforpreprocessinganalogvaluesthataremeasuredbytheADconverterandtransferredtotheeTPUdatamemorybyDMAtransfer.
TheASDCfunctionisalsousefulfortriggeringtheADconverterandsynchronizingothereTPUfunctions.
AlltheabovementionedASDCfeaturesareutilizedintheapplication.
TheASDCisinitializedtoruninPWMsynchronizedmode,e.
g.
thefirstASDCedgeissynchronizedwiththebeginningofthePWMperiod.
Simultaneously,theASDCmanagestosynchronizetheBCfunctionbygeneratingthelinktotheBCchannelevery16thASDCperiod.
TheASDCfunctionpreprocessestheDC-busvoltageanalogvalueandpassestheadjustedvalueasaninputtotheBCfunction.
ProcessingoftheDC-busvoltageanalogvalueincludesbitshiftingandfiltering.
SoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor39Figure30.
FunctionalityofASDCInordertoensureperiodicsamplingoftheDC-busvoltageandthequicktransferofthemeasureddatafromtheADconvertertotheETPUDATARAM,severalperipheralmodulesareused:AninternalanalogtodigitalconverterisusedforsamplingoftheDC-busvoltageanalogvalue.
3directmemoryaccess(DMA)channelsareusedasfollows:—DMAchannel0isusedforthetransferoftheconfigurationword(0x80000000)fromtheeqadcCQueue0totheCFPR(CFIFOPushRegister)oftheeQADCmodule.
ThisoperationtriggerstheeQADCconvertersampling.
TheDMAchannel0transferisinitiatedbyaDMArequestgeneratedbyDMAchannel30.
—DMAchannel1isusedforthetransferoftheresultfromtheRFPR(resultFIFOpopregister)totheeTPUmemorywherepointsp_ASDC_result_queuepointer.
TheDMAchannel30transferisinitiatedbyaDMArequestgeneratedbyQADCmoduleaftertheconversionisfinished.
—DMAchannel30isusedforthetransferoftheconfigurationword(0x0410)totheCFCR(commandFIFOcontrolregister).
ThissetthestartbitandtheQADCsinglescanmode.
TheDMAchannel30transferisinitiatedbyaDMArequestgeneratedbyeTPU_Achannel14.
Whenthetransferiscomplete,thelinktoDMAchannel0ismadeAllsettingismadeusingtheQuickStartConfigurationTool,refertoReference3.
ASDCADCresultqueuePre-processedanalogvaluesDMAtransferADconverterAbBADCtriggerADCtriggerADCtriggerlinktoouterloopcontrollerlinktoinnerloopcontrollerlinktoinnerloopcontrollerafilterfilterbitshiftbitshift-offset-offsetsignswitchsignswitchBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor404.
5eTPUTimingeTPUprocessingisevent-driven.
Onceaneventservicebegins,itsexecutioncannotbeinterruptedbyanothereventservice.
Theothereventserviceshavetowait,whichcausesaservicerequestlatency.
Themaximumservicerequestlatency,orworstcaselatency(WCL),differsforeacheTPUchannel.
TheWCLisaffectedbythechannelpriorityandactivityonotherchannels.
TheWCLofeachchannelmustbekeptbelowarequiredlimit.
Forexample,theWCLofthePWMCchannelsmustbelowerthanthePWMperiod.
AtheoreticalcalculationofWCLs,foragiveneTPUconfiguration,isnotatrivialtask.
ThemotorcontroleTPUfunctionsintroduceadebuggingfeaturethatenablestheusertocheckchannellatenciesusinganoscilloscope,andeliminatesthenecessityoftheoreticalWCLcalculations.
Asmentionedearlier,someeTPUfunctionsarenotintendedtoprocessanyinputoroutputsignalsfordrivingthemotor.
Thesefunctionsturntheoutputpinhighandlow,sothatthehigh-timeidentifiestheperiodoftimeinwhichthefunctionexecutionisactive.
Anoscilloscopecanbeusedtodeterminehowmuchthechannelactivitypulsevariesintime,whichindicatesthechannelservicelatencyrange.
Forexample,whentheoscilloscopetimebaseissynchronizedwiththePWMperiods,thebehaviorofatestedchannelactivitypulsecanbedescribedbyoneofthefollowingcases:ThepulseisasynchronouswiththePWMperiods.
ThismeansthatthetestedchannelactivityisnotsynchronizedwiththePWMperiods.
ThepulseissynchronouswiththePWMperiodsandstable.
ThismeansthatthetestedchannelactivityissynchronouswiththePWMperiodsandisnotdelayedbyanyservicelatency.
ThepulseissynchronouswiththePWMperiodsbutitspositionvariesintime.
ThismeansthatthetestedchannelactivityissynchronouswiththePWMperiodsandtheservicelatencyvariesinthistimerange.
SoftwareDesignBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor41Figure31.
OscilloscopeScreenshotandExplanationofeTPUTimingFigure31explainstheapplicationeTPUtiming.
Theoscilloscopescreen-shotdepictsatypicalsituationdescribedbelow.
AliveviewontheoscilloscopescreenenablestheusertoseethevariationofSCandPWMMDCactivitypulses,whichdeterminesthechannelservicelatencyranges.
InFigure31,signals3(pink)and4(green)arePWMsignalsofonephase.
Itisacomplementarypairofcenter-alignedPWMsignals.
Thebasechannel(3)isofactive-highpolarity,whilethecomplementarychannel(4)isactive-low.
ThePWMphasecommutationisrecognizableonthescreen.
ThePWMperiodis50s,whichcorrespondstoaPWMfrequencyof20kHz.
Signal1(blue)isgeneratedbytheSpeedController(SC)eTPUfunction.
ItspulsesdeterminetheactivityoftheSC.
ThepulsewidthdeterminesthetimenecessarytocalculatethemotorspeedfromarevolutionperiodmeasuredbytheHallDecoder(HD),calculatetherequiredspeedramp,andapplythePIcontrolleralgorithm.
Thisoutputisthenewvalueofappliedmotorvoltage.
Thiscalculationisperformedperiodicallyata10kHzrate,whichiseverysecondPWMperiod.
Signal2(cyan)isgeneratedbythePWMMasterforDCMotors(PWMMDC)eTPUfunction.
ItspulsesdeterminetheactivityofthePWMMDC.
ImmediatelyaftereachSCpulse,averynarrowPWMMDCpulseoccurs.
ThesepulsesdeterminetheservicetimeofanSCrequesttoupdatethenewvalueofappliedmotorvoltage.
Apartfromthesepulses,foreveryPWMperiod,apulsewillappearwhichsignalsaPWMupdate.
ThePWMupdateactivitypulseissometimesnarrowandsometimeswide.
ThepulseiswidewhenSCactivityPWMDCupdatesPWMperiodscommutationSCPWMCPWMCPWMMDCBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SoftwareDesignFreescaleSemiconductor42anewvalueofappliedmotorvoltagehasbeenprocessed;itisnarrowwhennonewvaluehasbeenprocessedandthePWMduty-cyclesarenotupdated.
TheliveviewontheoscilloscopescreenshowsthattherangeoftheSCandPWMMDCchannelservicelatenciesareverylow.
TheonlynoticeablelatencyiscausedbyHallDecoder(HD)activity.
TheHDeTPUfunctionprocessestheHallsignalstransitionsandcommutesthePWMphases.
TheHallsignalstransitionscomeasynchronouslywiththePWMperiods.
Thefs_etpu_pwmmdc_init_3phfunctionparameterupdate_timeenablestheusertoadjustthepositionofthePWMMDCactivitypulserelativetothePWMperiodframe.
Theactivitypulsehasascheduledupdate_timepriortotheendoftheperiodframe,sothattheupdateisfinishedbytheendoftheperiodframe,evenintheworstcaselatency.
Reference11describeshowtosettheupdate_timevalue.
Thedifferencebetweenthevaluesofthefs_etpu_pwmmdc_init_3phfunctionparameterstart_offset,andthefs_etpu_sc_initfunctionparameterstart_offset,determinesthepositionoftheSCactivitypulserelativetothePWMperiodframe.
TheSCactivityprecedesthePWMMDCactivity,sothattheworstcaseSClatencydoesnotaffectthePWMMDClatency.
Figure32.
OscilloscopeScreenshotandExplanationofASDCandBCTimingPWMperiodsBC-PWMperiodBCPWMCPWMCASDCASDCedge_offsetImplementationNotesBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor43Figure32explainsthetimingofASDCandBCeTPUfunctions.
Signals3(pink)and4(green)arePWMsignalsofonephase,asinFigure31.
Signal2(cyan)isgeneratedbytheASDCeTPUfunction.
TheASDCfunctiontriggerstheADconverterbygeneratingaDMArequestonahigh-lowedge(activelowpolarityofASDC)andsimultaneouslysendingthelinktotheBCchannelevery16thASDCperiod(seeFigure32).
ThepositionoftheASDCfirstedgeissynchronizedwiththebeginningofthePWMperiod.
ThetimebetweenthePWMperiodbeginningandtheASDCfirstedgeequalstoone-quarterofthePWMperiod.
TheASDCpulsewidthdeterminesthetimenecessarytosampletheDC-busvoltageandtotransferthissampledvaluetotheeTPUdatamemory.
ASDCstartsmeasuredsamplepreprocessingatthetimeofthesecondedgewhenasampleissupposedtobereadyintheeTPUdatamemory.
ThebreakcontrollereTPUfunctionrespondstothelinkgeneratedbytheASDCfunctionevery16thASDCperiod.
Whenthebreakcontrollerchannelreceivesthelink,theupdatedvalueofDC-busvoltageiscomparedwiththedefinedover-voltagethresholds,andaccordingtothiscomparisonitgeneratesthePWM-basedbreakcontrolsignal-signal1(blue)inFigure32.
Theperiodofthissignalis200s,whichcorrespondstothefrequencyof5kHz.
5ImplementationNotes5.
1ScalingofQuantitiesTheBLDCmotorcontrolalgorithmrunningoneTPUusesa24-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)eTPUfunctioncalculatestheangularmotorspeedusingarevolutionperiodmeasuredbytheHallDecoder(HD)eTPUfunction.
Optionally,theSpeedControllercanusethesectorperiodinsteadoftherevolutionperiod.
ThesectorperiodisthetimebetweentwoconsecutiveHallsignalFractionalValueRealValueRealQuatityRange-=BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1ImplementationNotesFreescaleSemiconductor44transitions.
Asumofsixsectorperiodsequalsonerevolutionperiod.
Ataconstantspeed,eachofthesixsectorperiodsmayhaveaslightlydifferentvalue,causedbyanangularerrorintheHallsensorpositions.
ThiserroraffectsthePIcontrollerbehaviorinanegativeway.
TherevolutionperiodisnotaffectedbythiserrorbecausetheperiodismeasuredfromaparticularHallsignaltransitiontothesametransitiononerevolutionlater.
Therevolutionperiodisupdatedoneachtransition-sixtimesperperiod.
TherevolutionperiodmeasuredbytheHDistheperiodofoneelectricalrevolution.
Theelectricalrevolutionisrelatedtothemechanicalrevolutionviathenumberofmotorpole-pairs.
ThePittmanBLDCmotor(N2311)isa4pole-pairmotor.
Hence,themechanicalrevolutionperiodisaperiodoffourelectricalrevolutions.
TheSpeedControllercalculatestheangularmotorspeedusingthefollowingequation:where:omega_actual[fract24]istheactualangularspeedasafractionofthemaximumspeedrange1isexpressedasfractionalvalue0x7FFFFFrevolution_period[numberofTCRticks]istheperiodofoneelectricalrevolutionscaling_factorispre-calculatedusingthefollowingequationwhere:etpu_tcr_freq[Hz]isafrequencyoftheinternaleTPUtimer(TCR2)usedomega_max[RPM]isamaximalspeedrangepole_pairsisanumberofmotorpole-pairsTheinternaleTPUtimer(TCR2)frequencymustbesetsothatthecalculationofomega_actualbothfitsintothe24-bitsarithmeticanditsresolutionissufficient.
5.
3DefinitionofCommutationTablesThePWMphasesarecommutedoneachoftheHallsignaltransitions.
ThisisinternallydonebyapplyingtwocommutationcommandsthatareassociatedwiththeparticularHallsignaltransition.
Thefirstcommandturnsaphaseoff,andthesecondturnsanotherphaseon.
SuchpairsofcommutationcommandsmustbedefinedforeachHallsignaltransition,low-highandhigh-low,oneachphase,andforbothmotordirections.
Thesedefinitionsarelocatedinetpu_app_bldcmhsl1.
cfile.
Eachcommutationcommandisa32-bitwordthatconsistsofthefollowing8-bitparts.
ChannelnumberofthePWMphasebasechannelNewbasechannelcommutationstate.
Itcanbe:—ON_ACTIVE_HIGH—ON_ACTIVE_LOW—OFF_LOW—OFF_HIGHomega_actual1revolution_period-scaling_factor=scaling_factor60etpu_tcr_freqomega_maxpole_pairs=ImplementationNotesBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor45Newcomplementarychannelcommutationstate.
Itcanbe:—ON_ACTIVE_HIGH—ON_ACTIVE_LOW—OFF_LOW—OFF_HIGHNewphaseoptions:—DUTY_POS—DUTY_NEG.
Forafulldescriptionofallcommutationcommandoptions,refertoReference14.
Figure33depictsthePittmanBLDCmotor(N2311)motortimingdiagram.
Thefollowingexampledescribeshowtodefineseveralofthecommutationcommandsbasedonthistimingdiagram:AHallsignalphaseAlow-hightransitioncomesat300electricaldegrees(bluedottedline).
ThePWMphaseBisturnedoff,withthepininlowstate,andphaseAon,withactive-highpolarityonthebasechannelandactive-lowpolarityonthecomplementarychannel,onthistransition.
Furthermore,thePWMphaseBoptionissettonotchangethecalculatedduty-cyclevalue,andthephaseAoptionissettonegatethesignedduty-cyclevalue,whichgeneratesanegativevoltage.
OnphaseA,thisappliesimmediately,while,onphaseB,thiswillapply60degreeslater,whenthephaseiscommutedonagain.
So,thecommutationcommandsassociatedwiththephaseAlow-hightransitioninanincrementalmotordirectionaredefined,usingpredefinedmacros,asfollows:phaseA_commut_cmds.
lh_i_0=PWM_phaseB_channel+(FS_ETPU_PWMMDC_OFF_LOW<<8)+(FS_ETPU_PWMMDC_OFF_LOW<<16)+(FS_ETPU_PWMMDC_DUTY_POS<<24)phaseA_commut_cmds.
lh_i_1=PWM_phaseA_channel+(FS_ETPU_PWMMDC_ON_ACTIVE_HIGH<<8)+(FS_ETPU_PWMMDC_ON_ACTIVE_LOW<<16)+(FS_ETPU_PWMMDC_DUTY_NEG<<24)BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1ImplementationNotesFreescaleSemiconductor46Figure33.
PittmanBLDCMotor(N2311)TimingDiagramFordecrementaldirection,readthemotortimingdiagramfromrighttoleft.
TheHallsignalphaseAlow-hightransitioncomesat120electricaldegrees(reddottedline).
ThePWMphaseAisturnedoffandphaseBonduringthistransition.
ThePWMphaseAoptionissettonegatetheduty-cycleinordertogeneratenegativephasevoltage,andthephaseBoptionnottonegateinordertogeneratepositivevoltage.
So,thecommutationcommandsassociatedwiththephaseAlow-hightransitioninadecrementalmotordirectionareasfollows:phaseA_commut_cmds.
lh_d_0=PWM_phaseA_channel+(FS_ETPU_PWMMDC_OFF_LOW<<8)+(FS_ETPU_PWMMDC_OFF_LOW<<16)+(FS_ETPU_PWMMDC_DUTY_NEG<<24)phaseA_commut_cmds.
lh_d_1=PWM_phaseB_channel+(FS_ETPU_PWMMDC_ON_ACTIVE_HIGH<<8)+(FS_ETPU_PWMMDC_ON_ACTIVE_LOW<<16)+(FS_ETPU_PWMMDC_DUTY_POS<<24)Thiswayallcommutationcommandscanbedefined0°60°120°180°240°300°360°HallsignalPhaseAHallsignalPhaseBHallsignalPhaseCvoltagePhaseAvoltagePhaseBvoltagePhaseCMicroprocessorUsageBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor476MicroprocessorUsageTable3showshowmuchmemoryisneededtoruntheapplication.
TheeTPUmoduleusageintermsoftimeloadcanbeeasilydeterminedbasedonthefollowingfacts:AccordingtoReference14,themaximumeTPUloadproducedbyPWMgenerationis946eTPUcyclesperonePWMperiod.
ThePWMfrequencyissetto20kHz,thusthePWMperiodis3200eTPUcycles(eTPUmoduleclockis64MHz,halfofthe128MHzCPUclock).
AccordingtoReference8,theSpeedControllercalculationtakes244eTPUcycles.
ThecalculationisperformedeverysecondPWMperiod.
AccordingtoReference9,theprocessingofoneHallsignaltransition,includingthecommutation,takes308eTPUcycles.
TheHallsignaltransitionscomeasynchronouslytothePWMperiods.
Sixtransitionsareprocessedperoneelectricalmotorrevolution.
AccordingtoReference13,theASDCmaximumeTPUloadtakes42+80eTPUcycles(boththefirstandthenthesecondedgeprocessingisperformed).
TheASDCfunctionprocessingisexecutedeveryPWMperiod.
AccordingtoReference12,theBCmaximumeTPUloadperoneupdateinslavePWMswitchingmodeis64eTPUcycles,andtheBCmaximumeTPUloadperonePWMedgeis20eTPUcycles.
TheBCupdateisperformedevery16PWMperiods.
PWMfrequencyoftheDC-busbreakcontrolsignalis5kHz,whichmeansthattheBC-PWMupdateisperformedevery4PWMperiods.
ThevaluesofeTPUloadbyeachofthefunctionsareinfluencedbycompilerefficiency.
Theabovenumbersaregivenforguidanceonlyandaresubjecttochange.
Foruptodateinformation,refertotheinformationprovidedinthelatestreleaseavailablefromFreescale.
ThepeakoftheeTPUtimeloadoccurswhenboththeSpeedControllercalculationandaHallsignaltransitionareprocessedwithinonePWMperiod.
Thispeakvaluemustbekeptbelow100%,whichensuresthatallprocessingfitsintothePWMperiod,noservicelatencyislongerthanthePWMperiod,andthusthegeneratedPWMsignalsarenotaffected.
Table3.
MemoryUsageinBytesMemoryAvailableUsedFLASH2M31820RAM64K3460eTPUcodeRAM16K6120eTPUdataRAM3K600BLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1SummaryandConclusionsFreescaleSemiconductor48Table4showstheeTPUmoduletimeloadinseveraltypicalsituations.
7SummaryandConclusionsThisapplicationnoteprovidestheuserwithadescriptionofthedemoapplication3-phaseBLDCMotorwithSpeedClosedLoop.
TheapplicationalsodemonstratesusageoftheeTPUmoduleonthePowerPCMPC5554,whichresultsinaCPUindependentmotordrive.
Lastly,thedemoapplicationistargetedattheMPC5554familyofdevices,butitcouldbeeasilyreusedwithanydevicethathasaneTPU.
Table4.
eTPUTimeLoadSituationAverageTimeLoad[%]PeakTimeLoadWithinPWMPeriod[%]MotorSpeed300RPM(120commutationspersecond)31.
945.
4MotorSpeed10000RPM(4000commutationspersecond)33.
545.
4ReferencesBLDCMotorwithSpeedClosedLoopandDC-BusBreakController,DrivenbyeTPUonMPC5554,Rev.
1FreescaleSemiconductor498ReferencesTable5.
References1.
MPC5554ReferenceManual,MPC5554RM2.
MPC5554DEMOUser'sManual,MPC5554DEMOEVBUM3.
MPC5550QuickStartUser'sManual4.
33395EvaluationMotorBoardDesignerReferenceManualDRM33395/D5.
InterfaceBoardwithUNI-3User'sManual6.
Pittman'sMotorsweb:http://www.
pittmannet.
com7.
FreeMASTERwebpage,http://www.
freescale.
com,searchkeyword"FreeMASTER"8.
EnhancedTimeProcessingUnitReferenceManual,ETPURM9.
UsingtheHallDecoder(HD)eTPUFunction,AN284110.
UsingtheSpeedController(SC)eTPUFunction,AN284311.
UsingtheDCMotorControlPWMeTPUFunctions,AN248012.
UsingtheBreakController(BC)eTPUFunction,"AN284513.
UsingtheAnalogSensingforDCMotors(ASDC)eTPUFunction,"AN284614.
UsingtheDCMotorControleTPUFunctionSet(set3),AN295815.
eTPUGraphicalConfigurationTool,http://www.
freescale.
com,searchkeyword"ETPUGCT"16.
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.
AN3007Rev.
105/2006

酷番云-618云上秒杀,香港1核2M 29/月,高防服务器20M 147/月 50M 450/月,续费同价!

官方网站:点击访问酷番云官网活动方案:优惠方案一(限时秒杀专场)有需要海外的可以看看,比较划算29月,建议年付划算,月付续费不同价,这个专区。国内节点可以看看,性能高IO为主, 比较少见。平常一般就100IO 左右。优惠方案二(高防专场)高防专区主要以高防为主,节点有宿迁,绍兴,成都,宁波等,节点挺多,都支持防火墙自助控制。续费同价以下专场。 优惠方案三(精选物理机)西南地区节点比较划算,赠送5...

pacificrack:超级秒杀,VPS低至$7.2/年,美国洛杉矶VPS,1Gbps带宽

pacificrack又追加了3款特价便宜vps搞促销,而且是直接7折优惠(一次性),低至年付7.2美元。这是本月第3波便宜vps了。熟悉pacificrack的知道机房是QN的洛杉矶,接入1Gbps带宽,KVM虚拟,纯SSD RAID10,自带一个IPv4。官方网站:https://pacificrack.com支持PayPal、支付宝等方式付款7折秒杀优惠码:R3UWUYF01T内存CPUSS...

Contabo美国独立日促销,独立服7月€3.99/月

Contabo自4月份在新加坡增设数据中心以后,这才短短的过去不到3个月,现在同时新增了美国纽约和西雅图数据中心。可见Contabo加速了全球布局,目前可选的数据中心包括:德国本土、美国东部(纽约)、美国西部(西雅图)、美国中部(圣路易斯)和亚洲的新加坡数据中心。为了庆祝美国独立日和新增数据中心,自7月4日开始,购买美国地区的VPS、VDS和独立服务器均免设置费。Contabo是德国的老牌服务商,...

46sw.com为你推荐
杰景新特谁给我一个李尔王中的葛罗斯特这个人物的分析?急 ....先谢谢了www.33xj.compro/engineer 在哪里下载,为什么找不到下载网站?www.toutoulu.com外链方案到底应该怎么弄呢干支论坛天干地支常识?云鹏清16届大学生篮球联赛西北赛前八强云鹏清动如脱兔 静若处子 怎么解释酒仙琐事"酒仙"指的是什么人?网站检测工具网站数据分析员都在使用那些工具监测网站啊?采采风荷莫言春度芳菲尽,别有中流采麦荷 啥意思窝尚公寓蜗尚公寓是个什么网?蜗尚公寓到底是做什么的?
域名估价 Oray域名注册服务商 2019年感恩节 美元争夺战 免备案空间 国外空间服务商 godaddy支付宝 淘宝双十一2018 本网站服务器在美国 中国智能物流骨干网 域名评估 php空间购买 购买国外空间 免费asp空间 广州虚拟主机 德讯 网络速度 winserver2008 防盗链 美国服务器 更多