最新EPWM总结资料.docx
- 文档编号:11966074
- 上传时间:2023-04-16
- 格式:DOCX
- 页数:19
- 大小:760.52KB
最新EPWM总结资料.docx
《最新EPWM总结资料.docx》由会员分享,可在线阅读,更多相关《最新EPWM总结资料.docx(19页珍藏版)》请在冰豆网上搜索。
最新EPWM总结资料
DSP2808之EPWM笔记
一、EPWM有什么模式和功能
6个EPWM
包含子模式
ThisguidedescribestheEnhancedPulseWidthModulator(ePWM)Module.Itincludesanoverviewofthemoduleandinformationabouteachofthesub-modules:
•TB----Time-BaseModule
•CC----CounterCompareModule
•AQ----ActionQualifierModule
•DB----Dead-BandGeneratorModule
•PC----PWMChopper(PC)Module(斩波)
•TZ----TripZoneModule
•ET----EventTriggerModule
TheePWMperipheralperformsadigitaltoanalog(DAC)function,wherethedutycycleisequivalenttoaDACanalogvalue;itissometimesreferredtoasaPowerDAC.
theePWMisbuiltupfromsmallersinglechannelmoduleswithseparateresourcesandthatcanoperatetogetherasrequiredtoformasystem
一个完整的PWM通道有两个PWM输出组成:
EPWMxAEPWMxB
TheePWMmodulesarechainedtogetherviaaclocksynchronizationschemethatallowsthemtooperateasasinglesystemwhenrequired.-------→ECAPextendedcaptureperipheralmodules
每个EPWM支持功能:
1、专门的带周期和频率控制的16位计数器
2、两路PWM的输出(A,B)可以被配置为
–TwoindependentPWMoutputswithsingle-edgeoperation
–TwoindependentPWMoutputswithdual-edgesymmetricoperation
–OneindependentPWMoutputwithdual-edgeasymmetricoperation双边不对称操作?
?
3、AsynchronousoverridecontrolofPWMsignalsthroughsoftware.
4、Programmablephase-controlsupportforlagorleadoperationrelativetootherePWMmodule
5、Hardware-locked(synchronized)phaserelationshiponacycle-by-cyclebasis.
6、Dead-bandgenerationwithindependentrisingandfallingedgedelaycontrol.
7、Programmabletripzoneallocationofbothcycle-by-cycletripandone-shottriponfaultconditions.
8、Atripconditioncanforceeitherhigh,low,orhigh-impedancestatelogiclevelsatPWMoutput
9、AlleventscantriggerbothCPUinterruptsandADCstartofconversion(SOC)如何理解
10、ProgrammableeventprescalingminimizesCPUoverheadoninterrupts.
11、PWMchoppingbyhigh-frequencycarriersignal,usefulforpulsetransformergatedrives.
通过GPIO外设,死区信号可以被设置成异步输入信号。
PeripheralBus
Theperipheralbusis32-bitswideandallowsboth16-bitand32-bitwritestotheePWMregisterfile.
PWM模块内部功能连接:
CHOPPER电路详细:
4个shadow模式寄存器(尽量使用shadow,保证数据安全)
HRPWM(HighResolutionPWM)仅初始化。
事件管理器上的区别(28082812)
二、七种子模式的配置方法
定义在sys_marco.h文件中
Table2-1.SubmoduleConfigurationParameters
SubmoduleConfigurationParameterorOption
Time-base(TB)
•Scalethetime-baseclock(TBCLK)relativetothesystemclock(SYSCLKOUT).
•ConfigurethePWMtime-basecounter(TBCTR)frequencyorperiod.
•Setthemodeforthetime-basecounter:
–count-upmode:
usedforasymmetricPWM
–count-downmode:
usedforasymmetricPWM
–count-up-and-downmode:
usedforsymmetricPWM
•Configurethetime-basephaserelativetoanotherePWMmodule.
•Synchronizethetime-basecounterbetweenmodulesthroughhardwareorsoftware.
•Configurethedirection(upordown)ofthetime-basecounterafterasynchronizationevent.
•Configurehowthetime-basecounterwillbehavewhenthedeviceishaltedbyanemulator.
•SpecifythesourceforthesynchronizationoutputoftheePWMmodule:
–Synchronizationinputsignal
–Time-basecounterequaltozero
–Time-basecounterequaltocounter-compareB(CMPB)
–Nooutputsynchronizationsignalgenerated.
Counter-compare(CC)
•SpecifythePWMdutycycleforoutputEPWMxAand/oroutputEPWMxB
•SpecifythetimeatwhichswitchingeventsoccurontheEPWMxAorEPWMxBoutput
Action-qualifier(AQ)
•Specifythetypeofactiontakenwhenatime-baseorcounter-comparesubmoduleeventoccurs:
–Noactiontaken
–OutputEPWMxAand/orEPWMxBswitchedhigh
–OutputEPWMxAand/orEPWMxBswitchedlow
–OutputEPWMxAand/orEPWMxBtoggled
•ForcethePWMoutputstatethroughsoftwarecontrol
•ConfigureandcontrolthePWMdead-bandthroughsoftware
Dead-band(DB)
•Controloftraditionalcomplementarydead-bandrelationshipbetweenupperandlowerswitches
•Specifytheoutputrising-edge-delayvalue
•Specifytheoutputfalling-edgedelayvalue
•Bypassthedead-bandmoduleentirely.InthiscasethePWMwaveformispassedthroughwithoutmodification.
PWM-chopper(PC)
•Createachopping(carrier)frequency.
•Pulsewidthofthefirstpulseinthechoppedpulsetrain.
•Dutycycleofthesecondandsubsequentpulses.
•BypassthePWM-choppermoduleentirely.InthiscasethePWMwaveformispassedthrough
withoutmodification.
Trip-zone(TZ)
•ConfiguretheePWMmoduletoreacttoone,all,ornoneofthetrip-zonepins.
•Specifythetrippingactiontakenwhenafaultoccurs:
–ForceEPWMxAand/orEPWMxBhigh
–ForceEPWMxAand/orEPWMxBlow
–ForceEPWMxAand/orEPWMxBtoahigh-impedancestate
–ConfigureEPWMxAand/orEPWMxBtoignoreanytripcondition.
•ConfigurehowoftentheePWMwillreacttoeachtrip-zonepin:
–One-shot
–Cycle-by-cycle
•Enablethetrip-zonetoinitiateaninterrupt.
•Bypassthetrip-zonemoduleentirely.
Event-trigger(ET)
•EnabletheePWMeventsthatwilltriggeraninterrupt.
•EnableePWMeventsthatwilltriggeranADCstart-of-conversionevent.
•Specifytherateatwhicheventscausetriggers(everyoccurrenceoreverysecondorthirdoccurrence)
•Poll,set,orcleareventflags
TB结构图
Generatethefollowingevents:
–CTR=PRD:
Time-basecounterequaltothespecifiedperiod(TBCTR=TBPRD).
Thissignalisgeneratedwheneverthecountervalueisequaltotheactiveperiodregistervalue.ThatiswhenTBCTR=TBPRD.
–CTR=Zero:
Time-basecounterequaltozero(TBCTR=0x0000).
Thissignalisgeneratedwheneverthecountervalueiszero.ThatiswhenTBCTRequals0x0000.
–CTR=CMPB
Thiseventisgeneratedbythecounter-comparesubmoduleandusedbythesynchronizationoutlogic
CTR_max:
Time-basecounterequalmaxvalue.(TBCTR=0xFFFF)
/*-------------------------------------------------------------
EPWM相关宏定义
--------------------------------------------------------------*/
/*时基控制*/
//========================
//----------------------------------
#definePWM_PERIOD12625//PWM计数周期
#defineHALF_PWM_PERIOD6312//PWM计数周期一半
#defineDEAD_BAND_COUNT160
//死区时间3.2usdeadtime=DEAD_BAND_COUNT/TBCLK
/*计数方式*/
#defineTB_COUNT_UP0x0//增计数,增至TBPRD,从零开始重计
#defineTB_COUNT_DOWN0x1//减计数,从TBPRD减至0,再重复
#defineTB_COUNT_UPDOWN0x2//连续增减计数PWM12356均设置为2
//增至(TBPRD)valueisreached.后再减到0
#defineTB_FREEZE0x3//停止
//PHSENbit=0设置为主动模式,=1设置为从动模式PWM1为主,其余为从
#defineTB_DISABLE0x0//Phaseloadingdisabled
#defineTB_ENABLE0x1//Phaseloadingenabled
//PRDLDbit
#defineTB_SHADOW0x0
//TBPRDisloadedfromitsshadowregisterwhenTBCTRisequaltozero.
//AwriteorreadtotheTBPRDregisteraccessestheshadowregister.
#defineTB_IMMEDIATE0x1
//LoadtheTBPRDregisterimmediately.
//AwriteorreadtotheTBPRDregisterdirectlyaccessestheactiveregister.
//SYNCOSELbits
#defineTB_SYNC_IN0x0
#defineTB_CTR_ZERO0x1
#defineTB_CTR_CMPB0x2
#defineTB_SYNC_DISABLE0x3
//HSPCLKDIVandCLKDIVbits
#defineTB_DIV10x0
#defineTB_DIV20x1
#defineTB_DIV40x2
//PHSDIRbit
#defineTB_DOWN0x0
#defineTB_UP0x1
//CMPCTL(CompareControl)
//==========================
//计数器重载方式
#defineCC_CTR_ZERO0x0//计数器为0时,重新装载
#defineCC_CTR_PRD0x1//周期匹配时,重新装载
#defineCC_CTR_ZERO_PRD0x2//周期匹配或计数器为零时,重新装载
#defineCC_LD_DISABLE0x3//禁止重新装载
//SHDWAMODEandSHDWBMODEbits
#defineCC_SHADOW0x0//PWM12356均设置为shadow
#defineCC_IMMEDIATE0x1
//AQCTLAandAQCTLB(ActionQualifierControl)
//=============================================
//ZRO,PRD,CAU,CAD,CBU,CBDbits
#defineAQ_NO_ACTION0x0//匹配时无动作(输出电平保持不变)
#defineAQ_CLEAR0x1//匹配时输出低电平
#defineAQ_SET0x2//匹配时输出高电平
#defineAQ_TOGGLE0x3//匹配时电平翻转
//DBCTL(Dead-BandControl)
//==========================
//OUTMODEbits//第0位控制S0,第1位控制S1
#defineDB_DISABLE0x0//POLSEL和INMODE不起作用
//00绕开死区,EPWMxAin和EPWMxBin输出信号直接传给PWM斩波器子模式。
#defineDBA_ENABLE0x1
//01不允许上升沿delay,A直接输出;下降沿delay,B通过死区输出
#defineDBB_ENABLE0x2
//10与01情况相反
#defineDB_FULL_ENABLE0x3
//11死区全部使能,TheinputsignalforthedelayisdeterminedbyDBCTL[IN_MODE]
//POLSELbits//PolaritySelectControl极性选择控制//第2位控制S2,第3位控制S3
#defineDB_ACTV_HI0x0//默认不翻转极性
#defineDB_ACTV_LOC0x1//A翻转
#defineDB_ACTV_HIC0x2//B翻转
#defineDB_ACTV_LO0x3//A、B都翻转
//INMODE//第4位控制S4,第5位控制S5
//Toproduceclassicaldead-bandwaveformsthedefaultisEPWMxAInisthesourceforboth(0)
#defineDBA_ALL0x0//程序初始化为0
#defineDBB_RED_DBA_FED0x1
#defineDBA_RED_DBB_FED0x2
#defineDBB_ALL0x3
//CHPCTL(choppercontrol)
//==========================
//CHPENbit
#defineCHP_DISABLE0x0
#defineCHP_ENABLE0x1
//CHPFREQbits
#defineCHP_DIV10x0
#defineCHP_DIV20x1
#defineCHP_DIV30x2
#defineCHP_DIV40x3
#defineCHP_DIV50x4
#defineCHP_DIV60x5
#defineCHP_DIV70x6
#defineCHP_DIV80x7
//CHPDUTYbits
#defineCHP1_8TH0x0
#defineCHP2_8TH0x1
#defineCHP3_8TH0x2
#defineCHP4_8TH0x3
#defineCHP5_8TH0x4
#defineCHP6_8TH0x5
#defineCHP7_8TH0x6
//TZSEL(TripZoneSelect)
//==========================
//CBCnandOSHTnbits
#defineTZ_DISABLE0x0
#defineTZ_ENABLE0x1
//TZCTL(TripZoneControl)
//==========================
//TZAandTZBbits
#defineTZ_HIZ0x0
#defineTZ_FORCE_HI0x1
#defineTZ_FORCE_LO0x2
#defineTZ_NO_CHANGE0x3
//ETSEL(EventTriggerSelect)
//=============================
#defineET_CTR_ZERO0x1
#defineET_CTR_PRD0x2
#defineET_CTRU_CMPA0x4
#defineET_CTRD_CMPA0x5
#defineET_CTRU_CMPB0x6
#defineET_CTRD_CMPB0x7
//ETPS(EventTriggerPre-scale)
//===============================
//INTPRD,SOCAPRD,SOCBPRDbits
我们长期呆在校园里,对社会缺乏了解,在与生意合作伙伴应酬方面往往会遇上困难,更不用说商业上所需经历的一系列繁琐手续。
他们我们可能会在工商局、税务局等部门的手续中迷失方向。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 最新 EPWM 总结 资料