observes46sw.com

46sw.com  时间:2021-04-08  阅读:()
FreescaleSemiconductor,Inc.
,2005.
Allrightsreserved.
FreescaleSemiconductorApplicationNoteAN2948Rev.
2,09/2005TableofContentsThisapplicationnotedescribesthedesignofmultiple3-phasebrushlessDC(BLDC)motorsdrivenbyFreescale'sColdFireMCF523xmicroprocessor.
Theapplicationdesigntakesadvantageoftheenhancedtimeprocessingunit(eTPU)module,whichisusedasamotorcontrolco-processor.
TheeTPUcompletelyhandlesthemotorcontrolprocessingrequiredtodrivethreemotorssimultaneously,eliminatingthemicroprocessoroverheadforotherduties.
BLDCmotorsareverypopularinawidearrayofapplications.
ComparedtoaDCmotor,theBLDCmotorusesanelectriccommutator(replacingthemechanicalcommutator),makingitmorereliablethantheDCmotor.
InBLDCmotors,rotormagnetsgeneratetherotor'smagneticflux,makingBLDCmotorsmoreefficientandwell-suitedforhigh-endwhitegoods(refrigerators,washingmachines,dishwashers,etc.
),high-endpumps,fans,andotherappliancesthatrequirehighreliabilityandefficiency.
Theconceptoftheapplicationistocreateaspeed-closedloopBLDCdriverusingaHallpositionsensor.
ItservesasanexampleofaBLDCmotorcontrolsystemdesign1ColdFireMCF523xandeTPUAdvantagesandFeatures22TargetMotorTheory.
43SystemConcept.
84SoftwareDesign175ImplementationNotes366MicroprocessorUsage407SummaryandConclusions418References42Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523xCoversMCF523xandalleTPU-equippedDevicesby:MilanBrejl&MichalPrincSystemApplicationEngineersRoznovCzechSystemCenterThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2ColdFireMCF523xandeTPUAdvantagesandFeaturesFreescaleSemiconductor2usingaFreescalemicroprocessorwiththeeTPU.
ItalsoillustratestheusageofdedicatedmotorcontroleTPUfunctionsthatareincludedinthemotorcontroleTPUfunctionset.
Thisapplicationnoteincludesbasicmotortheory,systemdesignconcept,hardwareimplementation,andmicroprocessorandeTPUsoftwaredesign,includingtheFreeMastervisualizationtool.
Figure1.
M523xEVB,MicroPowerStagefor3BLDCMotorsand3PittmanBLDCMotors1ColdFireMCF523xandeTPUAdvantagesandFeatures1.
1ColdFireMCF523xMicroprocessorTheMCF523xisafamilyofhighly-integrated,32-bitmicroprocessorsbasedontheV2ColdFirecore.
Itfeaturesa16-or32-channeleTPU,64KbytesofinternalSRAM,a2-bankSDRAMcontroller,four32-bittimerswithDMArequestcapability,a4-channelDMAcontroller,uptotwoCANmodules,threeUARTs,andaqueuedSPI.
TheMCF523xfamilyhasbeendesignedforgeneralpurposeindustrialcontrolapplications.
Itisalsoahigh-performanceupgradeforusersoftheMC68332.
ColdFireMCF523xandeTPUAdvantagesandFeaturesThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor3This32-bitdeviceisbasedontheversion2ColdFirereducedinstructionsetcomputer(RISC)core,operatingatacorefrequencyofupto150MHzandabusfrequencyofupto75MHz.
On-chipmodulesincludethefollowing:V2ColdFirecorewithanenhancedmultiply-accumulateunit(EMAC)providing144Dhrystone2.
1MIPS@150MHzeTPUwith16or32channels,6Kbytesofcodememory,and1.
5KbytesofdatamemorywitheTPUdebugsupport64KbytesofinternalSRAMExternalbusspeedofhalftheCPUoperatingfrequency(75MHzbus@150MHzcore)10/100Mbpsbus-masteringEthernetcontroller8Kbytesofconfigurableinstruction/datacacheThreeuniversalasynchronousreceiver/transmitters(UARTs)withDMAsupportControllerareanetwork2.
0B(FlexCANmodule)—OptionalsecondFlexCANmodulemultiplexedwiththethirdUARTInter-integratedcircuit(I2C)buscontrollerQueuedserialperipheralinterface(QSPI)moduleHardwarecryptographyaccelerator(optional)—Randomnumbergenerator—DES/3DES/AESblockcipherengine—MD5/SHA-1/HMACaccelerator4-channel,32-bitdirectmemoryaccess(DMA)controller4-channel,32-bitinputcapture/outputcomparetimerswithoptionalDMAsupport4-channel,16-bitperiodicinterrupttimers(PITs)ProgrammablesoftwarewatchdogtimerInterruptcontrollercapableofhandlingupto126interruptsourcesClockmodulewithphaselockedloop(PLL)Externalbusinterfacemoduleincludinga2-banksynchronousDRAMcontroller32-bit,non-multiplexedbuswithupto8chipselectsignalsthatsupportpage-modeFLASHmemoriesFormoreinformation,refertoReference1.
1.
2eTPUModuleTheeTPUisanintelligent,semi-autonomousco-processordesignedfortimingcontrol,I/Ohandling,serialcommunications,motorcontrol,andenginecontrolapplications.
ItoperatesinparallelwiththehostCPU.
TheeTPUprocessesinstructionsandreal-timeinputevents,performsoutputwaveformgeneration,andaccessesshareddatawithoutthehostCPU'sintervention.
Consequently,thehostCPUsetupandservicetimesforeachtimereventareminimizedoreliminated.
Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2TargetMotorTheoryFreescaleSemiconductor4TheeTPUhasupto32timerchannels,inadditiontohaving6Kbytesofcodememoryand1.
5Kbytesofdatamemorythatstoresoftwaremodulesdownloadedatboottime,andcanbemixedandmatchedasneededforanyapplication.
TheeTPUprovidesmorespecializedtimerprocessingthanthehostCPUcanachieve.
ThisispartiallyduetotheeTPUimplementation,whichincludesspecificinstructionsforhandlingandprocessingtimeevents.
Inaddition,channelconditionsareavailableforusebytheeTPUprocessor,thuseliminatingmanybranches.
TheeTPUcreatesnohostCPUoverheadforservicingtimingevents.
Formoreinformation,refertoReference6.
2TargetMotorTheoryAbrushlessDC(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)ShaftRotorAirgapPermanentmagnetsTargetMotorTheoryThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor5Figure3.
VoltageStrokesAppliedtothe3-PhaseBLDCMotorForthecommon3-phaseBLDCmotor,astandard3-phasepowerstageisused(seeFigure4).
Thepowerstageutilizessixpowertransistorsthatoperateineitheranindependentorcomplementarymode.
Inbothmodes,the3-phasepowerstageenergizestwomotorphasesconcurrently.
Thethirdphaseisunpowered(seeFigure3).
Thus,wegetsixpossiblevoltagevectorsthatareappliedtotheBLDCmotorusingapulsewidthmodulation(PWM)technique(seeFigure5).
Therearetwobasictypesofpowertransistorswitchingschemes:independentandcomplementary.
Bothswitchingmodesareabletoworkinbipolarorunipolarmode.
ThepresentedapplicationutilizesthecomplementarybipolarPWMmode.
FormoreinformationaboutPWMtechniques,refertoReference13.
Figure4.
3-PhaseBLDCPowerStage306090120150180210240270300330ElectricalangleVoltagePhaseAPhaseBPhaseC+UDCB-UDCB+UDCB-UDCB+UDCB-UDCBQ1PWM_Q5Q6Q4C1Phase_CPWM_Q1PWM_Q4PWM_Q3Phase_BGNDQ2UDCBPWM_Q2Phase_AQ3PWM_Q6Q5Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2TargetMotorTheoryFreescaleSemiconductor62.
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.
TargetMotorTheoryThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor7Figure6.
SituationRightBeforeCommutation(Counter-ClockwiseMotion)Figure7.
SituationRightAfterCommutation2.
1.
2SpeedControlCommutationensurestheproperrotorrotationoftheBLDCmotor,whilethemotorspeedonlydependsontheamplitudeoftheappliedvoltage.
TheamplitudeoftheappliedvoltageisadjustedusingthePWMtechnique.
Therequiredspeediscontrolledbyaspeedcontroller,whichisimplementedasaconventionalproportional-integral(PI)controller.
ThedifferencebetweentheactualandrequiredspeedsisinputtothePIcontrollerwhichthen,basedonthisdifference,controlsthedutycycleofthePWMpulseswhichcorrespondtothevoltageamplituderequiredtomaintainthedesiredspeed.
Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SystemConceptFreescaleSemiconductor8Figure8.
SpeedControllerThespeedcontrollercalculatesthePIalgorithmgivenintheequationbelow:AftertransformingtheequationintoadiscretetimedomainusinganintegralapproximationwiththeBackwardEulermethod,wegetthefollowingequationsforthenumericalPIcontrollercalculation:where:3SystemConcept3.
1SystemOutlineThesystemisdesignedtodrivethree3-phaseBLDCmotor.
Theapplicationmeetsthefollowingperformancespecifications:VoltagecontrolofaBLDCmotorusingHallsensorsTargetedatColdFireMCF523xevaluationboard(M523xEVB),micropowerstagefor3BLDCmotors,andthreePittmanBLDCmotors(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()=SystemConceptThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor9Controltechniqueincorporates:—VoltageBLDCmotorcontrolwithspeed-closedloop—Bothdirectionsofrotation—4-quadrantoperation—Startfromanymotorpositionwithoutrotoralignment—Minimumspeedof500RPM—Maximumspeedof10000RPM(limitedbypowersupply)FreeMastercontrolinterface(powerswitch,speedsset-up,indicators)FreeMASTERmonitor—FreeMASTERgraphicalcontrolpage(requiredspeeds,actualmotorspeeds,start/stopstatus,faultstatus)—FreeMASTERspeedscope(observesrequired,ramp,andactualspeeds)—FreeMASTERHallsensorsscope(observesactualHallsensorsstates,motordirections,andrevolutioncounters)DCbusover-currentfaultprotection3.
2ApplicationDescriptionAstandardsystemconceptischosenforthemotorcontrolfunction(seeFigure9).
Thesystemincorporatesthefollowinghardware:EvaluationboardM523xEVBMicropowerstagefor3BLDCmotorsThreePittmanBLDCmotors(N2311)withHallsensorsPowersupply12VDC,5AThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SystemConceptFreescaleSemiconductor10TheeTPUmodulerunsthemaincontrolalgorithm.
The3-phasePWMoutputsignalsfora3-phaseinverteraregeneratedaccordingtofeedbacksignalsfromHallsensorsandtheinputvariablevalues,providedbythemicroprocessorCPU.
Figure9.
SystemConceptThesystemprocessingisdistributedbetweentheCPUandtheeTPU,whichbothruninparallel.
TheCPUperformsthefollowingtasks:CommunicateswiththeFreeMASTERuserinterface.
Basedontheuserinput,ithandlestheapplicationstatemachineandcalculatestherequiredspeedsthatispassedtotheeTPU.
PeriodicallyreadsapplicationdatafromETPUDATARAMinordertomonitorapplicationvariables.
Intheeventofanovercurrentfault,thePWMoutputsareimmediatelytemporarilydisabledbytheeTPUhardware.
Then,afteraninterruptlatency,theCPUdisablesthePWMoutputspermanentlyanddisplaysthefaultstate.
TheeTPUperformsthefollowingtasks:3x6eTPUchannels(PWMC)areusedtogeneratePWMoutputsignals.
3x3eTPUchannels(HD)areusedtoprocessHallsensorsignals.
Oneachincomingedge,arevolutionperiodiscalculatedandthePWMoutputsignalsarecommuted.
OneeTPUchannel(GPIO)isusedtogenerateaninterrupttotheCPUwhentheover-currentfaultsignalactivates.
3x1eTPUchannel(PWMMDCSC)isinternallyusedtoclosethespeedloop.
Theactualmotorspeediscalculatedbasedontherevolutionperiodandcomparedwiththerequiredspeed,providedbytheCPUandpassedthrougharamp.
AspeedPIcontrolalgorithmprocessestheerrorbetweentherequiredandtheactualspeed.
ThePIcontrolleroutputispassedtothePWMgeneratorasanewcorrectedvalueofappliedmotorvoltage.
eTPUGPIOenable/disablePWMsignalsrequiredspeed1ApplicationStateMachineover-currentinterruptON/OFFswitchstatusdatamonitoringFaultLEDCPUHardware12VDCUARTFreeMasterRemoteControlRS232FaultSignalThreeBLDCMotorDriveBLDCmotor1HallSensorPWMSignalsStatusLEDBLDCmotor23-PhaseMicroPowerStagefor3MotorsSignalsBLDCmotor3requiredspeed2requiredspeed3SystemConceptThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor11Figure10.
TheApplicationandFreeMASTERScreen3.
2.
1UserInterfaceFreeMASTERsoftwareservesastheapplicationinterface.
Thissoftwarewasdesignedtoprovideanapplication-debugging,diagnostic,anddemonstrationtoolforthedevelopmentofalgorithmsandapplications.
ItrunsonaPCconnectedtotheM523xEVBviaanRS232serialcable.
AsmallprogramresidentinthemicroprocessorcommunicateswiththeFreeMASTERsoftwaretoreturnstatusinformationtothePCandprocesscontrolinformationfromthePC.
FreeMASTERsoftware,executingonaPC,usespartofMicrosoftInternetExplorerastheuserinterface.
Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SystemConceptFreescaleSemiconductor12ThepowerswitchontheFreeMASTERcontrolpageaffectstheapplicationstatebyenablinganddisablingthePWMphases.
Whentheswitchisintheoff-position,novoltageisappliedtothemotorwindings;it'sintheon-position,themotorspeedcanbecontrolledbyclickingonthegauge,draggingthegaugeneedletotherequestedspeedvalue,orsettingtherequestedvaluesinthewatchsectionatthebottomofthescreen.
Inadditiontothat,FreeMASTERalsodisplaysreal-timevaluesofapplicationvariablesandtheirtimebehaviorusingscopes.
Note,thatFreeMASTERversion1.
2.
31.
1orhigherisrequired.
TheFreeMASTERapplicationcanbedownloadedfromhttp://www.
freescale.
com.
FormoreinformationaboutFreeMASTER,refertoReference5.
3.
3HardwareImplementationandApplicationSetupAspreviouslystated,theapplicationrunsontheMCF523xfamilyofColdFiremicroprocessorsusingthefollowing:M523xEVBMicropowerstagefor3BLDCmotorsThree3-phasepittmanBLDCmotor(N2311)Powersupply,12VDC,minimum4.
5AFigure11showstheconnectionoftheseparts.
AllsystempartsaresuppliedbyFreescaleanddocumentedaccordingtoreferences.
3.
3.
1ColdFireMCF523xEvaluationBoard(M523xEVB)TheEVBisintendedtoprovideamechanismforcustomerstoeasilyevaluatetheMCF523xfamilyofColdFiremicroprocessors.
TheheartoftheevaluationboardistheMCF5235;allotherM523xfamilymembershaveasubsetoftheMCF5235featuresandcanthereforebefullyemulatedusingtheMCF5235device.
TheM523xEVBisfittedwithasingle512Kx16page-modeFLASHmemory(U19),givingatotalmemoryspaceof2Mbytes.
Alternatively,afootprintisavailableforupgradingflashtoa512Kx32page-modeFLASHmemory(U35),doublingthememorysizeto4Mbytes.
Formoreinformation,refertoReference2.
Table1listsallM523xEVBjumpersettingsusedintheapplication.
SystemConceptThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor13Figure11.
ConnectionofApplicationPartsTable1.
M523xEVBJumperSettingsJumperSettingJumperSettingJumperSettingJumperSettingJP1JP2JP3JP4JP5JP6JP7JP8JP9121-2121-21-231-2312-31-231-23JP20JP21JP22JP23JP24JP25JP26JP27JP28JP291-231-231-231-231-231-231-231-21-21-2JP40JP41JP42JP43JP44JP45JP46JP47JP48JP491-21-21-21-21-21-21-21-21-21-2JP60JP61JP62JP63JP641-21-2121212-3DIP1DIP2DIP3DIP4DIP5DIP6DIP7DIP8DIP9DIP10DIP11DIP12ONONONONONONOFFONONONOFFONJP10JP11JP12JP13JP14JP15JP16JP17JP18JP191-231-2312-31-231-231-231-231-231-231-23JP30JP31JP32JP33JP34JP35JP36JP37JP38JP391-212-31-231-21-21-231-231-21-21-2JP50JP51JP52JP53JP54JP55JP56JP57JP58JP591-231-231-231212121-231-21-21-2Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SystemConceptFreescaleSemiconductor143.
3.
2FlashingtheM523xEVBTheCFFlasherutilitycanbeusedforprogrammingcodeintotheFLASHmemoryontheMCF523xEVB.
Checkforcorrectsettingofswitchesandjumpers:SW7-6on,SW7-7off,JP642-3,(JP312-3).
Theflashingprocedureisasfollows:1.
RunMetrowerksCodeWarriorforColdFireandopentheproject.
Choosethesimple_eflashtargetandcompiletheapplication.
Afilesimple_eflash.
elf.
S19,whichwillbeloadedintoFLASHmemory,iscreatedintheprojectdirectorybin.
2.
RuntheCFFlasherapplication,clickonthe"TargetConfig"button.
IntheTargetConfigurationwindowselectthetypeofboardasM523xEVBandtheBDMCommunicationasPE_LPT(seeFigure12).
ClickOKtoclosethewindow.
3.
GototheProgramsectionbyclickingthe"Program"button.
Selectthesimple_eflash.
elf.
S19fileandcheckthe"Verifyafterprogram"option(seeFigure13).
Finally,pressthe"Program"buttonatthebottomofthewindowtostartloadingthecodeintotheFLASHmemory.
4.
Ifthecodehasbeenprogrammedcorrectly,removetheBDMinterfaceandpushtheRESETbuttonontheM523xEVB.
TheapplicationshouldnowrunfromtheFLASH.
TheCFFlasherapplicationcanbedownloadedfromhttp://www.
freescale.
com/coldfire.
Figure12.
CFFlasherTargetConfigurationWindowSystemConceptThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor15Figure13.
CFFlasherProgramWindow3.
3.
3SettingOvercurrentLevelTheover-currentfaultsignalisconnectedtotheeTPUoutputdisablepins(LTPUODIS,UTPUODIS)thathandletheeTPUhardwarefaults,alongwithapropereTPUconfiguration.
Thisconnectionispartofthemicropowerstagefor3BLDCmotors.
Inordertoenablehandlingofthefaultbysoftware,thefaultsignal,availableontheLTPUODISandtheUTPUODISpins,areconnectedtoeTPUchannel9whichrunstheGPIOfunctionandgeneratesinterruptrequesttotheCPUinthecaseofafault.
Theover-currentlevelissetbytrimmerR2onmicropowerstagefor3BLDCmotors(seeFigure14).
3.
3.
4MicroPowerStagefor3BLDCMotorsThemicropowerstageforthe3BLDCmotorsisa12V/5Asurface-mountpowerstage,whichissuppliedwitha40-pinribboncable.
IncombinationwiththeM523xEVB,itprovidesanout-of-the-boxsoftwaredevelopmentplatformforsmallbrushlessDCmotors.
Theboardisequippedwiththeover-currentprotection.
Theover-currentlevelissetbythetrimmerR2thatislocatedinthemiddleofthepowerstage.
AfaultisdetectedwhentheredLEDdiode(D2)islit.
Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SystemConceptFreescaleSemiconductor16Figure14.
OvercurrentTrimmerR2onMicroPowerStagefor3BLDCMotorsFigure15.
MicroPowerStagefor3BLDCMotorsFormoreinformation,refertoReference3.
3.
3.
5BLDCMotorwithHallSensorsTheenclosedmotorsarealow-voltagePittmanBLDCmotors(N2311).
ThemotorsiscapableofbeingcontrolledbyHallsensortechniques.
ThemotorcharacteristicsinTable2applytooperationat25°C.
SoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor17Figure25depictsthemotortiming.
Formoremotorspecifications,refertoReference4.
3.
3.
6PowerSupplyThepowersupply(12V/5A,60W)isusedtopowerthemicropowerstagefor3BLDCmotors.
TheMCF523xEVBispoweredbythemicropowerstagethroughthe2.
1mmpowerconnector.
ItisalsopossibletopowertheMCF523xEVBwithanindependentpowersupply(9-12V,1.
8A).
Theapplicationisscaledforthis12Vpowersupply.
Ifadifferentpowersupplyisused,theapplicationshouldberescaledforthedifferentvoltageandspeedrange.
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—176Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SoftwareDesignFreescaleSemiconductor18TheCPUsoftwareusesseveralready-to-useFreescalesoftwaredrivers.
ThecommunicationbetweenthemicroprocessorandtheFreeMASTERonaPCishandledbysoftwareincludedinfmaster.
c/.
hfiles.
TheeTPUmoduleusesthegeneraleTPUutilities,eTPUfunctioninterfaceroutines(eTPUfunctionAPI),andeTPUapplicationinterfaceroutines(eTPUapplicationAPI).
Thegeneralutilities,includedintheetpu_util.
c/.
hfiles,areusedforinitializationofglobaleTPUmoduleandenginesettings.
TheeTPUfunctionAPIroutinesareusedforinitializationoftheeTPUchannelsandinterfacingeacheTPUfunctionduringrun-time.
AneTPUapplicationAPIencapsulatesseveraleTPUfunctionAPIs.
TheuseofaneTPUapplicationAPIeliminatestheneedtoinitializeeacheTPUfunctionseparatelyandtohandlealleTPUfunctioninitializationsettings,andsoensuresthecorrectcooperationofeTPUfunctions.
Figure16.
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-57SWAN2864SWAN2958SWSoftwareLevelSourceCodeFilesOrigineTPUCodeUserwrittencodeFreescalesuppliedcodeGeneratedcodeByteCraftsuppliedcodeSoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor194.
1CPUSoftwareFlowchartFigure17.
CPUSoftwareFlowchartAfterreset,theCPUsoftwareinitializesperipherals,interrupts,andpins,andstartstheeTPUmodule.
Atthispoint,theCPUandtheeTPUruninparallel.
ThefollowingCPUprocessingisincorporatedintwoperiodictimerinterruptsandonefaultinterrupt.
4.
1.
1InitializationofInterruptsandPinsTheinitializationofTimer3,eTPUchannel9and28interrupts,andtheeTPUglobalexceptioninterrupt,togetherwithinitializationoftheGPIO,LTPUODIS,andUTPUODISpins,isdonebytheInitInterruptsAndPinsfunction.
4.
1.
2Timer3InterruptServiceRoutineThetimer3interruptishandledbythetimer3_isrfunction.
Thefollowingactionsareperformedperiodically,intimer3_isr:HandletheapplicationstatemachineTheapplicationstatediagramisdescribedindetailbelow.
ReadthedatastructurethroughtheeTPUapplicationAPIroutinefs_etpu_app_bldcmhsl3_get_data(see4.
3).
RESETInitializeinterruptsandpinswaitReadON/OFFswitchstatusHandleapplicationstatemachineServiceUp/DownbuttonsandStatusLEDReadapplicationdatastructureTimer3InterruptHandleovercurrentfaultFaultInterruptFreeMasterDispatcherFreeMasterTimerInterruptFreeMasterRecordereTPUChannelInterruptHandleeTPUglobalexceptioneTPUGlobalExceptionInterruptThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SoftwareDesignFreescaleSemiconductor204.
1.
3FreeMASTERInterruptServiceRoutineTheFreeMASTERinterruptserviceroutineiscalledfmasterDispatcher.
Thisfunctionisimplementedinfmaster.
c.
4.
1.
4eTPUChannelInterruptServiceRoutineThisinterrupt,whichisraisedeveryPWMperiodbythePWMMDCSC0eTPUfunctionrunningoneTPUchannel28,ishandledbytheetpu_ch28_isrfunction.
ThisfunctioncallsfmasterRecorder,implementedinfmaster.
c,enablingtheconfigurationofapplicationvariabletimecourseswithaPWM-periodtimeresolution.
4.
1.
5FaultInterruptServiceRoutineTheover-currentfaultinterrupt,whichisraisedbytheGPIOeTPUfunctionrunningoneTPUchannel9,ishandledbytheetpu_ch9_isrfunction.
Thefollowingactionsareperformedinordertoswitchthemotoroff:ResettherequiredspeedsDisablethegenerationofPWMsignalsSwitchtheFaultLEDonEnterAPP_STATE_MOTOR_FAULTSetFAULT_OVERCURRENT4.
1.
6eTPUGlobalExceptionInterruptServiceRoutineTheglobalexceptioninterruptishandledbytheetpu_globalexception_isrfunction.
Thefollowingsituationscancausethisinterruptassertion:MicrocodeglobalexceptionisassertedIllegalinstructionflagisassertedSCMMISCflagisassertedThefollowingactionsareperformedinordertoswitchthemotoroff:ResettherequiredspeedsDisablethegenerationofPWMsignalsEnterAPP_STATE_GLOBAL_FAULTBasedontheeTPUglobalexceptionsource,setFAULT_MICROCODE_GE,FAULT_ILLEGAL_INSTR,orFAULT_MISC.
4.
2ApplicationStateDiagramTheapplicationstatediagramconsistsofsevenstates(seeFigure18).
Afterreset,theapplicationgoesfirstlytotheAPP_STATE_INITandthentotheAPP_STATE_STOP.
ThenthecyclebetweenSoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor21APP_STATE_STOP,APP_STATE_ENABLE,APP_STATE_RUN,andAPP_STATE_DISABLEcanberepeated,dependingonthepowerswitchpositionontheFreeMASTERcontrolpage.
APP_STATE_ENABLEandAPP_STATE_DISABLEstatesareintroducedinordertoensurethesafetransitionsbetweentheAPP_STATE_STOPandAPP_STATE_RUNstates.
Wheretheover-currentfaultinterruptisraised(seeredlineonFigure18),theAPP_STATE_MOTOR_FAULTisentered.
ThisfaultisclearedbymovingthepowerswitchtotheOFFpositionandthusenteringtheAPP_STATE_STOP.
WheretheeTPUglobalexceptioninterruptisraised(seegraylineonFigure18),theAPP_STATE_GLOBAL_FAULTisentered.
TheglobalfaultisclearedbymovingthepowerswitchtotheOFFpositionandthusenteringtheAPP_STATE_INIT.
Figure18.
ApplicationStateDiagramThefollowingparagraphsdescribetheprocessingineachoftheapplicationstates.
4.
2.
1APP_STATE_INITThisstateispassedthroughonly.
Itisenteredeitherafterareset,oraftertheAPP_STATE_GLOBAL_FAULT.
Thefollowingactionsareperformedinordertoinitialize(re-initialize)theapplication:Callmy_system_etpu_initroutineforeTPUmoduleinitializationGeteTPUfunctionsDATARAMaddressesforFreeMASTERGettheaddressesofchannelconfigurationregistersforFreeMASTERInitializetheUARTforFreeMASTER"Power"switchmovedOFFAPP_STATE_ENABLEAPP_STATE_RUNAPP_STATE_MOTOR_FAULTAPP_STATE_DISABLEAPP_STATE_STOPresetAPP_STATE_INIT"Power"switchmovedOFF"Power"switchmovedONAPP_STATE_GENERAL_FAULT"Power"switchmovedOFFover-currentfaultinterruptThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SoftwareDesignFreescaleSemiconductor22InitializeFreeMASTERCallmy_system_etpu_startroutineforeTPUstart.
Atthispoint,theCPUandtheeTPUruninparallel.
Dependingonthepowerswitchposition,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,includedinbldcmhsl3_etpu_gct.
cfile,aregeneratedbytheeTPUgraphicalconfigurationtool.
TheeTPUgraphicalconfigurationtoolcanbedownloadedfromhttp://www.
freescale.
com/webapp/sps/site/prod_summary.
jspcode=eTPU.
Formoreinformation,refertoReference12.
Themy_system_etpu_initfunctionfirstconfigurestheeTPUmoduleandmotorsettings.
Someofthesesettingsincludethefollowing:Channelfiltermode=three-samplemodeChannelfilterclock=etpuclkdiv32Theinputsignals(fromHallsensors)arefilteredbychannelfilters.
Thefiltersettingsguaranteefilteringallnoisepulsesuptoawidthof853nsandpasspulsesfromawidthof1.
28s(at150MHzsystemclock).
TCR1source=etpuclkdiv2TCR1prescaler=1TheTCR1internaleTPUclockissettoitsmaximumrateof37.
5MHz(at150MHzsystemclock),correspondingtothe27nsresolutionofgeneratedPWMsignals.
TCR2source=etpuclkdiv8TCR2prescaler=12TheTCR2internaleTPUclockissettoarateof781.
25kHz(at150MHzsystemclock).
TheTCR2clocksettingsareoptimizedformotorspeedcalculationprecision.
Afterconfiguringthemoduleandenginesettings,themy_system_etpu_initfunctioninitializestheeTPUchannels.
Channel0-Halldecoder(HD)ofthefirstmotor-phaseAChannel1-Halldecoder(HD)ofthefirstmotor-phaseBChannel2-Halldecoder(HD)ofthefirstmotor-phaseCChannel3-Halldecoder(HD)ofthesecondmotor-phaseAChannel4-Halldecoder(HD)ofthesecondmotor-phaseBChannel5-Halldecoder(HD)ofthesecondmotor-phaseCChannel6-Halldecoder(HD)ofthethirdmotor-phaseAChannel7-Halldecoder(HD)ofthethirdmotor-phaseBSoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor23Channel8-Halldecoder(HD)ofthethirdmotor-phaseCChannel10-PWMcommuted(PWMC)-phaseAofthefirstmotor-basechannelChannel11-PWMcommuted(PWMC)-phaseAofthefirstmotor-complementarychannelChannel12-PWMcommuted(PWMC)-phaseBofthefirstmotor-basechannelChannel13-PWMcommuted(PWMC)-phaseBofthefirstmotor-complementarychannelChannel14-PWMcommuted(PWMC)-phaseCofthefirstmotor-basechannelChannel15-PWMcommuted(PWMC)-phaseCofthefirstmotor-complementarychannelChannel16-PWMcommuted(PWMC)-phaseAofthesecondmotor-basechannelChannel17-PWMcommuted(PWMC)-phaseAofthesecondmotor-complementarychannelChannel18-PWMcommuted(PWMC)-phaseBofthesecondmotor-basechannelChannel19-PWMcommuted(PWMC)-phaseBofthesecondmotor-complementarychannelChannel20-PWMcommuted(PWMC)-phaseCofthesecondmotor-basechannelChannel21-PWMcommuted(PWMC)-phaseCofthesecondmotor-complementarychannelChannel22-PWMcommuted(PWMC)-phaseAofthethirdmotor-basechannelChannel23-PWMcommuted(PWMC)-phaseAofthethirdmotor-complementarychannelChannel24-PWMcommuted(PWMC)-phaseBofthethirdmotor-basechannelChannel25-PWMcommuted(PWMC)-phaseBofthethirdmotor-complementarychannelChannel26-PWMcommuted(PWMC)-phaseCofthethirdmotor-basechannelChannel27-PWMcommuted(PWMC)-phaseCofthethirdmotor-complementarychannelChannel28-PWMmasterforDCmotorswithspeedcontroller(PWMMDCSC)ofthefirstmotorChannel29-PWMmasterforDCmotorswithspeedcontroller(PWMMDCSC)ofthesecondmotorChannel30-PWMmasterforDCmotorswithspeedcontroller(PWMMDCSC)ofthethirdmotorTheseeTPUchannelsareinitializedbythefs_etpu_app_bldcmhsl3_initeTPUapplicationAPIfunction(see4.
3).
Thisfunctioniscalledthree-timestoinitializeallthreemotors.
Theapplicationsettingsareasfollows:—PWMphases-typeiscommutedcomplementarypairs—PWMfrequency20kHz—PWMdead-time1s—Motorspeedrange14000RPM—Motorspeedminimum300RPM—DC-busvoltage12V—Numberofmotorpolepairs4—MotorspeedcalculatedusingHDrevolutionperiod—Speedcontrollerupdatefrequency10kHz—PIcontrollerparameters:P-gainis0.
5(0x004000*2-15),andI-gainis0.
0078125(0x000100*2-15).
Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SoftwareDesignFreescaleSemiconductor24Thecontrollerparameterswereexperimentallytuned.
—Rampparameters:4storampupfromzerotothemaximumspeed,4storampdownfromthemaximumspeedtozero.
Channel4-generalpurposeI/O(GPIO)ThiseTPUchannelisinitializedbythefs_etpu_gpio_initAPIfunction.
Thesettingis:—Channelpriority:highThemy_system_etpu_startfunctionfirstappliesthesettingsforthechannelinterruptenableandchanneloutputdisableoptions,thenenablestheeTPUtimers,thusstartingtheeTPU.
Figure19.
eTPUConfigurationUsingtheeTPUGraphicalConfigurationToolSoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor254.
2.
1.
2InitializationofFreeMASTERCommunicationPriortotheFreeMASTERinitialization,itisnecessarytosetpointerstotheeTPUfunctionsDATARAMbasesandconfigurationregisterbases.
Basedonthesepointers,whicharereadbyFreeMASTERduringtheinitialization,thelocationsofalleTPUfunctionparametersandconfigurationregistersaredefined.
ThisisessentialforcorrectFreeMASTERoperation!
FreeMASTERconsistsofsoftwarerunningonaPCandonthemicroprocessor,connectedviaanRS-232serialport.
AsmallprogramresidentinthemicroprocessorcommunicateswiththeFreeMASTERonthePCinordertoreturnstatusinformationtothePC,andprocessescontrolinformationfromthePC.
ThemicroprocessorpartoftheFreeMASTERisinitializedbytwofunctions:iniFmasterUartandfmasterInit.
Bothfunctionsareincludedinfmaster.
c,whichautomaticallyinitializestheUARTdriverandinstallsallnecessaryservices.
4.
2.
2APP_STATE_STOPInthisstate,thePWMsignalsaredisabledandthemotorsareoff.
Themotorshaftscanberotatedbyhand,whichenablestheusertoexplorethefunctionalityoftheHalldecoder(HD)eTPUfunction,towatchvariablesproducedbytheHD,andtoseeHallsensorsignalsinFreeMASTER.
Whenthepowerswitchisturnedon,theapplicationgoesthroughAPP_STATE_ENABLEtoAPP_STATE_RUN.
4.
2.
3APP_STATE_ENABLEThisstateispassedthroughonly.
Thefollowingactionsareperformedinordertoswitchthemotordriveon:ResettherequiredspeedsEnablethegenerationofPWMsignalsIfthePWMphasesweresuccessfullyenabled,theGPIOeTPUfunctionisconfiguredasinput,interruptonrisingedge,andAPP_STATE_RUNisentered.
WherethePWMphaseswerenotsuccessfullyenabled,theapplicationstatedoesnotchange.
4.
2.
4APP_STATE_RUNInthisstate,thePWMsignalsareenabledandthemotorsareon.
TherequiredmotorspeedscanbesetusingFreeMASTER.
ThelatestvalueisperiodicallywrittentotheeTPU.
Whenthepowerswitchisturnedoff,theapplicationgoesthroughAPP_STATE_DISABLEtoAPP_STATE_STOP.
Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SoftwareDesignFreescaleSemiconductor264.
2.
5APP_STATE_DISABLEThisstateispassedthroughonly.
Thefollowingactionsareperformedinordertoswitchthemotordriveoff:ResettherequiredspeedsDisablethegenerationofPWMsignalsIfPWMphasesweresuccessfullydisabled,APP_STATE_STOPisentered.
WherePWMphaseswerenotsuccessfullydisabled,theapplicationstateremainsthesame.
4.
2.
6APP_STATE_MOTOR_FAULTThisstateisenteredaftertheover-currentfaultinterruptserviceroutine.
Theapplicationwaitsuntilthepowerswitchisturnedoff.
ThisclearsthefaultandtheapplicationenterstheAPP_STATE_STOP.
4.
2.
7APP_STATE_GLOBAL_FAULTThisstateisenteredaftertheeTPUglobalexceptioninterruptserviceroutine.
Theapplicationwaitsuntilthepowerswitchisturnedoff.
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)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,theBLDCMHSL3isanabbreviationfor"BLDCmotorwithHallsensorsandspeedclosedloop"eTPUmotor-controlapplication.
AsthereareseveralBLDCmotorapplicationswithhallsensorsandspeedclosedloop,thenumber3denotesthethirdsuchapplicationinorder.
Thisthirdapplication,demonstratestheeTPUusagetodrivethreeBLDCmotors.
TheBLDCMHSL3eTPUapplicationAPIisdescribedinthefollowingparagraphs.
Thereare5basicfunctionsaddedtotheBLDCMHSL3applicationAPI.
Theroutinescanbefoundintheetpu_app_bldcmhsl3.
c/.
hfiles.
AllBLDCMHSL3applicationAPIroutineswillbedescribedinorderandarelistedbelow:SoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor27Initializationfunction:int32_tfs_etpu_app_bldcmhsl3_init(bldcmhsl3_instance_t*bldcmhsl3_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_tPWM_phases_type,uint32_tPWM_freq_hz,uint32_tPWM_dead_time_ns,uint32_tPWM_min_pw_ns,uint32_tstart_offset,int32_tspeed_range_rpm,int32_tspeed_min_rpm,int32_tdc_bus_voltage_mv,uint8_tpole_pairs,uint8_tperiod_measured,uint32_tSC_freq_hz,fract24_tSC_P_gain,fract24_tSC_I_gain,uint32_tSC_ramp_time_ms)Changeoperationfunctions:int32_tfs_etpu_app_bldcmhsl3_enable(bldcmhsl3_instance_t*bldcmhsl3_instance,uint8_tconfiguration)int32_tfs_etpu_app_bldcmhsl3_disable(bldcmhsl3_instance_t*bldcmhsl3_instance)voidfs_etpu_app_bldcmhsl3_set_speed_required(bldcmhsl3_instance_t*bldcmhsl3_instance,int32_tspeed_required_rpm)Valuereturnfunctions:voidfs_etpu_app_bldcmhsl3_get_data(bldcmhsl3_instance_t*bldcmhsl3_instance,bldcmhsl3_data_t*bldcmhsl3_data)Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SoftwareDesignFreescaleSemiconductor284.
3.
1int32_tfs_etpu_app_bldcmhsl3_init(.
.
.
)ThisroutineisusedtoinitializetheeTPUchannelsforthe"3BLDCmotorswithHalldecoderandspeedclosedloop"application.
Thisfunctionhasthefollowingparameters:bldcmhsl3_instance(bldcmhsl3_instance_t*)-Thisisapointertobldcmhsl3_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl3_init.
Thisstructuremustbedeclaredintheuserapplication.
Wheretherearemoreinstancesoftheapplicationrunningsimultaneously,theremustbeaseparatebldcmhsl3_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_BLDCMHSL3_COMPL_PAIRS),thecomplementarychannelisonechannelhigher.
PWM_phaseB_channel(uint8_t)-ThisisthePWMphaseBchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
Inthecaseofcomplementarysignalgeneration(PWM_phases_type==FS_ETPU_APP_BLDCMHSL3_COMPL_PAIRS),thecomplementarychannelisonechannelhigher.
PWM_phaseC_channel(uint8_t)-ThisisthePWMphaseCchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
Inthecaseofcomplementarysignalgeneration(PWM_phases_type==FS_ETPU_APP_BLDCMHSL3_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.
PWM_phases_type(uint8_t)-ThisparameterdeterminesthetypeofallPWMphases.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL3_SINGLE_CHANNELS,orFS_ETPU_APP_BLDCMHSL3_COMPL_PAIRS.
PWM_freq_hz(uint32_t)-ThisisthePWMfrequencyinHz.
PWM_dead_time_ns(uint32_t)-ThisisthePWMdead-timeinns.
PWM_min_pw_ns(uint32_t)-ThisisthePWMminimumpulsewidthinns.
start_offset(uint32_t)-ThisparameterisusedtosynchronizeseveralPWMMDCSCfunctionsrunningononeeTPUengine.
ThefirstPWMMDCSCupdatestartsthestart_offsetTCR1clocksafterinitialization.
speed_range_rpm(int32_t)-Thisisthemaximummotorspeedinrpm.
speed_min_rpm(int32_t)-Thisistheminimum(measurable)motorspeedinrpm.
dc_bus_voltage_mv(int32_t)-ThisistheDC-busvoltageinmV.
SoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor29pole_pairs(uint8_t)-Thisisthenumberofmotorpole-pairs.
period_measured(uint8_t)-Thisoptiondefinesthetypeofperiodmeasurementforspeedcalculation.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL3_REV_PERIOD,orFS_ETPU_APP_BLDCMHSL3_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.
4.
3.
2int32_tfs_etpu_app_bldcmhsl3_enable(.
.
.
)ThisroutineisusedtoenablethegenerationofPWMsignals,commutationsonHallsignaltransitions,andtostartthespeedcontroller.
Thisfunctionhasthefollowingparameters:bldcmhsl3_instance(bldcmhsl3_instance_t*)-Thisisapointertobldcmhsl3_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl3_init.
configuration(uint8_t)-ThisistherequiredconfigurationoftheSC.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL3_SPEED_LOOP_OPENED,orFS_ETPU_APP_BLDCMHSL3_SPEED_LOOP_CLOSED.
4.
3.
3int32_tfs_etpu_app_bldcmhsl3_disable(bldcmhsl3_instance_t*bldcmhsl3_instance)ThisroutineisusedtodisablethegenerationofPWMsignals,commutationonHallsignaltransitions,andtostopthespeedcontroller.
Thisfunctionhasthefollowingparameter:bldcmhsl3_instance(bldcmhsl3_instance_t*)-Thisisapointertobldcmhsl3_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl3_init.
Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SoftwareDesignFreescaleSemiconductor304.
3.
4voidfs_etpu_app_bldcmhsl3_set_speed_required(.
.
.
)Thisroutineisusedtosettherequiredmotorspeed.
Thisfunctionhasthefollowingparameters:bldcmhsl3_instance(bldcmhsl3_instance_t*)-Thisisapointertobldcmhsl3_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl3_init.
speed_required_rpm(int32_t)-Thisistherequiredmotorspeedinrpm.
4.
3.
5voidfs_etpu_app_bldcmhsl3_get_data(.
.
.
)Thisroutineisusedtogettheapplicationstatedata.
Thisfunctionhasthefollowingparameters:bldcmhsl3_instance(bldcmhsl3_instance_t*)-Thisisapointertobldcmhsl3_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl3_init.
bldcmhsl3_data(bldcmhsl3_data_t*)-Thisisapointertobldcmhsl3_data_tstructureofapplicationstatedata,whichisupdated.
4.
4eTPUBlockDiagramTheeTPUfunctionsusedtodrivetheBLDCmotorswithspeedclosedlooparelocatedinthemotor-controlsetofeTPUfunctions(set3-DCmotors).
TheeTPUfunctionswithinthesetserveasbuildingblocksforvariousmotor-controlapplications.
Thefollowingparagraphsdescribethefunctionalityofeachblock.
SoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor31Figure20.
BlockDiagramofeTPUProcessing4.
4.
1PWMGenerator(PWMMDCSC+PWMC)ThePWMmasterforDCmotorswithspeedcontroller(PWMMDCSC)functionandPWMcommutated(PWMC)functionenabletheeTPUtogeneratePWMsignalsfordrivingamotor.
ThePWMMDCSCfunctionwasspeciallydesignedforthisapplication.
Actually,itincludestwomotor-controleTPUfunctions:speedcontroller(SC)andPWMmasterforDCmotors(PWMMDC).
PWMMDCfunctionsynchronizesandupdatesuptothreePWMphases.
ThephasesaredrivenbythePWMcommutated(PWMC)functionthatenablesswitchingthephaseONandOFF.
ThePWMCfunctiongeneratesthePWMsignals.
ThePWMMDCfunctioncontrolsthePWMCfunctions,doesnotgenerateanydrivesignal,andcanbeexecutedevenonaneTPUchannelnotconnectedtoanoutputpin.
Ifconnectedtoanoutputpin,thePWMMDCfunctionturnsthepinhighandlow,sothatthehigh-timeidentifiestheperiodoftimeinwhichthePWMMDCexecutionisactive.
Inthisway,thePWMMDCfunction,aswithmanyofthemotor-controleTPUfunctions,supportscheckingeTPUlatenciesusinganoscilloscope.
Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SoftwareDesignFreescaleSemiconductor32TheSCfunctionisnotintendedtoprocessaninputoroutputsignal.
ThepurposeoftheSCfunctionistocontrolanothereTPUfunction'sinputparameter.
TheSCfunctionincludesacontrolleralgorithm.
Thecontrollercalculatesitsoutputbasedontwoinputs:ameasuredvalueandadesiredvalue.
Themeasuredvalue,theactualmotorspeed,iscalculatedbasedoninputsprovidedbythequadraturedecoder(QD)orHalldecoder(HD)function.
Thedesiredvalueisanoutputofaspeedramp,whoseinputisaSCfunctionparameter,andcanbeprovidedbytheCPUoranothereTPUfunction.
Thecontrolleralgorithmisageneralproportional-integral-derivative(PID)algorithm.
ItcanbeconfiguredasPIorPIDcontroller.
Figure21.
FunctionalityofSC+PWMMDC+PWMCFormoredetailsaboutthePWMMDCandPWMCeTPUfunctions,refertoReference9.
FormoredetailsabouttheSCeTPUfunction,refertoReference8.
4.
4.
2HallDecoder(HD)TheHalldecodereTPUfunctionisintendedtoprocesssignalsgeneratedbyHallsensorsinmotioncontrolsystems.
TheHDfunctionusesthreeadjacenteTPUchannelsconfiguredasinputs.
TheHDfunctioncalculatesthefollowingparametersfortheCPU:Sector-determinesthepositionofthemotionsysteminoneofthesectors.
Direction-determinesthedirectionofthemotionsystem.
Adirectionvalue0meansapositive(incremental)direction,othervaluesmeananegative(decremental)direction.
PWMMDCupdateupdateperiodapplied_voltagePWMCpolarity:active-highORactive-lowvariablePWMperiodscenter-alignedORedge-alignedsinglechannelORcomplementarypairPWMCPWMCupdatenoupdatenoupdatenewinputvaluesnewinputvaluesomega_actualomega_rampomega_desiredapplied_voltageSCtimerequested_valuePIcontrollerrampperiodrevolution_periodscaling_factorsector_periodSoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor33Revolutioncounter-determinesthenumberofmotionsystemelectricalrevolutions.
Therevolutioncounterisincrementedordecrementedoneachrevolution,basedonthecurrentdirection.
Revolutionperiod-determinestheTCRtimeofthelastrevolution.
Theparametervalueisupdatedeachtimethesectorischanged.
Therevolutionperiodismeasuredfromthelastedgeofasimilartype(low-high/high-low),onthesamechannel,tothecurrentedge.
Sectorperiod-determinestheTCRtimebetweenthelasttwochangesofthesector.
Theparametervalueisupdatedeachtimethesectorischanged.
Thesectorperiodismeasuredfromthelastedgetothecurrentedge.
Lastedgetime-storestheTCRtimeofthelastincomingedge.
TheHDfunctionalsoperformscommutationsofPWMCphases.
Figure22.
FunctionalityofHDFormoredetailsabouttheHDeTPUfunction,refertoReference7.
4.
4.
3GeneralPurposeI/O(GPIO)ThisfunctionoriginatesfromthegeneraleTPUfunctionset(set1)andisincludedintheDCmotorcontroleTPUfunctionsetaswell.
ItallowstheusertoconfigureaneTPUchannelasageneralpurposeinputoroutput.
Thereare7functionmodessupported:Inputmode-updateperiodicallyInputmode-updateontransition-eitheredgeInputmode-updateontransition-fallingedgeInputmode-updateontransition-risingedgeInputmode-updateonrequest/disabletransitionandmatchupdatesHDcommutationofPWMphasesPWMCPWMCPWMCsector_periodsector_periodsector_perioddirectionsectorrevolution_periodsector_periodrevolution_counterThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2SoftwareDesignFreescaleSemiconductor34Outputmode-outputlowOutputmode-outputhighGPIOfunctionisconfiguredtogenerateaninterrupttotheCPUincaseofanovercurrentfault.
Thefaultsignal,whichisusuallyconnectedtotheeTPUoutputdisableinput,canbealsoconnectedtotheeTPUchannelassignedaGPIOfunction.
Whenthefaultsignalturnsactive,selectedoutputchannelsareimmediatelydisabledbytheeTPUhardware.
Atthesametime,theGPIOfunctiongeneratesaninterrupt,inordertonotifytheCPUaboutthefaultoccurrence.
FormoredetailsabouttheGPIOeTPUfunction,refertoReference10.
4.
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.
SoftwareDesignThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor35Figure23.
OscilloscopeScreen-shotandExplanationofeTPUTimingFigure23andFigure24explaintheapplicationeTPUtiming.
Theoscilloscopescreen-shotsdepictatypicalsituationdescribedbelow.
AliveviewontheoscilloscopescreenenablestheusertoseethevariationofPWMMDCSCactivitypulses,whichdeterminesthechannelservicelatencyranges.
InFigure23,signals3(pink)and4(green)arePWMsignalsofonephase.
Itisacomplementarypairofcentre-alignedPWMsignals.
Thebasechannel(3)isofactive-highpolarity,whilethecomplementarychannel(4)isactive-low.
ThePWMphasecommutationisrecognizableonthescreen.
ThePWMperiodis50s,whichcorrespondstoaPWMfrequencyof20kHz.
Signal2(cyan)isgeneratedbythePWMMDCSCeTPUfunction.
Itspulsesdeterminethespeedcontroller(SC)processingtimeandPWMupdates.
SCprocessingpulsewidthdeterminesthetimenecessarytocalculatethemotorspeedfromarevolutionperiodmeasuredbytheHalldecoder(HD),calculatetherequiredspeedramp,andapplythePIcontrolleralgorithm.
Thiscalculationisperformedperiodicallyata10kHzrate,whichiseverysecondPWMperiod.
ThePWMupdateactivitypulseissometimesnarrowandsometimeswide.
Thepulseiswidewhenanewvalueofappliedmotorvoltagehasbeenprocessed;itisnarrowwhennonewvaluehasbeenprocessedandthePWMduty-cyclesarenotupdated.
TheliveviewontheoscilloscopescreenshowsthattherangeofthePWMMDCSCchannelservicelatenciesareverylow.
TheonlynoticeablelatencyiscausedbyHalldecoder(HD)activity.
TheHDeTPUPWMupdatescommutationPWMMDCSCPWMperiodsPWMCPWMCSCprocessingThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2ImplementationNotesFreescaleSemiconductor36functionprocessestheHallsignalstransitionsandcommutesthePWMphases.
TheHallsignalstransitionscomeasynchronouslywiththePWMperiods.
Thesynchronizationofthe3PWMMDCSCfunctionsisobviousfromtheFigure25.
Figure24.
OscilloscopeScreen-shotandExplanationof3PWMMDCSCFunctionsSynchronization5ImplementationNotes5.
1ScalingofQuantitiesTheBLDCmotorcontrolalgorithmrunningoneTPUusesa24-bitfractionalrepresentationforallrealquantitiesexcepttime.
The24-bitsignedfractionalformatisrepresentedusing1.
23format(1signbit,23fractionalbits).
Themostnegativenumberthatcanberepresentedis-1.
0,whoseinternalrepresentationis0x800000.
Themostpositivenumberis0x7FFFFFor1.
0-2-23.
Thefollowingequationshowstherelationshipbetweenrealandfractionalrepresentations:PWMperiodsPWMMDCSC3PWMCPWMMDCSC2PWMMDCSC1SCupdatePWMupdateFractionalValueRealValueRealQuatityRange-=ImplementationNotesThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor37where: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.
2SpeedCalculationThePWMMDCSCeTPUfunctioncalculatestheangularmotorspeedusingarevolutionperiodmeasuredbytheHalldecoder(HD)eTPUfunction.
Optionally,thePWMMDCSCcanusethesectorperiodinsteadoftherevolutionperiod.
ThesectorperiodisthetimebetweentwoconsecutiveHallsignaltransitions.
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(TCR1orTCR2)usedomega_max[RPM]isamaximalspeedrangepole_pairsisanumberofmotorpole-pairsomega_actual1revolution_period-scaling_factor=scaling_factor60etpu_tcr_freqomega_maxpole_pairs=Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2ImplementationNotesFreescaleSemiconductor38TheinternaleTPUtimer(TCR1orTCR2)frequencymustbesetsothatthecalculationofomega_actualbothfitsintothe24-bitsarithmeticanditsresolutionissufficient.
5.
3DefinitionofCommutationTablesThePWMphasesarecommutedoneachoftheHallsignaltransitions.
ThisisinternallydonebyapplyingtwocommutationcommandsthatareassociatedwiththeparticularHallsignaltransition.
Thefirstcommandturnsaphaseoff,andthesecondturnsanotherphaseon.
SuchpairsofcommutationcommandsmustbedefinedforeachHallsignaltransition,low-highandhigh-low,oneachphase,andforbothmotordirections.
Thesedefinitionsarelocatedinetpu_app_bldcmhsl3.
cfile.
Eachcommutationcommandisa32-bitwordthatconsistsofthefollowing8-bitparts.
ChannelnumberofthePWMphasebasechannelNewbasechannelcommutationstate.
Itcanbe:—ON_ACTIVE_HIGH—ON_ACTIVE_LOW—OFF_LOW—OFF_HIGHNewcomplementarychannelcommutationstate.
Itcanbe:—ON_ACTIVE_HIGH—ON_ACTIVE_LOW—OFF_LOW—OFF_HIGHNewphaseoptions:—DUTY_POS—DUTY_NEG.
Forafulldescriptionofallcommutationcommandoptions,refertoReference9.
Figure25depictsthePittmanBLDCmotor(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_PWMMDCSC_OFF_LOW<<8)+ImplementationNotesThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor39(FS_ETPU_PWMMDCSC_OFF_LOW<<16)+(FS_ETPU_PWMMDCSC_DUTY_POS<<24)phaseA_commut_cmds.
lh_i_1=PWM_phaseA_channel+(FS_ETPU_PWMMDCSC_ON_ACTIVE_HIGH<<8)+(FS_ETPU_PWMMDCSC_ON_ACTIVE_LOW<<16)+(FS_ETPU_PWMMDCSC_DUTY_NEG<<24)Figure25.
PittmanBLDCMotor(N2311)TimingDiagramFordecrementaldirection,readthemotortimingdiagramfromrighttoleft.
TheHallsignalphaseAlow-hightransitioncomesat120electricaldegrees(reddottedline).
ThePWMphaseAisturnedoffandphaseBonduringthistransition.
ThePWMphaseAoptionissettonegatetheduty-cycleinordertogeneratenegativephasevoltage,andthephaseBoptionnottonegateinordertogeneratepositivevoltage.
So,thecommutationcommandsassociatedwiththephaseAlow-hightransitioninadecrementalmotordirectionareasfollows:phaseA_commut_cmds.
lh_d_0=PWM_phaseA_channel+0°60°120°180°240°300°360°HallsignalPhaseAHallsignalPhaseBHallsignalPhaseCvoltagePhaseAvoltagePhaseBvoltagePhaseCThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2MicroprocessorUsageFreescaleSemiconductor40(FS_ETPU_PWMMDCSC_OFF_LOW<<8)+(FS_ETPU_PWMMDCSC_OFF_LOW<<16)+(FS_ETPU_PWMMDCSC_DUTY_NEG<<24)phaseA_commut_cmds.
lh_d_1=PWM_phaseB_channel+(FS_ETPU_PWMMDCSC_ON_ACTIVE_HIGH<<8)+(FS_ETPU_PWMMDCSC_ON_ACTIVE_LOW<<16)+(FS_ETPU_PWMMDCSC_DUTY_POS<<24)Thiswayallcommutationcommandscanbedefined.
6MicroprocessorUsageTable3showshowmuchmemoryisneededtoruntheapplication.
TheeTPUmoduleusageintermsoftimeloadcanbeeasilydeterminedbasedonthefollowingfacts:ThemaximumeTPUloadproducedbyPWMMDCSCgenerationis1316eTPUcyclesperonePWMperiod.
ThePWMfrequencyissetto20kHz,thusthePWMperiodis3750eTPUcycles(eTPUmoduleclockis75MHz,halfofthe150MHzCPUclock).
AccordingtoReference7,theprocessingofoneHallsignaltransition,includingthecommutation,takes308eTPUcycles.
TheHallsignaltransitionscomeasynchronouslytothePWMperiods.
Sixtransitionsareprocessedperoneelectricalmotorrevolution.
TheGPIOfunctionprocessingdoesnotaffecttheeTPUtimeload.
ThevaluesofeTPUloadbyeachofthefunctionsareinfluencedbycompilerefficiency.
Theabovenumbersaregivenforguidanceonlyandaresubjecttochange.
Foruptodateinformation,refertotheinformationprovidedinthelatestreleaseavailablefromFreescale.
ThepeakoftheeTPUtimeloadoccurswhenthespeedcontrollercalculationandaHallsignaltransitionareprocessedwithinonePWMperiod.
Thispeakvaluemustbekeptbelow100%,whichensuresthatallprocessingfitsintothePWMperiod,noservicelatencyislongerthanthePWMperiod,andthusthegeneratedPWMsignalsarenotaffected.
Table3.
MemoryUsageinBytesMemoryAvailableUsedFLASH(external)2M29440RAM6K5999eTPUcodeRAM6K5428eTPUdataRAM1.
5K1304SummaryandConclusionsThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor41Table4showstheeTPUmoduletimeloadinseveraltypicalsituations.
7SummaryandConclusionsThisapplicationnoteprovidestheuserwithadescriptionofthedemoapplication3BLDCmotorswithspeedclosedloop.
TheapplicationalsodemonstratesusageoftheeTPUmoduleontheColdFireMCF523x,whichresultsinaCPUindependentmotordrive.
Lastly,thedemoapplicationistargetedattheMCF523xfamilyofdevices,butitcouldbeeasilyreusedwithanydevicethathasaneTPU.
Table4.
eTPUTimeLoadSituationAverageTimeLoad[%]PeakTimeLoadWithinPWMPeriod[%]MotorSpeed300RPM(120commutationspersecond)52.
865MotorSpeed10000RPM(4000commutationspersecond)57.
665Three3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2ReferencesFreescaleSemiconductor428ReferencesTable5.
References1.
MCF5235ReferenceManual,MCF5235RM2.
M523xEVBUser'sManual,M5235EVBUM3.
MicroPowerStageforthreeBLDCMotorsUser'sManual4.
Pittman'sMotorsweb:http://www.
pittmannet.
com5.
FreeMASTERwebpage,http://www.
freescale.
com,searchkeyword"FreeMASTER"6.
EnhancedTimeProcessingUnitReferenceManual,ETPURM7.
"UsingtheHallDecoder(HD)eTPUFunction,"AN28418.
"UsingtheSpeedController(SC)eTPUFunction,"AN28439.
"UsingtheDCMotorControlPWMeTPUFunctions,"AN248010.
"UsingtheGeneralPurposeI/OeTPUfunctions(GPIO),"AN285011.
"UsingtheDCMotorControleTPUFunctionSet(set3),"AN295812.
eTPUGraphicalConfigurationTool,http://www.
freescale.
com,searchkeyword"ETPUGCT"13.
"DSP56F80xMCPWMModuleinMotorControlApplications,"AN1927THISPAGEINTENTIONALLYLEFTBLANKThree3-PhaseBDLCMotorswithSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
2FreescaleSemiconductor43HowtoReachUs: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.
AN2948Rev.
209/2005

90IDC-香港云主机,美国服务器,日本KVM高性能云主机,创建高性能CLOUD只需60秒即可开通使用!

官方网站:点击访问90IDC官方网站优惠码:云八五折优惠劵:90IDCHK85,仅适用于香港CLOUD主机含特惠型。活动方案:年付特惠服务器:CPU均为Intel Xeon两颗,纯CN2永不混线,让您的网站更快一步。香港大浦CN2測速網址: http://194.105.63.191美国三网CN2測速網址: http://154.7.13.95香港购买地址:https://www.90idc.ne...

速云:深圳独立服务器,新品上线,深港mpls免费体验,多重活动!

速云怎么样?速云是一家国人商家。速云商家主要提供广州移动、深圳移动、广州茂名联通、香港HKT等VDS和独立服务器。目前,速云推出深圳独服优惠活动,机房为深圳移动机房,购买深圳服务器可享受5折优惠,目前独立服务器还支持申请免费试用,需要提交工单开通免费体验试用,次月可享受永久8折优惠,也是需工单申请哦!点击进入:速云官方网站地址活动期限至 2021年7月22日速云云服务器优惠活动:活动1:新购首月可...

Friendhosting四五折促销,VPS半年付7.5欧元起

Friendhosting发布了针对“系统管理日”(每年7月的最后一个星期五)的优惠活动,针对VPS主机提供55%的优惠(相当于四五折),支持1-6个月付款使用,首付折扣非永久,优惠后最低套餐首半年7.18欧元起。这是一家保加利亚主机商,成立于2009年4月,商家提供VDS和独立服务器租用等,数据中心目前可选美国洛杉矶、保加利亚、乌克兰、荷兰、拉脱维亚、捷克和波兰等8个地区机房。下面以最低套餐为例...

46sw.com为你推荐
甲骨文不满赔偿劳动法员工工作不满一个月辞退赔偿标准www.kaspersky.com.cn现在网上又有病毒了?www.97yes.comwww.moyigui88.com是不是一个好网站呢鹤城勿扰齐齐哈尔电视台晴彩鹤城是哪个频道猴山条约游猴山,观猴子网站检测工具网站检测工具红玉头冠古剑奇谭红玉的外装都有什么,不是衣服,是外装www.xiaoyuan.com性感内衣秀哪里有?高清图片。欢颜网欢颜网邀请人数已经达到,可是在哪里换啊?7788kk.com有没有好看的电影网站
广州服务器租用 域名备案中心 中国域名交易中心 mach5 cloudstack 搜狗12306抢票助手 网通代理服务器 500m空间 数字域名 howfile 91vps 稳定免费空间 空间技术网 电信主机 卡巴斯基免费试用版 四川电信商城 买空间网 阿里云邮箱个人版 黑科云 睿云 更多