NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
StarterWare EHRPWM
Introduction[edit]
The enhanced high resolution PWM (EHRPWM) is capable of generating complex pulse width waveforms with minimal CPU overhead. It is highly programmable and very flexible. Cross coupling or sharing of resources has been avoided; instead, the ePWM is built up from smaller single channel modules with separate resources and that can operate together as required to form a system.
Programming[edit]
To configure the EHRPWM, the following sequence can be used.
- EHRPWM needs to be first brought out of local reset by enabling the module inthe Power Sleep Controller by using PSCModuleControl().
- Pin multiplexing registers to enable EHRPWM pin and a standard configuration is provided as part of the function EHRPWMPinMuxSetup() in platform directory.
- Enable the AINTC to receive EHRPWM interrupts by using the AINTC API's given under /include/am1808/interrupt.h
- The EHRPWM has many sub-modules, which have to be configured,
- Timebase
- Scale the time-base clock (TBCLK) relative to the system clock (SYSCLKOUT) by using the API EHRPWMTimebaseClkConfig()
- Configure the PWM time-base counter (TBCNT) frequency or period and set the mode for the time-base counter by using the API EHRPWMPWMOpFreqSet()
- Configure the time-base phase relative to another ePWM module, synchronize the time-base counter between modules and configure the direction (up or down) of the time-base counter after a synchronization event by using the API EHRPWMTTimebaseSyncEnable()
- Configure how the time-base counter will behave when the device is halted by an emulator by using the API EHRPWMTEmulationModeSet()
- Specify the source for the synchronization output of the ePWM module by using the API EHRPWMTSyncOutModeSet()
- Counter-Compare
- Specify the PWM duty cycle for output EPWMxA and/or output EPWMxB and the time at which switching events occur by using the API's EHRPWMTLoadCMPA() & EHRPWMTLoadCMPB()
- Action-qualifier
- Specify the type of action taken when a time-base or counter-compare submodule event occurs by using the API EHRPWMTConfigureAQActionOnA() & EHRPWMTConfigureAQActionOnB()
- Dead-band
- Configure the output raising by using the API EHRPWMDBConfigureRED()
- Configure the falling edge delay by using the API EHRPWMDBConfigureFED()
- The source & polarity also can be configured
- PWM-chopper
- Configure the chopping (carrier) frequency by using the API EHRPWMConfigureChopperFreq()
- Configure the carrier frequency by using the API EHRPWMConfigureChopperDuty()
- The one shop pulse width can be configure by using the API EHRPWMConfigureChopperOSPW()
- HR
- The High resolution can be configure using the API's EHRPWMTLoadTBPHSHR() and EHRPWMTLoadCMPAHR()
- Timebase