Once the ePWM has been configured to provide conventional PWM of a given frequency and polarity, the HRPWM is configured by programming the HRCNFG register in that particular ePWM module's register space. This register provides the following configuration options:
Edge Mode
The MEP can be programmed to provide precise position control on the rising edge (RE), falling edge (FE) or both edges (BE) at the same time. FE and RE are used for power topologies requiring duty cycle control (CMPA or CMPB high-resolution control), while BE is used for topologies requiring phase shifting, for example, phase shifted full bridge (TBPHS or TBPRD high-resolution control).
Control Mode
The MEP is programmed to be controlled either
from the CMPAHR/CMPBHR register in case of duty
cycle control or the TBPHSHR register (phase
control). RE or FE control mode can be used with
the CMPAHR or CMPBHR register. BE control mode can
be used with the TBPHSHR register. When the MEP is
controlled from the TBPRDHR register (period
control), the duty cycle and phase can also be
controlled using the respective high-resolution
registers.
Shadow Mode
This mode provides the same shadowing (double buffering) option as in regular PWM mode. This option is valid only when operating from the CMPAHR, CMPBHR, and TBPRDHR registers and can be chosen to be the same as the regular load option for the CMPA/CMPB register. If TBPHSHR is used, then this option has no effect.
High-Resolution B Signal Control
The B signal path of an ePWM channel can generate a high-resolution output by outputting an inverted version of the high-resolution ePWMxA signal on the ePWMxB pin. A Type 2 or Type 4 HRPWM module can also enable high-resolution features on the B signal path independently of the A signal path as well.
Swap ePWMxA and ePWMxB Outputs
This mode enables the swapping of the high-resolution A and B outputs. The mode selection allows either A and B Outputs Unchanged or A Output Comes Out On B and B Output Comes Out On A.
Auto-conversion Mode
This mode is used in conjunction with the
scale factor optimization (SFO) software only. For
a type 4 HRPWM module, below is a description of
the Auto-conversion Mode taking CMPAHR as an
example. If auto-conversion is enabled,
CMPAHR = fraction(PWMduty ˟ PWMperiod)<<8.
The scale factor optimization software calculates
the MEP scale factor in the background code and
automatically updates the HRMSTEP register with
the calculated number of MEP steps per coarse
step. The MEP Calibration Module then uses the
values in the HRMSTEP and CMPAHR registers to
automatically calculate the appropriate number of
MEP steps represented by the fractional duty cycle
and moves the high-resolution ePWM signal edge
accordingly. If auto-conversion is disabled, the
CMPAHR register behaves like a type 0 HRPWM module
and CMPAHR = (fraction(PWMduty ˟ PWMperiod) ˟ MEP
Scale Factor + 0.5)<<8). All calculations
need to be performed by your code in this mode,
and the HRMSTEP register is ignored.
Auto-conversion for high-resolution period has the
same behavior as auto-conversion for
high-resolution duty cycle. Auto-conversion must
always be enabled for high-resolution period
mode.
Note: If the HRPWM
module is configured in UP-DOWN counter mode, the shadow
mode for the HRPWM registers must be set to load on both
ZERO AND PERIOD. New values from the user are loaded to the
shadow registers only at CTR = ZERO, but the shadow mode of
for the registers must be set to both ZERO AND PERIOD. The
CTR = PRD event is used for specific internal logic inside
the HRPWM module.
Auto-conversion Mode performs the calculation for
CMPBHR , DBREDHR, and DBFEDHR. The scale factor
optimization software calculates the MEP scale
factor in the background code and automatically
updates the HRMSTEP register with the calculated
number of MEP steps per coarse step. The MEP
Calibration Module then uses the values in the
HRMSTEP and CMPBHR or DBREDHR/DBFEDHR register to
automatically calculate the appropriate number of
MEP steps represented by the fractional components
and moves the high-resolution ePWM signal edge
accordingly. If auto-conversion is disabled,
CMPBHR behaves the same as CMPAHR.
CMPBHR = (fraction(PWMduty ˟ PWMperiod) ˟ MEP
Scale Factor + 0.5)<<8).
You are expected to disable protection for both
ePWM1 and HRPWM when the application requires
access to either of these modules.