Transcription of TMS320x280x, 2801x, 2804x High Resolution Pulse Width ...
1 tms320x280x , 2801x ,2804xHighResolutionPul seWidthModulator(HRPWM)ReferenceGuideLit eratureNumber:SPRU924 FApril2005 RevisedOctober20112 SPRU924F April 2005 Revised October 2011 Submit Documentation FeedbackCopyright 2005 2011, texas instruments (SFO).. April2005 RevisedOctober2011 TableofContentsSubmitDocumentationFeedba ckCopyright 2005 2011, RequestedDuty= 1 1 (HRCNFG)..3013 CounterCompareA HighResolutionRegister(CMPAHR)..3014 TBPhaseHighResolutionRegister(TBPHSHR).. , (left),and[CMPA:CMPAHR]vsDuty(right)..14 5 DutyCycleRangeLimitationfor3 and6 (HRCNFG) HighResolutionRegister(CMPAHR) (TBPHSHR) April2005 RevisedOctober2011 SubmitDocumentationFeedbackCopyright 2005 2011,TexasInstrumentsIncorporatedPreface SPRU924F April2005 RevisedOctober2011 ReadThisFirstAboutThisManualThisdocument describestheoperationofthehigh-resolutio nextensiontothepulsewidthmodulator(HRPWM ).
2 TheHRPWM moduledescribedin thisreferenceguideis a Type0 ,28xxxDSPP eripheralReferenceGuide(SPRU566) fora listofalldeviceswithanHRPWM moduleofthesametype,todeterminethediffer encesbetweentypes,andfora listofdevice-specificdifferenceswithina ,thefollowingnumberis 40hexadecimal(decimal64):40h. Registersin thisdocumentareshownin figuresanddescribedin tables. Eachregisterfigureshowsa labeledwithitsbitname,itsbeginningandend ingbitnumbersabove, legendexplainsthenotationusedfortheprope rties. Reservedbitsin a registerfiguredesignatea bitthatis :Entertheliteraturenumberin ,relatedperipherals,andothertechnicalcol lateral,is availablein theC2000 SPRS230 TMS320F2809,F2808,F2806,F2802,F2801,C280 2,C2801,andF2801xDSPsDataManualcontainst hepinout,signaldescriptions, TMS320F280x,TMS320C280x, TMS320F28044 DigitalSignalProcessorDataManualcontains thepinout,signaldescriptions, 'sGuides SPRU430 TMS320C28xCPUandInstructionSetReferenceG uidedescribesthecentralprocessingunit(CP U)andtheassemblylanguageinstructionsofth eTMS320C28xfixed-pointdigitalsignalproce ssors(DSPs).
3 It tms320x280x , 2801x ,2804xDSPS ystemControlandInterruptsReferenceGuided escribesthevariousinterruptsandsystemcon trolfeaturesofthe280xdigitalsignalproces sors(DSPs).PeripheralGuides 5 SPRU924F April2005 RevisedOctober2011 PrefaceSubmitDocumentationFeedbackCopyri ght 2005 2011, TMS320x28xx,28xxxDSPP eripheralReferenceGuidedescribestheperip heralreferenceguidesofthe28xdigitalsigna lprocessors(DSPs).SPRU716 tms320x280x , 2801x ,2804xDSPA nalog-to-DigitalConverter(ADC)ReferenceG uidedescribeshowtoconfigureandusetheon-c hipADCmodule,whichis a tms320x280x , 2801x ,2804xEnhancedPulseWidt hModulator(ePWM)ModuleReferenceGuidedesc ribesthemainareasoftheenhancedpulsewidth modulatorthatincludedigitalmotorcontrol, switchmodepowersupplycontrol,UPS(uninter ruptiblepowersupplies),andotherformsofpo werconversionSPRU790 tms320x280x , 2801x ,2804xEnhancedQuadratur eEncoderPulse(eQEP)ModuleReferenceGuided escribestheeQEPmodule,whichis usedforinterfacingwitha linearorrotaryincrementalencodertogetpos ition,direction,andspeedinformationfroma includesthemoduledescriptionandregisters SPRU807 tms320x280x , 2801x ,2804xEnhancedCapture(e CAP)
4 tms320x280x , 2801x ,2804xHigh-ResolutionPu lseWidthModulatorReferenceGuidedescribes theoperationofthehigh-resolutionextensio ntothepulsewidthmodulator(HRPWM).SPRUEU0 tms320x280x /2801xEnhancedControllerAreaN etwork(eCAN)ReferenceGuidedescribestheen hancedcontrollerareanetwork(eCAN) tms320x280x , 2801x ,2804xSerialCommunicati onInterface(SCI)ReferenceGuidedescribest hefeaturesandoperationoftheserialcommuni cationinterface(SCI)modulethatisavailabl eontheTMS320x280x, 2801x , tms320x280x , 2801x , TMS320x28xx,28xxxInter-IntegratedCircuit (I2C)ModuleReferenceGuidedescribesthefea turesandoperationoftheinter-integratedci rcuit(I2C) tms320x280x , 2801x ,2804xBootROMR eferenceGuidedescribesthepurposeandfeatu resofthebootloader(factory-programmedboo t-loadingsoftware).It alsodescribesothercontentsofthedeviceon- chipbootROMandidentifieswherealloftheinf ormationis SPRU513 'sGuidedescribestheassemblylanguagetools (assemblerandothertoolsusedtodevelopasse mblylanguagecode),assemblerdirectives,ma cros,commonobjectfileformat, TMS320C28xOptimizingC/C++ 'sGuidedescribestheTMS320C28x C/C++ ++ TMS320C28xInstructionSetSimulatorTechnic alOverviewdescribesthesimulator,availabl ewithintheCodeComposerStudioforTMS320C20 00 IDE,thatsimulatestheinstructionsetoftheC 28x TMS320C28 (API) ,TMS320C28x, April2005 RevisedOctober2011 SubmitDocumentationFeedbackCopyright 2005 2011,TexasInstrumentsIncorporatedPWMtTPW MTSYSCLKPWM Resolution (%) = F/Fx 100%PWMSYSCLKOUTPWM Resolution (bits) = Log (T/T)2 PWMSYSCLKOUTR eferenceGuideSPRU924F April2005 RevisedOctober2011 high -ResolutionPulseWidthModulator(HRPWM )
5 Thisdocumentis usedinconjunctionwiththedevice-specificE nhancedPulseWidthModulator(ePWM) (PWM).HRPWM istypicallyusedwhenPWMresolutionfallsbel ow~ ~200kHzwhenusinga : Extendedtimeresolutioncapability Usedin bothdutycycleandphase-shiftcontrolmethod s Finertimegranularitycontroloredgepositio ningusingextensionstotheCompareA andPhaseregisters ImplementedusingtheA signalpathofPWM, , Self-checkdiagnosticssoftwaremodetocheck if themicroedgepositioner(MEP)logicis runningoptimally1 IntroductionTheePWMperipheralis usedtoperforma functionthatis mathematicallyequivalenttoa digital-to-analogconverter(DAC).Asshowni n Figure1, whereTSYSCLKOUT= 10ns( ),theeffectiveresolutionforconventionall ygeneratedPWMis a functionofPWMfrequency(orperiod) therequiredPWMoperatingfrequencydoesnoto ffersufficientresolutionin PWMmode, ,Table1 showsresolutionin 100 MHzSYSCLK frequencyanda (PWM)HighResolution(HRPWM)(kHz)Bits%Bits % April2005 RevisedOctober2011 high -ResolutionPulseWidthModulator(HRPWM )SubmitDocumentationFeedbackCopyright 2005 2011, (continued)PWMFreqRegularResolution(PWM) HighResolution(HRPWM)(kHz)Bits%Bits% ,typicallowfrequencyPWMoperation(below25 0kHz) mostusefulforhighfrequencyPWMrequirement sofpowerconversiontopologiessuchas.
6 Single-phasebuck,boost,andflyback Multi-phasebuck,boost,andflyback Phase-shiftedfullbridge DirectmodulationofD-Classpoweramplifiers 8 high -ResolutionPulseWidthModulator(HRPWM )SPRU924F April2005 RevisedOctober2011 SubmitDocumentationFeedbackCopyright 2005 2011,TexasInstrumentsIncorporatedFor MEP range and rounding adjustment (0x0180 in Q8 format)[+ ] basedonmicroedgepositioner(MEP) capableofpositioninganedgeveryfinelybysu b-dividingonecoarsesystemclockofa self-checksoftwarediagnosticsmodetocheck if theMEPlogicis runningoptimally, showstherelationshipbetweenonecoarsesyst emclockandedgepositionin termsofMEPsteps,whicharecontrolledviaan8 -bitfieldin theCompareA extensionregister(CMPAHR). ,configuretheTBM,CCM,andAQMregistersasyo uwouldtogeneratea conventionalPWMofa ,CCM,andAQMregisterstoextendedgeresoluti on, ,onlya thisdocumentcanbeseenin thedevice-specificEnhancedPulseWidthModu lator(ePWM) controlledandmonitoredusingthefollowingr egisters.
7 9 SPRU924F April2005 RevisedOctober2011 high -ResolutionPulseWidthModulator(HRPWM )SubmitDocumentationFeedbackCopyright 2005 2011,TexasInstrumentsIncorporatedTBPHSHR (8)Reserved (8)TBPHS (16)0x00020x0003 Reserved (8)TBPHSHR (8)TBPHS (16)3116 158 70 Single 32 bit writeReserved (8)CMPA (16)CMPAHR (8)0x00080x0009 Single 32 bit writeCMPA (16)31 CMPAHR (8)Reserved (8)16 158 (8bits)CMPAHR0x0008 YesExtensionRegisterforHRPWMDuty(8bits)H RCNFG(1)0x0020 NoHRPWMC onfigurationRegister(1)Thisregisteris controlledbytwoextensionregisters, TBPHSHR- TimeBasePhaseHighResolutionRegister CMPAHR- CounterCompareA (HRPWM)SPRU924F April2005 RevisedOctober2011 SubmitDocumentationFeedbackCopyright 2005 2011,TexasInstrumentsIncorporatedCTR=PRD TBPRD shadow (16)TBPRD active (16)Counterup/down(16 bit)TBCNT active (16)TBCTL[PHSEN]TBCTL[SWFSYNC](software forced sync)EPWMxSYNCICTR=ZEROCTR_DirCTR=CMPBD isabledSyncin/outselectMuxTBCTL[SYNCOSEL ]EPWMxSYNCOTBPHS active (24)168 TBPHSHR (8)PhasecontrolTime base (TB)CTR=CMPACMPA active (24)16 CMPA shadow (24)Actionqualifier(AQ)816 Counter compare (CC)CMPB active (16)CTR=CMPBCMPB shadow (16)CMPAHR (8)EPWMAEPWMBD eadband(DB)(PC)chopperPWMzone(TZ)TripCTR = ZEROEPWMxAOEPWMxBOEPWMxTZINTTZ1to TZ6 HiRes PWM (HRPWM)CTR = PRDCTR = ZEROCTR = CMPBCTR = CMPACTR_DirEventtriggerandinterrupt(ET)E PWMxINTEPWMxSOCAEPWMxSOCBCTR= givenfrequencyandpolarity,theHRPWMis :EdgeMode TheMEPcanbeprogrammedtoprovideprecisepos itioncontrolontherisingedge(RE),fallinge dge(FE)orbothedges(BE) ,whileBEis usedfortopologiesrequiringphaseshifting, , TheMEPis programmedtobecontrolledeitherfromtheCMP AHR register(dutycyclecontrol)ortheTBPHSHR register(phasecontrol).
8 Thismodeprovidesthesameshadowing(doubleb uffering)optionasin TBPHSHRis used, April2005 RevisedOctober2011 high -ResolutionPulseWidthModulator(HRPWM )SubmitDocumentationFeedbackCopyright 2005 2011, capableofplacinganedgein oneof255(8bits)discretetimesteps(seedevi ce-specificdatasheetfortypicalMEPstepsiz e).TheMEPworkswiththeTBMandCCMregisterst obecertainthattimestepsareoptimallyappli edandthatedgeplacementaccuracyis maintainedovera widerangeofPWMfrequencies, SYSCLKOUT, , (2)Tabledatabasedona MEPtimeresolutionof180ps(thisis anexamplevalue,seethedevice-specificdata sheetforMEPlimits.(3)MEPstepsapplied= TSYSCLKOUT/180psin thisexample.(4)PWMminimumfrequencyis basedona maximumperiodvalue, ,TBPRD= asymmetricalup-count.(5)Resolutionin bitsis (HRPWM)SPRU924F April2005 RevisedOctober2011 SubmitDocumentationFeedbackCopyright 2005 2011,TexasInstrumentsIncorporatedTpwm = 800 ns324 ns30 31 32 33 3410 ns ( ) typicalpowercontrolloop( ,switchmodes,digitalmotorcontrol[DMC],un interruptiblepowersupply[UPS]),a digitalcontroller(PID,2pole/2zero,lag/le ad,etc.))
9 Issuesa dutycommand,usuallyexpressedin a particularoperatingpoint,thedemandedduty cycleis systemclockof100 MHz,thedutycyclechoicesarein , a comparevalueof32counts( ,duty= 40%) is , showsthatin additiontotheCMPA value,22stepsoftheMEP(CMPAHR register) ns,resultingin ,it is RequestedDuty= April2005 RevisedOctober2011 high -ResolutionPulseWidthModulator(HRPWM )SubmitDocumentationFeedbackCopyright 2005 2011, (left),and[CMPA:CMPAHR]vsDuty(right)CMPA (count)(1)(2)(3)DUTYHighCMPACMPAHRDutyHi gh%Time(count)(count)(%)Time(ns)(ns) (1)Systemclock,SYSCLKOUTandTBCLK= 100 MHz,10ns(2)Fora PWMP eriodregistervalueof80counts,PWMP eriod= 80x 10ns= 800ns,PWMfrequency= 1/800ns= (3)AssumedMEPstepsizefortheaboveexample= timehasbeendemonstratedusingtheresources ofthestandardCMPAandMEP(CMPAHR) practicalapplication,however,it is necessarytoseamlesslyprovidetheCPUa mappingfunctionfroma per-unit(fractional)dutycycletoa finalinteger(non-fractional)representati onthatis writtentothe[CMPA:CMPAHR] , is commonin controlsoftwaretoexpressdutycyclein a ,expressedin clockcountsorhightimein ,it ,a two-stepscalingprocedureis (HRPWM)SPRU924F April2005 RevisedOctober2011 SubmitDocumentationFeedbackCopyright 2005 2011.
10 Systemclock, SYSCLKOUT=10ns(100 MHz)PWMfrequency= (1/800ns)RequiredPWMdutycycle,PWMDuty= ( )PWMperiodin termsofcoarsesteps,=80 PWMperiod(800ns/10ns)NumberofMEPstepsper coarsestepat=55180ps(10ns/180ps),MEP_Sca leFactorValuetokeepCMPAHR withintherangeof1-255andfractionalroundi ngconstant(defaultvalue)= (0180hin Q8format)Step1:PercentageIntegerDutyvalu econversionforCMPA registerCMPA registervalue=int(PWMDuty*PWMperiod); intmeansintegerpart=int( *80)=int( )CMPA registervalue=32(20h)Step2:Fractionalval ueconversionforCMPAHR registerCMPAHR registervalue=(frac(PWMDuty*PWMperiod)*M EP_ScaleFactor+ )<<8);fracmeansfractionalpart=(frac( )*55+ )<<8 Shiftis tomovethevalueasCMPAHR highbyte=( * 55+ )<<8=(22+ )<<8= * 256;Shiftingleftby8 is 1700h, lower8 April2005 RevisedOctober2011 high -ResolutionPulseWidthModulator(HRPWM )SubmitDocumentationFeedbackCopyright 2005 2011,TexasInstrumentsIncorporatedT= 1000 nsPWMEPWM1A010060 ns30 ns(F= 1 MHz)PWM36 SYSCLKOUT =TBCLK =100 :TheMEPscalefactor(MEP_ScaleFactor) (SFO)softwareC function,whichusesthebuiltin diagnosticsin eachHRPWM andreturnsthebestscalefactorfora limitedrangesotheoptimizingC functioncanberunveryslowlyin a memorysothatthe32-bitdatacapabilityofthe 28xCPUcanwritethisasa singleconcatenatedvalue, ,[CMPA:CMPAHR].
