AM62Px MCU+ SDK  10.01.00
EPWM

The ePWM driver provides API to configure various sub-modules within the ePWM module. Below are the high level features supported by the driver.

Features Supported

  • Configuration of Time Base submodule to set time-base clock, counter mode,
  • Configuration of Counter Compare submodule to specify duty cycle
  • Configuration of Action Qualifier submodule to specify the type of action to take when time-base or counter-compare event occurs
  • Configuration of Dead Band submodule to set rising-edge and falling-edge delay or bypass the module
  • Configuration of Chopper submodule to generate a chopper frequency, set pulse width of the first pulse in the chopped pulse train or bypass the module
  • Configuration of Trip Zone submodule to specify the tripping action to take when a fault occurs
  • Configuration of event-trigger submodule to trigger an interrupt and rate at which these events occur

SysConfig Features

Note
It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
  • Selection of output channels.
  • Configuring pinmux based on selected pin.
  • Enabling TimeBase Clock based on selected ePWM instance.

Features NOT Supported

  • ePWM digital comparator modules
  • ePWM high-resolution modules

Important Usage Guidelines

NA

Example Usage

Include the below file to access the APIs

#include <drivers/epwm.h>

Check external Synchronization signal

uint16_t tbStatus = EPWM_tbGetStatus(ePWMBaseAddr, EPWM_TB_STS_SYNCI);
if(0 == tbStatus)
{
DebugP_log("External Synchronization event has occured\r\n");
}
else
{
DebugP_log("No external Synchronization event has occured\r\n");
}

Get Timebase Counter direction

uint16_t tbStatus = EPWM_tbGetStatus(ePWMBaseAddr, EPWM_TB_STS_CTR_DIR);
if(0 == tbStatus)
{
DebugP_log("Time base counter is currently counting down\r\n");
}
else
{
DebugP_log("Time base counter is currently counting up\r\n");
}

Configure Counter compare

uint32_t counterCmpVal = 0x100;
uint32_t status;
if(TRUE == status)
{
DebugP_log("Comparator value was written successfully\r\n");
}
else
{
DebugP_log("Comparator value write failed\r\n");
}

API

APIs for EPWM

status
uint32_t status
Definition: tisci_lpm.h:1
epwm.h
EPWM_CC_CMP_A
#define EPWM_CC_CMP_A
Definition: epwm/v0/epwm.h:253
DebugP_log
#define DebugP_log(format,...)
Function to log a string to the enabled console.
Definition: DebugP.h:227
EPWM_CC_CMP_LOAD_MODE_CNT_EQ_PRD
#define EPWM_CC_CMP_LOAD_MODE_CNT_EQ_PRD
Definition: epwm/v0/epwm.h:297
EPWM_SHADOW_REG_CTRL_ENABLE
#define EPWM_SHADOW_REG_CTRL_ENABLE
Definition: epwm/v0/epwm.h:174
EPWM_TB_STS_SYNCI
#define EPWM_TB_STS_SYNCI
Definition: epwm/v0/epwm.h:219
EPWM_counterComparatorCfg
uint32_t EPWM_counterComparatorCfg(uint32_t baseAddr, uint32_t cmpType, uint32_t cmpVal, uint32_t enableShadowWrite, uint32_t shadowToActiveLoadTrigger, uint32_t overwriteShadow)
This API configures the counter comparator and loads the comparator value. When Counter comparator va...
EPWM_tbGetStatus
uint16_t EPWM_tbGetStatus(uint32_t baseAddr, uint32_t tbStatusMask)
This API gets the Time Base status as indicated by the tbStatusMask parameter.
TRUE
#define TRUE
Definition: csl_types.h:61
EPWM_TB_STS_CTR_DIR
#define EPWM_TB_STS_CTR_DIR
Definition: epwm/v0/epwm.h:221
FALSE
#define FALSE
Definition: csl_types.h:62