monitoring46sw.com
46sw.com 时间:2021-04-08 阅读:(
)
FreescaleSemiconductor,Inc.
,2005.
Allrightsreserved.
FreescaleSemiconductorApplicationNoteAN2892Rev.
1,06/2005TableofContentsThisapplicationnotedescribesthedesignofa3-phasebrushlessDC(BLDC)motordrivebasedonFreescale'sColdFireMCF523xmicroprocessor.
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.
Italso1ColdFireMCF523xandeTPUAdvantagesandFeatures22TargetMotorTheory.
43SystemConcept.
84SoftwareDesign185ImplementationNotes366MicroprocessorUsage407SummaryandConclusions418References413-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523xCoversMCF523xandalleTPU-equippedDevicesby:MilanBrejl&MichalPrincSystemApplicationEngineersRoznovCzechSystemCenter3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1ColdFireMCF523xandeTPUAdvantagesandFeaturesFreescaleSemiconductor2illustratestheusageofdedicatedmotorcontroleTPUfunctionsthatareincludedintheDCmotorcontroleTPUfunctionset.
Thisapplicationnotealsoincludesbasicmotortheory,systemdesignconcept,hardwareimplementation,andmicroprocessorandeTPUsoftwaredesign,includingtheFreeMASTERvisualizationtool.
Figure1.
UsingM523xEVB,3-PhaseMicroPowerStage,andPittmanBLDCMotor1ColdFireMCF523xandeTPUAdvantagesandFeatures1.
1ColdFireMCF523xMicroprocessorTheMCF523xisafamilyofhighly-integrated,32-bitmicroprocessorsbasedontheV2ColdFirecore.
Itfeaturesa16-or32-channeleTPU,64KbytesofinternalSRAM,a2-bankSDRAMcontroller,four32-bittimerswithDMArequestcapability,a4-channelDMAcontroller,uptotwoCANmodules,threeUARTs,andaqueuedSPI.
TheMCF523xfamilyhasbeendesignedforgeneralpurposeindustrialcontrolapplications.
Itisalsoahigh-performanceupgradeforusersoftheMC68332.
ColdFireMCF523xandeTPUAdvantagesandFeatures3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor3This32-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.
3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1TargetMotorTheoryFreescaleSemiconductor4TheeTPUhasupto32timerchannels,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)ShaftRotorAirgapPermanentmagnetsTargetMotorTheory3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor5Figure3.
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_Q6Q53-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,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.
TargetMotorTheory3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor7Figure6.
SituationRightBeforeCommutation(Counter-ClockwiseMotion)Figure7.
SituationRightAfterCommutation2.
1.
2SpeedControlCommutationensurestheproperrotorrotationoftheBLDCmotor,whilethemotorspeedonlydependsontheamplitudeoftheappliedvoltage.
TheamplitudeoftheappliedvoltageisadjustedusingthePWMtechnique.
Therequiredspeediscontrolledbyaspeedcontroller,whichisimplementedasaconventionalproportional-integral(PI)controller.
ThedifferencebetweentheactualandrequiredspeedsisinputtothePIcontrollerwhichthen,basedonthisdifference,controlsthedutycycleofthePWMpulseswhichcorrespondtothevoltageamplituderequiredtomaintainthedesiredspeed.
3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SystemConceptFreescaleSemiconductor8Figure8.
SpeedControllerThespeedcontrollercalculatesthePIalgorithmgivenintheequationbelow:AftertransformingtheequationintoadiscretetimedomainusinganintegralapproximationwiththeBackwardEulermethod,wegetthefollowingequationsforthenumericalPIcontrollercalculation:where:3SystemConcept3.
1SystemOutlineThesystemisdesignedtodrivea3-phaseBLDCmotor.
Theapplicationmeetsthefollowingperformancespecifications:VoltagecontrolofaBLDCmotorusingHallsensorsTargetedattheColdFireMCF523xevaluationboard(M523xEVB),3-phasemicropowerstage,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()=SystemConcept3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,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:EvaluationboardM523xEVB3-phasemicropowerstagePittmanBLDCmotor(N2311)withHallsensorsPowersupply9VDC,2.
7AmpsTheeTPUmodulerunsthemaincontrolalgorithm.
The3-phasePWMoutputsignalsfora3-phaseinverteraregeneratedaccordingtofeedbacksignalsfromHallsensorsandtheinputvariablevalues,providedbythemicroprocessorCPU.
3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,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(GPIO)isusedtogenerateaninterrupttotheCPUwhentheover-currentfaultsignalactivates.
eTPUcontrolsaspeedclosedloop.
Theactualmotorspeediscalculatedbasedontherevolutionperiodandcomparedwiththerequiredspeed,providedbytheCPUandpassedthrougharamp.
ThespeedPIcontrolalgorithmprocessestheerrorbetweentherequiredandactualspeed.
ThePIcontrolleroutputispassedtothePWMgeneratorasanewlycorrectedvalueoftheappliedmotorvoltage.
BLDCMotorDriveeTPUGPIOenable/disablePWMsignalsrequiredspeedApplicationStateMachineover-currentinterruptON/OFFswitchstatusdatamonitoringFaultLEDCPUHardware3-PhaseMicroPowerStageBLDCmotor912VDC÷ON/OFFDOWNUPUARTFreeMasterRemoteControlRS232GPIOHallSensorSignalsPWMSignalsFaultSignalStatusLEDSystemConcept3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor11Figure10.
TheApplicationandFreeMASTERScreen3.
2.
1UserInterfaceTheapplicationisinterfacedbythefollowing:ON/OFFswitchonM523xEVB.
Up/downbuttonsonM523xEVB,orFreeMASTERrunningonaPCconnectedtotheM523xEVBviaanRS232serialcable.
TheON/OFFswitchaffectstheapplicationstateandenablesanddisablesthePWMphases.
Whentheswitchisintheoff-position,novoltageisappliedtothemotorwindings.
WhentheON/OFFswitchisin3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SystemConceptFreescaleSemiconductor12theon-position,themotorspeedcanbecontrolledeitherbytheupanddownbuttonsontheM523xEVB,orbytheFreeMASTERonthePC.
TheFreeMASTERalsodisplaysacontrolpage,real-timevaluesofapplicationvariables,andtheirtimebehaviorusingscopes.
FreeMASTERsoftwarewasdesignedtoprovideanapplication-debugging,diagnostic,anddemonstrationtoolforthedevelopmentofalgorithmsandapplications.
ItrunsonaPCconnectedtotheM523xEVBviaanRS232serialcable.
AsmallprogramresidentinthemicroprocessorcommunicateswiththeFreeMASTERsoftwaretoreturnstatusinformationtothePCandprocesscontrolinformationfromthePC.
FreeMASTERsoftware,executingonaPC,usespartofMicrosoftInternetExplorerastheuserinterface.
Note,thatFreeMASTERversion1.
2.
31.
1orhigherisrequired.
TheFreeMASTERapplicationcanbedownloadedfromhttp://www.
freescale.
com.
FormoreinformationaboutFreeMASTER,refertoReference5.
3.
3HardwareImplementationandApplicationSetupAspreviouslystated,theapplicationrunsontheMCF523xfamilyofColdFiremicroprocessorsusingthefollowing:M523xEVB3-phasemicropowerstage3-phasePittmanBLDCmotor(N2311)Powersupply,9-12VDC,minimum2.
7AmpsFigure11showstheconnectionoftheseparts.
AllsystempartsaresuppliedbyFreescaleanddocumentedaccordingtoreferences.
3.
3.
1ColdFireMCF523xEvaluationBoard(M523xEVB)TheEVBisintendedtoprovideamechanismforcustomerstoeasilyevaluatetheMCF523xfamilyofColdFiremicroprocessors.
TheheartoftheevaluationboardistheMCF5235;allotherM523xfamilymembershaveasubsetoftheMCF5235featuresandcanthereforebefullyemulatedusingtheMCF5235device.
TheM523xEVBisfittedwithasingle512Kx16page-modeFLASHmemory(U19),givingatotalmemoryspaceof2Mbytes.
Alternatively,afootprintisavailableforupgradingflashtoa512Kx32page-modeFLASHmemory(U35),doublingthememorysizeto4Mbytes.
Formoreinformation,refertoReference2.
Table1listsallM523xEVBjumpersettingsusedintheapplication.
SystemConcept3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor13Figure11.
ConnectionofApplicationPartsTable1.
M523xEVBJumperSettingsJumperSettingJumperSettingJumperSettingJumperSettingJP1JP2JP3JP4JP5JP6JP7JP8JP9121-2121-212-31-2312-31-2312-3JP20JP21JP22JP23JP24JP25JP26JP27JP28JP2912-312-312-312-312-31-231-231-21-21-2JP40JP41JP42JP43JP44JP45JP46JP47JP48JP491-21-21-21-21-21-21-21-21-21-2JP60JP61JP62JP63JP641-21-2121212-3DIP1DIP2DIP3DIP4DIP5DIP6DIP7DIP8DIP9DIP10DIP11DIP12ONONONONONONOFFONONONOFFONJP10JP11JP12JP13JP14JP15JP16JP17JP18JP1912-312-312-312-312-312-312-312-312-312-3JP30JP31JP32JP33JP34JP35JP36JP37JP38JP391-212-31-231-21-21-231-231-21-21-2JP50JP51JP52JP53JP54JP55JP56JP57JP58JP591-231-231-231212121-231-21-21-23-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SystemConceptFreescaleSemiconductor143.
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.
CFFlasherTargetConfigurationWindowSystemConcept3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor15Figure13.
CFFlasherProgramWindow3.
3.
3SettingOvercurrentLevelTheover-currentfaultsignalisconnectedtotheeTPUoutputdisablepin(LETPUODIS)thathandleseTPUhardwarefaults,alongwiththepropereTPUconfiguration.
ThisconnectionispartofM523xEVB1.
Inordertoenablehandlingofthefaultbysoftware,thefaultsignal,availableontheLETPUODISpin,mustbeconnectedtoeTPUchannel4,whichrunstheGPIOfunctionandgeneratesaninterruptrequesttotheCPUinthecaseofafault.
Thisconnectionmustbedonemanually.
Connectpin6(LETPUODIS)withpin16(ETPUCH4)ontheeTPUheader(seeFigure14).
Theover-currentlevelissetbytrimmerR41onM523xEVB(seeFigure15).
Reference3describeswhatvoltagethetrimmerdefinesfortheover-currentcomparator.
Followthestepsbelowtosetuptheover-currentlevelproperlywithoutmeasuringthevoltage:1.
ConnectallsystempartsaccordingtoFigure11,connectpin16withpin40ontheeTPUheader.
Nowtheover-currentinterruptisdisabled.
Theover-currentfaultishandledbyhardwareonly.
2.
Downloadandstarttheapplication.
3.
TurntheON/OFFswitchON.
Usingtheupanddownbuttons,settherequiredspeedtothemaximum.
4.
AdjusttheR41trimmer.
YoucanfindalevelfromwhichtheredLEDstartstolightandthemotorspeedstartstobelimited.
Setthetrimmerlevelsomewhathigher,sothatthemotorcanrunatthemaximumspeed.
5.
TurntheON/OFFswitchOFF.
1.
WhentheeTPUisconfiguredfor32-channels,LTPUODISisapplicabletochannels0-15.
Whentheethernetisenabled(SW11on),thefunctionofLTPUODISthenchangestochannels0-7andUTPUODISthuscontrolschannels8-15.
ThereforetheUTPUODISmustbetiedtoLTPUODIStoenabletheapplicationtoworkwhenethernetisenabled.
3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SystemConceptFreescaleSemiconductor166.
Connectpin16withpin6ontheeTPUheader.
Nowtheover-currentinterruptisenabled.
Theover-currentfaultishandledbybothhardwareandsoftware.
7.
TurntheON/OFFswitchON.
Usingtheupanddownbuttons,settherequiredspeedtothemaximum.
Iftheapplicationgoestothefaultstateduringtheacceleration,adjusttheR41trimmerlevelsomewhathigher,sothatthemotorcangettothemaximumspeed.
Figure14.
ConnectionBetweenLETPUODIS,andETPUCH4ontheeTPUHeaderFigure15.
OvercurrentLevelTrimmeronM523xEVB(R41)SystemConcept3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor173.
3.
43-PhaseMicroPowerStageThe3-phasemicropowerstageisa12V/3Asurface-mountpowerstage,whichissuppliedwitha40-pinribboncable.
IncombinationwiththeM523xEVB,itprovidesanout-of-the-boxsoftwaredevelopmentplatformforsmallbrushlessDCmotors.
Figure16.
3-PhaseMicroPowerStageThe3-phasemicropowerstagedoesnothaveanyovercurrentprotectionthatisindependentofthecontrolboard,sosomecareinitsuseisrequired.
NOTEOverprotectionintegratedontheM523xEVB.
Formoreinformation,refertoReference3.
3.
3.
5BLDCMotorwithHallSensorsTheenclosedmotorisalow-voltagePittmanBLDCmotor(N2311).
ThemotoriscapableofbeingcontrolledbyHallsensortechniques.
ThemotorcharacteristicsinTable2applytooperationat25°C.
Table2.
PittmanBLDCMotor(N2311)MotorCharacteristicsCharacteristicSymbolMinTypeMaxUnitsReferenceWindingVoltageVt——9.
6VSpeed@Vt——12000RPMTorqueConstantKt—0.
007—Nm/A3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SoftwareDesignFreescaleSemiconductor18Figure26depictsthemotortiming.
Formoremotorspecifications,refertoReference4.
3.
3.
6PowerSupplyThepowersupplysuppliedwiththeM523xEVB,9.
0V/2.
7A,isalsousedtopowerthe3-phasemicropowerstage.
Theapplicationisscaledforthis9Vpowersupply.
Incasea12Vpowersupplyisusedinstead,theapplicationshouldberescaledforthewidervoltageandspeedrange.
4SoftwareDesignThissectiondescribesthesoftwaredesignoftheBLDCmotordriveapplication.
ThesystemprocessingisdistributedbetweentheCPUandtheeTPU,whichruninparallel.
TheCPUandeTPUtasksaredescribedintermsofthefollowing:CPU—Softwareflowchart—Applicationstatediagram—eTPUapplicationAPIeTPU—eTPUblockdiagram—eTPUtimingTheCPUsoftwareusesseveralready-to-useFreescalesoftwaredrivers.
ThecommunicationbetweenthemicroprocessorandtheFreeMASTERonaPCishandledbysoftwareincludedinfmaster.
c/.
hfiles.
TheeTPUmoduleusesthegeneraleTPUutilities,eTPUfunctioninterfaceroutines(eTPUfunctionAPI),andeTPUapplicationinterfaceroutines(eTPUapplicationAPI).
Thegeneralutilities,includedintheetpu_util.
c/.
hfiles,areusedforinitializationofglobaleTPUmoduleandenginesettings.
TheeTPUfunctionAPIroutinesareusedforinitializationoftheeTPUchannelsandinterfacingeacheTPUfunctionKt—1.
082—oz-in/AVoltageConstantKe—0.
8—V/kRPMTerminalResistanceRt0.
13—0.
18WWindingInductanceL——mHContinuousCurrentIcs——9.
96ANoLoadCurrent@VtIps—1.
20—ANumberofPolesJm—8——TemperatureRating-10—8014—176Table2.
PittmanBLDCMotor(N2311)MotorCharacteristics(continued)CharacteristicSymbolMinTypeMaxUnitsSoftwareDesign3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor19duringrun-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-57SWAN2864SWAN2958SWSoftwareLevelSourceCodeFilesOrigineTPUCodeUserwrittencodeFreescalesuppliedcodeGeneratedcodeByteCraftsuppliedcode3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SoftwareDesignFreescaleSemiconductor204.
1CPUSoftwareFlowchartFigure18.
CPUSoftwareFlowchartAfterreset,theCPUsoftwareinitializesinterruptsandpins.
ThefollowingCPUprocessingisincorporatedintwoperiodictimerinterrupts,oneperiodicaleTPUchannelinterrupt,andtwofaultinterrupts.
4.
1.
1InitializationofInterruptsandPinsTheinitializationoftimer3,eTPUchannel4and7interrupts,andtheeTPUglobalexceptioninterrupt,togetherwithinitializationoftheGPIOandLETPUODISpins,isdonebytheInitInterruptsAndPinsfunction.
4.
1.
2Timer3InterruptServiceRoutineThetimer3interruptishandledbythetimer3_isrfunction.
Thefollowingactionsareperformedperiodically,intimer3_isr:ReadtheON/OFFswitchstatusHandletheapplicationstatemachineTheapplicationstatediagramisdescribedindetailbelow.
ServicetheupanddownbuttonsandthestatusLEDbytheApplicationButtonsAndStatusLedfunctionReadthedatastructurethroughtheeTPUapplicationAPIroutinefs_etpu_app_bldcmhsl1_get_data(see4.
3).
RESETInitializeinterruptsandpinswaitReadON/OFFswitchstatusHandleapplicationstatemachineServiceUp/DownbuttonsandStatusLEDReadapplicationdatastructureTimer3InterruptHandleovercurrentfaultFaultInterruptFreeMasterDispatcherFreeMasterTimerInterruptFreeMasterRecordereTPUChannelInterruptHandleeTPUglobalexceptioneTPUGlobalExceptionInterruptSoftwareDesign3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor214.
1.
3FreeMASTERInterruptServiceRoutineTheFreeMASTERinterruptserviceroutineiscalledfmasterDispatcher.
Thisfunctionisimplementedinfmaster.
c.
4.
1.
4eTPUChannelInterruptServiceRoutineThisinterrupt,whichisraisedeveryPWMperiodbythePWMMDCeTPUfunctionrunningoneTPUchannel7,ishandledbytheetpu_ch7_isrfunction.
ThisfunctioncallsfmasterRecorder,implementedinfmaster.
c,enablingtheconfigurationofapplicationvariabletimecourseswithaPWM-periodtimeresolution.
4.
1.
5FaultInterruptServiceRoutineTheover-currentfaultinterrupt,whichisraisedbytheGPIOeTPUfunctionrunningoneTPUchannel4,ishandledbytheetpu_ch4_isrfunction.
Thefollowingactionsareperformedinordertoswitchthemotoroff:ResettherequiredspeedDisablethegenerationofPWMsignalsSwitchthefaultLEDonEnterAPP_STATE_MOTOR_FAULTSetFAULT_OVERCURRENT4.
1.
6eTPUGlobalExceptionInterruptServiceRoutineTheglobalexceptioninterruptishandledbytheetpu_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_STOP3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SoftwareDesignFreescaleSemiconductor22follows,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(seeredlineonFigure19),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_initroutineforeTPUmoduleinitializationGeteTPUfunctionsDATARAMaddressesforFreeMASTERGettheaddressesofchannelconfigurationregistersforFreeMASTERON/OFFswitchmovedOFFAPP_STATE_ENABLEAPP_STATE_RUNAPP_STATE_MOTOR_FAULTAPP_STATE_DISABLEAPP_STATE_STOPresetAPP_STATE_INITON/OFFswitchmovedOFFON/OFFswitchmovedONAPP_STATE_GENERAL_FAULTON/OFFswitchmovedOFFover-currentfaultinterruptSoftwareDesign3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor23InitializetheUARTforFreeMASTERInitializeFreeMASTERCallmy_system_etpu_startroutineforeTPUStart.
Atthispoint,theCPUandtheeTPUruninparallel.
DependingontheON/OFFswitchposition,enterAPP_STATE_STOPorAPP_STATE_MOTOR_FAULT4.
2.
1.
1InitializationandStartofeTPUModuleTheeTPUmoduleisinitializedusingthemy_system_etpu_initfunction.
Later,afterinitializationofallotherperipherals,theeTPUisstartedbymy_system_etpu_start.
ThesefunctionsusethegeneraleTPUutilitiesandeTPUfunctionAPIroutines.
Boththemy_system_etpu_initandmy_system_etpu_startfunctions,includedinbldcmhsl1_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.
Channel1-Halldecoder(HD)-phaseAChannel2-Halldecoder(HD)-phaseBChannel3-Halldecoder(HD)-phaseCChannel5-speedcontroller(SC)Channel7-PWMmasterforDCmotors(PWMMDC)Channel8-PWMcommuted(PWMC)-phaseA-basechannelChannel10-PWMcommuted(PWMC)-phaseB-basechannel3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SoftwareDesignFreescaleSemiconductor24Channel12-PWMcommuted(PWMC)-phaseC-basechannelTheseeTPUchannelsareinitializedbythefs_etpu_app_bldcmhsl1_initeTPUapplicationAPIfunction(see4.
3).
Theapplicationsettingsareasfollows:—PWMphases-typeiscommutedcomplementarypairs—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:2storampupfromzerotothemaximumspeed,2storampdownfromthemaximumspeedtozero.
Channel4-generalpurposeI/O(GPIO)ThiseTPUchannelisinitializedbythefs_etpu_gpio_initAPIfunction.
Thesettingis:—Channelpriority:highThemy_system_etpu_startfunctionfirstappliesthesettingsforthechannelinterruptenableandchanneloutputdisableoptions,thenenablestheeTPUtimers,sostartingtheeTPU.
SoftwareDesign3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor25Figure20.
eTPUConfigurationUsingtheeTPUGraphicalConfigurationTool4.
2.
1.
2InitializationofFreeMASTERCommunicationPriortotheFreeMASTERinitialization,itisnecessarytosetpointerstotheeTPUfunctionsDATARAMbasesandconfigurationregisterbases.
Basedonthesepointers,whicharereadbyFreeMASTERduringtheinitialization,thelocationsofalleTPUfunctionparametersandconfigurationregistersaredefined.
ThisisessentialforcorrectFreeMASTERoperation.
3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SoftwareDesignFreescaleSemiconductor26FreeMASTERconsistsofsoftwarerunningonaPCandonthemicroprocessor,connectedviaanRS-232serialport.
AsmallprogramresidentinthemicroprocessorcommunicateswiththeFreeMASTERonthePCinordertoreturnstatusinformationtothePC,andprocessescontrolinformationfromthePC.
ThemicroprocessorpartoftheFreeMASTERisinitializedbytwofunctions:iniFmasterUartandfmasterInit.
Bothfunctionsareincludedinfmaster.
c,whichautomaticallyinitializestheUARTdriverandinstallsallnecessaryservices.
4.
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,theGPIOeTPUfunctionisconfiguredasinput,interruptonrisingedge,andAPP_STATE_RUNisentered.
WherethePWMphaseswerenotsuccessfullyenabled,theapplicationstatedoesnotchange.
4.
2.
4APP_STATE_RUNInthisstate,thePWMsignalsareenabledandthemotorison.
TherequiredmotorspeedcanbesetusingtheupanddownbuttonsontheM523xEVBorbyusingFreeMASTER.
ThelatestvalueisperiodicallywrittentotheeTPU.
WhentheON/OFFswitchisturnedoff,theapplicationgoesthroughAPP_STATE_DISABLEtoAPP_STATE_STOP.
4.
2.
5APP_STATE_DISABLEThisstateispassedthroughonly.
Thefollowingactionsareperformedinordertoswitchthemotordriveoff:ResettherequiredspeedDisablethegenerationofPWMsignalsIfPWMphasesweresuccessfullydisabled,APP_STATE_STOPisentered.
WherePWMphaseswerenotsuccessfullydisabled,theapplicationstateremainsthesame.
SoftwareDesign3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor274.
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)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,theBLDCMHSL1isanabbreviationfor"BLDCmotorwithHallsensorsandspeedclosedloop"eTPUmotor-controlapplication.
AsthereareseveralBLDCmotorapplicationswithHallsensorsandspeedclosedloop,thenumber1denotesthefirstsuchapplicationinorder.
TheBLDCMHSL1eTPUapplicationAPIisdescribedinthefollowingparagraphs.
Thereare5basicfunctionsaddedtotheBLDCMHSL1applicationAPI.
Theroutinescanbefoundintheetpu_app_bldcmhsl1.
c/.
hfiles.
AllBLDCMHSL1applicationAPIroutineswillbedescribedinorderandarelistedbelow:Initializationfunction:int32_tfs_etpu_app_bldcmhsl1_init(bldcmhsl1_instance_t*bldcmhsl1_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,3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SoftwareDesignFreescaleSemiconductor28uint8_tSC_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)Changeoperationfunctions:int32_tfs_etpu_app_bldcmhsl1_enable(bldcmhsl1_instance_t*bldcmhsl1_instance,uint8_tconfiguration)int32_tfs_etpu_app_bldcmhsl1_disable(bldcmhsl1_instance_t*bldcmhsl1_instance)voidfs_etpu_app_bldcmhsl1_set_speed_required(bldcmhsl1_instance_t*bldcmhsl1_instance,int32_tspeed_required_rpm)ValueReturnFunctions:voidfs_etpu_app_bldcmhsl1_get_data(bldcmhsl1_instance_t*bldcmhsl1_instance,bldcmhsl1_data_t*bldcmhsl1_data)4.
3.
1int32_tfs_etpu_app_bldcmhsl1_init(.
.
.
)ThisroutineisusedtoinitializetheeTPUchannelsforthe"BLDCmotorwithHalldecoderandspeedclosedloop"application.
Thisfunctionhasthefollowingparameters:bldcmhsl1_instance(bldcmhsl1_instance_t*)-Thisisapointertobldcmhsl1_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl1_init.
Thisstructuremustbedeclaredintheuserapplication.
Wheretherearemoreinstancesoftheapplicationrunningsimultaneously,theremustbeaseparatebldcmhsl1_instance_tstructureforeachone.
PWM_master_channel(uint8_t)-ThisisthePWMmasterchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
SoftwareDesign3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor29PWM_phaseA_channel(uint8_t)-ThisisthePWMphaseAchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
Inthecaseofcomplementarysignalgeneration(PWM_phases_type==FS_ETPU_APP_BLDCMHSL1_COMPL_PAIRS),thecomplementarychannelisonechannelhigher.
PWM_phaseB_channel(uint8_t)-ThisisthePWMphaseBchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
Inthecaseofcomplementarysignalgeneration(PWM_phases_type==FS_ETPU_APP_BLDCMHSL1_COMPL_PAIRS),thecomplementarychannelisonechannelhigher.
PWM_phaseC_channel(uint8_t)-ThisisthePWMphaseCchannelnumber.
0-31forETPU_A,and64-95forETPU_B.
Inthecaseofcomplementarysignalgeneration(PWM_phases_type==FS_ETPU_APP_BLDCMHSL1_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.
PWM_phases_type(uint8_t)-ThisparameterdeterminesthetypeofallPWMphases.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL1_SINGLE_CHANNELS,orFS_ETPU_APP_BLDCMHSL1_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_BLDCMHSL1_REV_PERIOD,orFS_ETPU_APP_BLDCMHSL1_SECTOR_PERIOD.
SC_freq_hz(uint32_t)-ThisisthespeedcontrollerupdatefrequencyinHz.
TheassignedvaluemustbeequaltothePWM_freq_hzdividedby1,2,3,4,5,.
.
.
3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SoftwareDesignFreescaleSemiconductor30SC_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.
Astepchangeofrequiredthespeedfrom0tospeed_range_rpmissloweddownbytheramptotakethedefinedtime.
4.
3.
2int32_tfs_etpu_app_bldcmhsl1_enable(.
.
.
)ThisroutineisusedtoenablethegenerationofPWMsignals,commutationsonHallsignaltransition,andtostartthespeedcontroller.
Thisfunctionhasthefollowingparameters:bldcmhsl1_instance(bldcmhsl1_instance_t*)-Thisisapointertobldcmhsl1_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl1_init.
configuration(uint8_t)-ThisistherequiredconfigurationoftheSC.
Thisparametershouldbeassignedavalueof:FS_ETPU_APP_BLDCMHSL1_SPEED_LOOP_OPENED,orFS_ETPU_APP_BLDCMHSL1_SPEED_LOOP_CLOSED.
4.
3.
3int32_tfs_etpu_app_bldcmhsl1_disable(bldcmhsl1_instance_t*bldcmhsl1_instance)ThisroutineisusedtodisablethegenerationofPWMsignals,commutationonHallsignaltransitions,andtostopthespeedcontroller.
Thisfunctionhasthefollowingparameter:bldcmhsl1_instance(bldcmhsl1_instance_t*)-Thisisapointertobldcmhsl1_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl1_init.
4.
3.
4voidfs_etpu_app_bldcmhsl1_set_speed_required(.
.
.
)Thisroutineisusedtosettherequiredmotorspeed.
Thisfunctionhasthefollowingparameters:bldcmhsl1_instance(bldcmhsl1_instance_t*)-Thisisapointertobldcmhsl1_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl1_init.
speed_required_rpm(int32_t)-Thisistherequiredmotorspeedinrpm.
SoftwareDesign3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor314.
3.
5voidfs_etpu_app_bldcmhsl1_get_data(.
.
.
)Thisroutineisusedtogettheapplicationstatedata.
Thisfunctionhasthefollowingparameters:bldcmhsl1_instance(bldcmhsl1_instance_t*)-Thisisapointertobldcmhsl1_instance_tstructure,whichisfilledbyfs_etpu_app_bldcmhsl1_init.
bldcmhsl1_data(bldcmhsl1_data_t*)-Thisisapointertobldcmhsl1_data_tstructureofapplicationstatedata,whichisupdated.
4.
4eTPUBlockDiagramTheeTPUfunctionsusedtodrivetheBLDCmotorwithspeedclosedlooparelocatedinthemotor-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(channels16to32).
commutationHDPWMCPWMMDCSCappliedvoltagerequiredspeedrevolutionperiodHallSensorsMotorInverterCPUeTPUHardwareduty-cyclesGPIOFaultfaultinterruptOutputDisable3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SoftwareDesignFreescaleSemiconductor32Figure22.
FunctionalityofPWMMDC+PWMCFormoredetailsaboutthePWMMDC,PWMF,andPWMCeTPUfunctions,refertoReference9.
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-alignedsinglechannelORcomplementarypairPWMCPWMCupdatenoupdatenoupdatenewinputvaluesnewinputvaluesSoftwareDesign3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor33Figure23.
FunctionalityofHDFormoredetailsabouttheHDeTPUfunction,refertoReference7.
4.
4.
3SpeedController(SC)ThespeedcontrollereTPUfunctionisnotintendedtoprocessinputoroutputsignals.
ItspurposeistocontrolanothereTPUfunction'sinputparameter.
TheSCfunctioncanbeexecutedevenonaneTPUchannelnotconnectedtoanoutputpin.
TheSCfunctionincludesageneralPIDcontrolleralgorithm.
Thecontrollercalculatesitsoutputbasedontwoinputs:ameasuredvalue,andarequiredvalue.
Themeasuredvalue(theactualmotorspeed)iscalculatedbasedoninputsprovidedbytheHDfunction.
Therequiredvalueisanoutputofthespeedramp,whoseinputisaSCfunctionparameter,andcanbeprovidedbytheCPUoranothereTPUfunction.
Inthemotor-controleTPUfunctionset,thisfunctionmostlyprovidesthespeedouter-loop.
Figure24.
FunctionalityofSCFormoredetailsabouttheSCeTPUfunction,refertoReference8.
HDcommutationofPWMphasesPWMCPWMCPWMCsector_periodsector_periodsector_perioddirectionsectorrevolution_periodsector_periodrevolution_counteromega_actualomega_rampomega_desiredapplied_voltageSCtimerequested_valuePIcontrollerrampperiodrevolution_periodomega_actualscaling_factorsector_period3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1SoftwareDesignFreescaleSemiconductor344.
4.
4GeneralPurposeI/O(GPIO)ThisfunctionoriginatesfromthegeneraleTPUfunctionset(set1)andisincludedintheDCmotorcontroleTPUfunctionsetaswell.
ItallowstheusertoconfigureaneTPUchannelasageneralpurposeinputoroutput.
Thereare7functionmodessupported:Inputmode-updateperiodicallyInputmode-updateontransition-eitheredgeInputmode-updateontransition-fallingedgeInputmode-updateontransition-risingedgeInputmode-updateonrequest/disabletransitionandmatchupdatesOutputmode-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.
SoftwareDesign3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor35ThepulseissynchronouswiththePWMperiodsbutitspositionvariesintime.
ThismeansthatthetestedchannelactivityissynchronouswiththePWMperiodsandtheservicelatencyvariesinthistimerange.
Figure25.
OscilloscopeScreen-shotandExplanationofeTPUTimingFigure25explainstheapplicationeTPUtiming.
Theoscilloscopescreen-shotdepictsatypicalsituationdescribedbelow.
AliveviewontheoscilloscopescreenenablestheusertoseethevariationofSCandPWMMDCactivitypulses,whichdeterminesthechannelservicelatencyranges.
InFigure25,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.
SCactivityPWMMDCupdatesPWMperiodscommutationSCPWMCPWMCPWMMDC3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1ImplementationNotesFreescaleSemiconductor36Signal2(cyan)isgeneratedbythePWMmasterforDCmotors(PWMMDC)eTPUfunction.
ItspulsesdeterminetheactivityofthePWMMDC.
ImmediatelyaftereachSCpulse,averynarrowPWMMDCpulseoccurs.
ThesepulsesdeterminetheservicetimeofanSCrequesttoupdatethenewvalueofappliedmotorvoltage.
Apartfromthesepulses,foreveryPWMperiod,apulsewillappearwhichsignalsaPWMupdate.
ThePWMupdateactivitypulseissometimesnarrowandsometimeswide.
Thepulseiswidewhenanewvalueofappliedmotorvoltagehasbeenprocessed;itisnarrowwhennonewvaluehasbeenprocessedandthePWMduty-cyclesarenotupdated.
TheliveviewontheoscilloscopescreenshowsthattherangeoftheSCandPWMMDCchannelservicelatenciesareverylow.
TheonlynoticeablelatencyiscausedbyHalldecoder(HD)activity.
TheHDeTPUfunctionprocessestheHallsignalstransitionsandcommutesthePWMphases.
TheHallsignalstransitionscomeasynchronouslywiththePWMperiods.
Thefs_etpu_pwmmdc_init_3phfunctionparameterupdate_timeenablestheusertoadjustthepositionofthePWMMDCactivitypulserelativetothePWMperiodframe.
Theactivitypulsehasascheduledupdate_timepriortotheendoftheperiodframe,sothattheupdateisfinishedbytheendoftheperiodframe,evenintheworstcaselatency.
Reference9describeshowtosettheupdate_timevalue.
Thedifferencebetweenthevaluesofthefs_etpu_pwmmdc_init_3phfunctionparameterstart_offset,andthefs_etpu_sc_initfunctionparameterstart_offset,determinesthepositionoftheSCactivitypulserelativetothePWMperiodframe.
TheSCactivityprecedesthePWMMDCactivity,sothattheworstcaseSClatencydoesnotaffectthePWMMDClatency.
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.
FractionalValueRealValueRealQuatityRange-=ImplementationNotes3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor375.
2SpeedCalculationThespeedcontroller(SC)eTPUfunctioncalculatestheangularmotorspeedusingarevolutionperiodmeasuredbytheHalldecoder(HD)eTPUfunction.
Optionally,thespeedcontrollercanusethesectorperiodinsteadoftherevolutionperiod.
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(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.
ChannelnumberofthePWMphasebasechannelomega_actual1revolution_period-scaling_factor=scaling_factor60etpu_tcr_freqomega_maxpole_pairs=3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1ImplementationNotesFreescaleSemiconductor38Newbasechannelcommutationstate.
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.
Figure26depictsthePittmanBLDCmotor(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)ImplementationNotes3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor39Figure26.
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)Thisway,allcommutationcommandscanbedefined.
0°60°120°180°240°300°360°HallsignalPhaseAHallsignalPhaseBHallsignalPhaseCvoltagePhaseAvoltagePhaseBvoltagePhaseC3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1MicroprocessorUsageFreescaleSemiconductor406MicroprocessorUsageTable3showshowmuchmemoryisneededtoruntheapplication.
TheeTPUmoduleusageintermsoftimeloadcanbeeasilydeterminedbasedonthefollowingfacts:AccordingtoReference9,themaximumeTPUloadproducedbyPWMgenerationis946eTPUcyclesperonePWMperiod.
ThePWMfrequencyissetto20kHz,thusthePWMperiodis3750eTPUcycles(eTPUmoduleclockis75MHz,halfofthe150MHzCPUclock).
AccordingtoReference8,thespeedcontrollercalculationtakes244eTPUcycles.
ThecalculationisperformedeverysecondPWMperiod.
AccordingtoReference7,theprocessingofoneHallsignaltransition,includingthecommutation,takes308eTPUcycles.
TheHallsignaltransitionscomeasynchronouslytothePWMperiods.
Sixtransitionsareprocessedperoneelectricalmotorrevolution.
TheGPIOfunctionprocessingdoesnotaffecttheeTPUtimeload.
ThevaluesofeTPUloadbyeachofthefunctionsareinfluencedbycompilerefficiency.
Theabovenumbersaregivenforguidanceonlyandaresubjecttochange.
Foruptodateinformation,refertotheinformationprovidedinthelatestreleaseavailablefromFreescale.
ThepeakoftheeTPUtimeloadoccurswhenboththespeedcontrollercalculationandaHallsignaltransitionareprocessedwithinonePWMperiod.
Thispeakvaluemustbekeptbelow100%,whichensuresthatallprocessingfitsintothePWMperiod,noservicelatencyislongerthanthePWMperiod,andthusthegeneratedPWMsignalsarenotaffected.
Table4showstheeTPUmoduletimeloadinseveraltypicalsituations.
Formoreinformation,refertoReference11.
Table3.
MemoryUsageinBytesMemoryAvailableUsedFLASH(external)2M28912RAM6K5792eTPUcodeRAM6K6140eTPUdataRAM1.
5K488Table4.
eTPUTimeLoadSituationAverageTimeLoad[%]PeakTimeLoadWithinPWMPeriod[%]MotorSpeed300RPM(120commutationspersecond)28.
639.
9MotorSpeed10000RPM(4000commutationspersecond)30.
139.
9SummaryandConclusions3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor417SummaryandConclusionsThisapplicationnoteprovidestheuserwithadescriptionofthedemoapplication3-phaseBLDCmotorwithspeedclosedloop.
TheapplicationalsodemonstratesusageoftheeTPUmoduleontheColdFireMCF523x,whichresultsinaCPUindependentmotordrive.
Lastly,thedemoapplicationistargetedattheMCF523xfamilyofdevices,butitcouldbeeasilyreusedwithanydevicethathasaneTPU.
8ReferencesTable5.
References1.
MCF5235ReferenceManual,MCF5235RM2.
M523xEVBUser'sManual,M5235EVBUM3.
3-PhaseMicroPowerStageUser'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,"AN1927THISPAGEINTENTIONALLYLEFTBLANK3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor42THISPAGEINTENTIONALLYLEFTBLANK3-PhaseBLDCMotorwithHallSensorsandSpeedClosedLoop,DrivenbyeTPUonMCF523x,Rev.
1FreescaleSemiconductor43HowtoReachUs: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.
AN2892Rev.
106/2005
ProfitServer已开启了黑色星期五的促销活动,一直到本月底,商家新加坡、荷兰、德国和西班牙机房VPS直接5折,无码直购最低每月2.88美元起,不限制流量,提供IPv4+IPv6。这是一家始于2003年的俄罗斯主机商,提供虚拟主机、VPS、独立服务器、SSL证书、域名等产品,可选数据中心包括俄罗斯、法国、荷兰、美国、新加坡、拉脱维亚、捷克、保加利亚等多个国家和地区。我们随便以一个数据中心为例...
优惠码年付一次性5折优惠码:TYO-Lite-Open-Beta-1y-50OFF永久8折优惠码:TYO-Lite-Open-Beta-Recur-20OFF日本vpsCPU内存SSD流量带宽价格购买1核1.5G20 GB4 TB1Gbps$10.9/月购买2核2 G40 GB6 TB1Gbps$16.9/月购买2核4 G60 GB8 TB1Gbps$21.9/月购买4核4 G80 GB12 TB...
蓝速数据金秋上云季2G58/年怎么样?蓝速数据物理机拼团0元购劲爆?蓝速数据服务器秒杀爆产品好不好?蓝速数据是广州五联科技信息有限公司旗下品牌云计算平台、采用国内首选Zkeys公有云建设多种开通方式、具有IDC、ISP从业资格证IDC运营商新老用户值得信赖的商家。我司主要从事内地的枣庄、宿迁、深圳、绍兴、成都(市、县)。待开放地区:北京、广州、十堰、西安、镇江(市、县)。等地区数据中心业务,均KV...
46sw.com为你推荐
百度关键词工具常见百度关键词挖掘方法分别是什么请列举?kb123.net连网方式:wap和net到底有什么不一样的baqizi.cc曹操跟甄洛是什么关系机器蜘蛛尼尔机械纪元机械蜘蛛怎么过 机械蜘蛛打法攻略解析www.cn12365.orgwww.12365china.net是不是真的防伪网站300373一搓黑是真的吗hao.rising.cn瑞星强制篡改主页 HTTP://HAO.RISING.CN 各位有什么办法可以解决吗?鹤城勿扰齐齐哈尔,又叫鹤城吗?月风随笔关于春夏秋冬的散文百度关键字在百度 输入任何关键词,可以搜出想要的内容,但是 搜索工具栏里面的字,却始终是同一个关键词, 如图干支论坛天干地支???
深圳域名注册 流媒体服务器 私有云存储 发包服务器 英文站群 网通ip dd444 789电视 空间技术网 如何建立邮箱 独享主机 智能dns解析 稳定空间 阵亡将士纪念日 美国asp空间 以下 vi命令 ddos攻击器下载 电脑显示屏不亮但是主机已开机 qq空间登录首页 更多