• If the HRCNFG[AUTOCONV] bit is clear, the HRMSTEP register is ignored. The application software will
need to perform the necessary calculations manually so that:
– CMPAHR = (fraction(PWMduty * PWMperiod) * MEP Scale Factor)<<8 + 0x080.
– Similar behavior applies for TBPHSHR. Auto-conversion must be enabled when using TBPRDHR.
The routine can be run as a background tasks in a slow loop requiring negligible CPU cycles. The repetition
rate at which an SFO function needs to be executed depends on the application's operating environment. As
with all digital CMOS devices temperature and supply voltage variations have an effect on MEP operation.
However, in most applications these parameters vary slowly and therefore it is often sufficient to execute the
SFO function once every 5 to 10 seconds or so. If more rapid variations are expected, then execution may have
to be performed more frequently to match the application. Note, there is no high limit restriction on the SFO
function repetition rate, hence it can execute as quickly as the background loop is capable.
While using the HRPWM feature, HRPWM logic will not be active for the first 3 SYSCLKOUT cycles of the
PWM period (and the last 3 SYSCLKOUT cycles of the PWM period if TBPRDHR is used). While running the
application in this configuration, if high-resolution period control is disabled (HRPCTL[HRPE=0]) and the CMPA
register value is less than 3 cycles, then its CMPAHR register must be cleared to zero. If high-resolution period
control is enabled (HRPCTL[HRPE=1]), the CMPA register value must not fall below 3 or above TBPRD-3.This
would avoid any unexpected transitions on the PWM signal.
4.3.2 Software Usage
The software library function SFO(), calculates the MEP scale factor for the HRPWM-supported ePWM modules.
The scale factor is an integer value in the range 1-255, and represents the number of micro step edge
positions available for a system clock period. The scale factor value is returned in an integer variable called
MEP_ScaleFactor. For example, see
.
Table 4-7. Factor Values
Software Function call
Functional Description
Updated Variables
SFO()
Returns MEP scale factor in MEP_ScaleFactor
MEP_ScaleFactor and HRMSTEP register.
Returns MEP scale factor in the HRMSTEP register in
SFO_TI_Build_V6b.lib
To use the HRPWM feature of the ePWMs it is recommended that the SFO function be used as described here.
Step 1. Add "Include" Files
The SFO_V6.h file needs to be included as follows. This include file is mandatory while using the SFO
library function. For the TMS320F2806x devices, the F2806x C/C++ Header Files and Peripheral Examples
in controlSUITE F2806x_Device.h and F2806x_Epwm_defines.h are necessary. For other device families, the
device-specific equivalent files in the header files and peripheral examples software packages for those devices
should be used. These include files are optional if customized header files are used in the end applications.
Example 4-6. A Sample of How to Add "Include" Files
#include "F2806x_Device.h" // F2806x Headerfile
#include "F2806x_EPwm_defines.h" // init defines
#include "SFO_V6.h" // SFO lib functions (needed for HRPWM)
High-Resolution Pulse Width Modulator (HRPWM)
398
TMS320x2806x Microcontrollers
SPRUH18I – JANUARY 2011 – REVISED JUNE 2022
Copyright © 2022 Texas Instruments Incorporated
Содержание TMS320 2806 Series
Страница 2: ......