Epwm.h File Reference

PWM Interface Routines. More...

#include "TIMotorLIB.h"
#include "SFO_V5.h"
#include "IQConstants.h"
#include "Utils.h"

Go to the source code of this file.

Data Structures

struct  PWM3phConfiguration
 three phase PWM configuration More...

Defines

#define EPWM1_INT_ACK   (0x1);
#define EPWM2_INT_ACK   (0x2);
#define EPWM3_INT_ACK   (0x4);
#define EPWM4_INT_ACK   (0x8);
#define EPWM5_INT_ACK   (0x10);
#define EPWM6_INT_ACK   (0x20);
#define PWM_OUTPUTS_SIZE   (12)
 number of pwm outputs

Enumerations

enum  EPWMX { EPWMA, EPWMB }
 

select EPWM device

More...
enum  PHSEN { MASTERPWM, SLAVEPWM }
 

select device as master or slave

More...
enum  SYNCOSEL { SYNC_IN = 0, SYNC_CTR_ZERO = 1, SYNC_CTR_CMPB = 2, SYNC_DISABLE = 3 }
 

select synchronization output mode

More...
enum  ePWMenum {
  PWM1 = 0, PWM2 = 1, PWM3 = 2, PWM4 = 3,
  PWM5 = 4, PWM6 = 5
}
 

access to pwm devices individually

More...
enum  PWMMODE { NORMAL_MODE, HRPWM_MODE }
 

select normal mode or high resolution mode

More...
enum  PWMCARRIER { SAWTOOTH = TB_COUNT_UP, TRIANGLE = TB_COUNT_UPDOWN }
 

select carrier signal (sawtooth or triangle)

More...
enum  PWMMODULATION { SYMMETRICAL = CC_CTR_ZERO, ASYMMETRICAL = CC_CTR_ZERO_PRD }
 

select modulation (symmetrical, asymetrical) for triangle pwm carrier

More...
enum  INTSEL { CTR_ZERO = ET_CTR_ZERO, CTR_PRD = ET_CTR_PRD }
 

interrupt generation

More...
enum  ePWMSOC { SOCNULL = 0, SOCA = 1, SOCB = 2 }
 

start of conversion

More...
enum  SOCTrigger {
  EvTBeqZERO = 1, EvTBeqPRD = 2, EvTBCNTeqCMPAI = 4, EvTBCNTeqCMPAD = 5,
  EvTBCNTeqCMPBI = 6, EvTBCNTeqCMPBD = 7
}
 

SOC triggers.

More...
enum  sideEnum { xA = 0, xB = 6 }
 

select A or B switch

More...
enum  SWITCHLOGIC { NEG_LOGIC = 1, POS_LOGIC = 2 }
 

select switch logic

More...

Functions

void BindPWMOutputs (void)
void InitPWMPeripheralClocks (void)
 Init clocks on PWM inputs EPWMA/B depending on the configuration stored in pwmConf.epwmX.
void InitPWMAPeripheralClocks (void)
 Init clocks on PWM inputs EPWMA.
void InitPWMBPeripheralClocks (void)
 Init clocks on PWM inputs EPWMB.
void InitEPWMGpio (ePWMenum PWM)
void InitTzGpio (void)
void InitPWMSide (ePWMenum PWM, sideEnum side, PWMMODULATION modulation, SWITCHLOGIC switchLogic)
void InitSinglePWMOutput (void(*interruptFCN)(void), ePWMenum PWM, sideEnum side, Uint16 tpwm_us, PHSEN phSen, SYNCOSEL syncMode, PWMMODE pwmMode, PWMCARRIER pwmCarrier, PWMMODULATION modulation, INTSEL intSel, SWITCHLOGIC switchLogic)
void InitComplementaryPWMOutput (void(*interruptFCN)(void), ePWMenum PWM, Uint16 tpwm_us, Uint16 db_us, PHSEN phSen, PWMMODE pwmMode, PWMCARRIER pwmCarrier, PWMMODULATION modulation, INTSEL intSel, SWITCHLOGIC switchLogic)
void Init3phPWM (void(*interruptFCN)(void), EPWMX epwmX, Uint16 tpwm_us, Uint16 db_us, PWMCARRIER pwmCarrier, PWMMODULATION modulation, INTSEL intSel, _iq vBus, ePWMSOC soc, SOCTrigger trigger, SWITCHLOGIC switchLogic)
void ConfigurePWMLeg (volatile struct EPWM_REGS *pwmPtr, PHSEN master, Uint16 tpwm_us, Uint16 db_us, PWMCARRIER pwmCarrier, PWMMODULATION modulation, unsigned int polSel)
void AddEventTrigger (volatile struct EPWM_REGS *pwmPtr, ePWMSOC soc, SOCTrigger trigger)
static void SetEnablePWMInput (Uint16 *input)
static void UpdateEPWM (ePWMenum PWM, sideEnum side, _iq cmp)
static void UpdateEPWMDuty (ePWMenum PWM, sideEnum side, _iq duty)
static void UpdateHRPWM (ePWMenum PWM, _iq cmp)
static void UpdatePWM3ph (_iq vas, _iq vbs, _iq vcs, char saturate)
static void UpdatePWMA3ph (_iq vas, _iq vbs, _iq vcs, char saturate)
static void UpdatePWMB3ph (_iq vas, _iq vbs, _iq vcs, char saturate)
static void UpdatePWMDuty3ph (_iq vad, _iq vbd, _iq vcd)
static void UpdatePWMADuty3ph (_iq vad, _iq vbd, _iq vcd)
static void UpdatePWMBDuty3ph (_iq vad, _iq vbd, _iq vcd)
static void ForceSingleEPWM (ePWMenum PWM, sideEnum side, Uint16 level)
 Force EPWM values (spru791a.pdf, pp. 100).
static void _ForceSingleEPWM (volatile struct EPWM_REGS *pwmPtr, sideEnum side, Uint16 level)
static void ForceEPWM (ePWMenum PWM, sideEnum side, Uint16 level)
static void EnablePWM (Uint16 enable)
static void EnableEPWMModuleTBCLK (void)
 Enable device clock.
static void EpwmPIEAck (volatile struct EPWM_REGS *epwmRegs)
static void EpwmAPIEAck (void)
static void EpwmBPIEAck (void)

Variables

struct PWM3phConfiguration pwmConf
struct PWM3phConfiguration pwmAConf pwmBConf
struct EPWM_REGS * ePWM []
 acess pointers to pwm configuration registers
volatile Uint16 * cmpPtr [PWM_OUTPUTS_SIZE]
 fast access to EPWM comparison registers
int MEP_ScaleFactor [PWM_CH]
int MEP_SF1
int MEP_SF2
int MEP_SF3
int MEP_SF4
int MEP_SF5
int MEP_SF6

Detailed Description

PWM Interface Routines.

File Name : Epwm.h Project : TIMotorLIB

TI Doc: SPRU791, SPRUG04 (newer), spraai1

Author:
Pablo Garcia (pgarcia@isa.uniovi.es)
Date:
2007

Definition in file Epwm.h.


Define Documentation

#define EPWM1_INT_ACK   (0x1);

Definition at line 52 of file Epwm.h.

#define EPWM2_INT_ACK   (0x2);

Definition at line 53 of file Epwm.h.

#define EPWM3_INT_ACK   (0x4);

Definition at line 54 of file Epwm.h.

#define EPWM4_INT_ACK   (0x8);

Definition at line 55 of file Epwm.h.

#define EPWM5_INT_ACK   (0x10);

Definition at line 56 of file Epwm.h.

#define EPWM6_INT_ACK   (0x20);

Definition at line 57 of file Epwm.h.

#define PWM_OUTPUTS_SIZE   (12)

number of pwm outputs

Definition at line 60 of file Epwm.h.


Enumeration Type Documentation

enum ePWMenum

access to pwm devices individually

Enumerator:
PWM1 

EPWM1A/1B.

PWM2 

EPWM2A/2B.

PWM3 

EPWM3A/3B.

PWM4 

EPWM4A/4B.

PWM5 

EPWM5A/5B.

PWM6 

EPWM6A/6B.

Definition at line 87 of file Epwm.h.

enum ePWMSOC

start of conversion

Enumerator:
SOCNULL 

A/D start of conversion decoupled from EPWM.

SOCA 

EPWM generates SOC for sequencer A.

SOCB 

EPWM genrates SOC for sequencer B.

Definition at line 121 of file Epwm.h.

enum EPWMX

select EPWM device

Enumerator:
EPWMA 

EPWMA.

EPWMB 

EPWMB.

Definition at line 67 of file Epwm.h.

enum INTSEL

interrupt generation

Enumerator:
CTR_ZERO 

interrupt on counter reach zero

CTR_PRD 

interrupt on counter reach period

Definition at line 115 of file Epwm.h.

enum PHSEN

select device as master or slave

Enumerator:
MASTERPWM 

EPWM is master.

SLAVEPWM 

EPWM is slave.

Definition at line 73 of file Epwm.h.

enum PWMCARRIER

select carrier signal (sawtooth or triangle)

Enumerator:
SAWTOOTH 

sawtooth carrier

TRIANGLE 

triangle carrier

Definition at line 103 of file Epwm.h.

enum PWMMODE

select normal mode or high resolution mode

Enumerator:
NORMAL_MODE 

normal mode

HRPWM_MODE 

high resolution mode

Definition at line 97 of file Epwm.h.

select modulation (symmetrical, asymetrical) for triangle pwm carrier

Enumerator:
SYMMETRICAL 

symmetrical modulation

ASYMMETRICAL 

asymmetrical modulation (update on zero and period)

Definition at line 109 of file Epwm.h.

enum sideEnum

select A or B switch

Enumerator:
xA 

A switches.

xB 

B switches.

Definition at line 139 of file Epwm.h.

enum SOCTrigger

SOC triggers.

Enumerator:
EvTBeqZERO 

trigger A/D on zero

EvTBeqPRD 

trigger A/D of period

EvTBCNTeqCMPAI 

trigger A/D on compare math EPWMA (increasing)

EvTBCNTeqCMPAD 

trigger A/D on compare math EPWMA (decreasing)

EvTBCNTeqCMPBI 

trigger A/D on compare math EPWMB (increasing)

EvTBCNTeqCMPBD 

trigger A/D on compare math EPWMB (decreasing)

Definition at line 129 of file Epwm.h.

select switch logic

Enumerator:
NEG_LOGIC 
POS_LOGIC 

Definition at line 145 of file Epwm.h.

enum SYNCOSEL

select synchronization output mode

Enumerator:
SYNC_IN 

synchronize with input

SYNC_CTR_ZERO 

Time-base counter equal to zero.

SYNC_CTR_CMPB 

Time-base counter equal to counter compare B.

SYNC_DISABLE 

Disable signal.

Definition at line 79 of file Epwm.h.


Function Documentation

static void _ForceSingleEPWM ( volatile struct EPWM_REGS *  pwmPtr,
sideEnum  side,
Uint16  level 
) [inline, static]

Force Single PWM output to a given level

Parameters:
pwmPtr Pointer to the EPWM_REGS register which output wants to be forced.
side selection of xA/xB output
level 0 --> low, 1 --> high

Definition at line 570 of file Epwm.h.

void AddEventTrigger ( volatile struct EPWM_REGS *  pwmPtr,
ePWMSOC  soc,
SOCTrigger  trigger 
)

Selects where the Start of Conversion (SOC) signal is generated

Parameters:
pwmPtr,: Pointer to EPWM_REGS register for the configuration
soc,: Which sequencer is triggered (SOCNULL/SOCA/SOCB)
trigger,: 
  • EvTBeqZERO trigger A/D on zero
  • EvTBeqPRD trigger A/D of period
  • EvTBCNTeqCMPAI trigger A/D on compare math EPWMA (increasing)
  • EvTBCNTeqCMPAD trigger A/D on compare math EPWMA (decreasing)
  • EvTBCNTeqCMPBI trigger A/D on compare math EPWMB (increasing)
  • EvTBCNTeqCMPBD trigger A/D on compare math EPWMB (decreasing)

Definition at line 394 of file Epwm.c.

void BindPWMOutputs ( void   ) 

Definition at line 69 of file Epwm.c.

void ConfigurePWMLeg ( volatile struct EPWM_REGS *  pwmPtr,
PHSEN  master,
Uint16  tpwm_us,
Uint16  db_us,
PWMCARRIER  pwmCarrier,
PWMMODULATION  modulation,
unsigned int  polSel 
)

Configure two switches to work in complementary mode

Parameters:
pwmPtr,: Pointer to EPWM_REGS register for the configuration of the switches pair
master,: MASTERPWM/SLAVEPWM. Selects if the clocking signal is generated by the configured output or is passed externally.
tpwm_us,: switching period in us
db_us,: dead time value in us
pwmCarrier,: select SAWTOOTH or TRIANGLE carrier
modulation,: SYMMETRICAL/ASYMMETRICAL. If symmetrical, comparison values are updated when the counter reachs 0. If asymmetrical, comparison values are updated both at 0 and period of the counter
polSel,: Polarity selection for dead time generation (DB_ACTIVE_LOC/DB_ACTIVE_HIC)

Definition at line 348 of file Epwm.c.

static void EnableEPWMModuleTBCLK ( void   )  [inline, static]
static void EnablePWM ( Uint16  enable  )  [inline, static]
Deprecated:
: Not used anymore

Definition at line 606 of file Epwm.h.

static void EpwmAPIEAck ( void   )  [inline, static]

ACK interrupt for EPWMA. This function MUST be called if more interrupts from PIEACK_GROUP3 are wanted

Examples:
TIMotorLIBExampleHrdw/main.c, and TIMotorLIBExampleSw/main.c.

Definition at line 646 of file Epwm.h.

static void EpwmBPIEAck ( void   )  [inline, static]

ACK interrupt for EPWMB. This function MUST be called if more interrupts from PIEACK_GROUP3 are wanted

Examples:
TIMotorLIBExampleHrdw/main.c, and TIMotorLIBExampleSw/main.c.

Definition at line 657 of file Epwm.h.

static void EpwmPIEAck ( volatile struct EPWM_REGS *  epwmRegs  )  [inline, static]

ACK interrupt for epwmRegs. This function MUST be called if more interrupts from PIEACK_GROUP3 are wanted

Parameters:
epwmRegs pointer to EPWM_REGS register which interrupt is ACK

Definition at line 632 of file Epwm.h.

static void ForceEPWM ( ePWMenum  PWM,
sideEnum  side,
Uint16  level 
) [inline, static]

Force Single PWM output to a given level

Parameters:
PWM output selection by identifier (PWM1..PWM6)
side selection of xA/xB output
level 0 --> low, 1 --> high

Definition at line 592 of file Epwm.h.

static void ForceSingleEPWM ( ePWMenum  PWM,
sideEnum  side,
Uint16  level 
) [inline, static]

Force EPWM values (spru791a.pdf, pp. 100).

Definition at line 557 of file Epwm.h.

void Init3phPWM ( void(*)(void)  interruptFCN,
EPWMX  epwmX,
Uint16  tpwm_us,
Uint16  db_us,
PWMCARRIER  pwmCarrier,
PWMMODULATION  modulation,
INTSEL  intSel,
_iq  vBus,
ePWMSOC  soc,
SOCTrigger  trigger,
SWITCHLOGIC  switchLogic 
)

Intializes a set of EPWM outputs to drive a three phase inverter

Parameters:
interruptFCN,: pointer to ISR executed when intSel condition is reached. If 0, no function is called
epwmX,: Selection of PWM input to be configured (PWM1...PWM6)
tpwm_us,: switching period in us
db_us,: dead time value in us
pwmCarrier,: select SAWTOOTH or TRIANGLE carrier
modulation,: SYMMETRICAL/ASYMMETRICAL. If symmetrical, comparison values are updated when the counter reachs 0. If asymmetrical, comparison values are updated both at 0 and period of the counter
intSel,: CTR_ZERO/CTR_PRD. Call the ISR when the counter reach 0 or when the counter reach the period.
vBus,: DC bus voltage in V (
Todo:
: Eliminate this parameter)
Parameters:
soc,: SOCNULL/SOCA/SOCB. Generates a start of converion trigger for none, A or B sequencer respectively
trigger,: trigger of SOC. See AddEventTrigger function.
switchLogic,: POS_LOGIC/NEG_LOGIC. Select logic for the switches

Definition at line 263 of file Epwm.c.

void InitComplementaryPWMOutput ( void(*)(void)  interruptFCN,
ePWMenum  PWM,
Uint16  tpwm_us,
Uint16  db_us,
PHSEN  phSen,
PWMMODE  pwmMode,
PWMCARRIER  pwmCarrier,
PWMMODULATION  modulation,
INTSEL  intSel,
SWITCHLOGIC  switchLogic 
)

Intializes a given EPWM pair in complementary mode

Parameters:
interruptFCN,: pointer to ISR executed when intSel condition is reached. If 0, no function is called
PWM,: Selection of PWM input to be configured (PWM1...PWM6)
tpwm_us,: switching period in us
db_us,: dead time value in us
phSen,: select device as master or slave (MASTERPWM/SLAVEPWM)
pwmMode,: normal mode (16 bits) or high resolution (
Todo:
) (32 bits)
Parameters:
pwmCarrier,: select SAWTOOTH or TRIANGLE carrier
modulation,: SYMMETRICAL/ASYMMETRICAL. If symmetrical, comparison values are updated when the counter reachs 0. If asymmetrical, comparison values are updated both at 0 and period of the counter
intSel,: CTR_ZERO/CTR_PRD. Call the ISR when the counter reach 0 or when the counter reach the period.
switchLogic,: POS_LOGIC/NEG_LOGIC. Select logic for the switches

Definition at line 217 of file Epwm.c.

void InitEPWMGpio ( ePWMenum  PWM  ) 

Configure needed GPIO ports to be used by EPWM outputs. Affected GPIO inputs are: EPWM1: GPIO0, GPIO1 EPWM2: GPIO2, GPIO3 EPWM3: GPIO4, GPIO5 EPWM4: GPIO6, GPIO7 EPWM5: GPIO8, GPIO9 EPWM6: GPIO10, GPIO11 Actions taken:

  • Enable internal pull-up (GpioCtrlRegs.GPAPUD.bit.GPIOX=0)
  • Configure GPIOX as EPWM (GpioCtrlRegs.GPAMUX1.bit.GPIOX=1)
    Parameters:
    PWM is the pwm input to be used

Definition at line 460 of file Epwm.c.

void InitPWMAPeripheralClocks ( void   ) 

Init clocks on PWM inputs EPWMA.

Definition at line 432 of file Epwm.c.

void InitPWMBPeripheralClocks ( void   ) 

Init clocks on PWM inputs EPWMB.

Definition at line 446 of file Epwm.c.

void InitPWMPeripheralClocks ( void   ) 

Init clocks on PWM inputs EPWMA/B depending on the configuration stored in pwmConf.epwmX.

Definition at line 411 of file Epwm.c.

void InitPWMSide ( ePWMenum  PWM,
sideEnum  side,
PWMMODULATION  modulation,
SWITCHLOGIC  switchLogic 
)

Intializes a given EPWM side (A/B). This function only can be called after one output for the given EPWM module has been configured. Example: InitSinglePWMOutput(pwmInterrupt, PWM1, xA, TPWMA_US, MASTERPWM, SYNC_DISABLE, NORMAL_MODE, TRIANGLE, SYMMETRICAL, CTR_ZERO, POS_LOGIC); InitPWMSide(PWM1, xB, SYMMETRICAL, POS_LOGIC);

Parameters:
PWM,: Selection of PWM input to be configured (PWM1...PWM6)
sideEnum,: Selection of A/B switches
modulation,: SYMMETRICAL/ASYMMETRICAL. If symmetrical, comparison
switchLogic,: POS_LOGIC/NEG_LOGIC. Select logic for the drived switch

Definition at line 122 of file Epwm.c.

void InitSinglePWMOutput ( void(*)(void)  interruptFCN,
ePWMenum  PWM,
sideEnum  side,
Uint16  tpwm_us,
PHSEN  phSen,
SYNCOSEL  syncMode,
PWMMODE  pwmMode,
PWMCARRIER  pwmCarrier,
PWMMODULATION  modulation,
INTSEL  intSel,
SWITCHLOGIC  switchLogic 
)

Intializes a given EPWM

Parameters:
interruptFCN,: pointer to ISR executed when intSel condition is reached. If 0, no function is called
PWM,: Selection of PWM input to be configured (PWM1...PWM6)
sideEnum,: Selection of A/B switches
tpwm_us,: switching period in us
pwmMode,: normal mode (16 bits) or high resolution (
Todo:
) (32 bits)
Parameters:
PHSEN,: select device as master or slave (MASTERPWM/SLAVEPWM)
syncMode,: Synchronization mode (see SYNCOSEL)
pwmCarrier,: select SAWTOOTH or TRIANGLE carrier
modulation,: SYMMETRICAL/ASYMMETRICAL. If symmetrical, comparison values are updated when the counter reachs 0. If asymmetrical, comparison values are updated both at 0 and period of the counter
intSel,: CTR_ZERO/CTR_PRD. Call the ISR when the counter reach 0 or when the counter reach the period.
switchLogic,: POS_LOGIC/NEG_LOGIC. Select logic for the drived switch
void InitTzGpio ( void   ) 

Configure needed GPIO ports to be used by EPWM Trip-zone submodule. Affected GPIO inputs are: TZ1: GPIO12 TZ2: GPIO13 TZ3: GPIO14 TZ4: GPIO15 TZ5: GPIO16 TZ6: GPIO17 Actions taken:

  • Enable internal pull-up (GpioCtrlRegs.GPAPUD.bit.GPIOX=0)
  • Asynch input GPIOX (GpioCtrlRegs.GPAQSEL1.bit.GPIOX = 3)
  • Configure GPIOX as TZX (GpioCtrlRegs.GPAMUXn.bit.GPIOX = 1)

Definition at line 495 of file Epwm.c.

static void SetEnablePWMInput ( Uint16 *  input  )  [inline, static]

Definition at line 375 of file Epwm.h.

static void UpdateEPWM ( ePWMenum  PWM,
sideEnum  side,
_iq  cmp 
) [inline, static]

Definition at line 382 of file Epwm.h.

static void UpdateEPWMDuty ( ePWMenum  PWM,
sideEnum  side,
_iq  duty 
) [inline, static]

Definition at line 389 of file Epwm.h.

static void UpdateHRPWM ( ePWMenum  PWM,
_iq  cmp 
) [inline, static]

Definition at line 396 of file Epwm.h.

static void UpdatePWM3ph ( _iq  vas,
_iq  vbs,
_iq  vcs,
char  saturate 
) [inline, static]
Deprecated:
: Not use UpdatePWM3ph in new projects. Instead, UpdatePWMA3ph or UpdatePWMB3ph
Deprecated:
: Use UpdatePWMA3ph or UpdatePWMB3ph instead.

Todo:
These operation need to be changed if 2*OFFSETPWM > MAX IQ (4096)

(pwmConf.cmp1) = (Uint16)(_IQtoF(_IQmpy(vas,pwmConf.OFFSETPWMDIVVBUS))+pwmConf.OFFSETPWM); (pwmConf.cmp2) = (Uint16)(_IQtoF(_IQmpy(vbs,pwmConf.OFFSETPWMDIVVBUS))+pwmConf.OFFSETPWM); (pwmConf.cmp3) = (Uint16)(_IQtoF(_IQmpy(vcs,pwmConf.OFFSETPWMDIVVBUS))+pwmConf.OFFSETPWM);

(pwmConf.cmp1) = (Uint16)(_IQtoF(_IQmpy(vas,pwmConf.OFFSETPWMDIVVBUS))); (pwmConf.cmp2) = (Uint16)(_IQtoF(_IQmpy(vbs,pwmConf.OFFSETPWMDIVVBUS))); (pwmConf.cmp3) = (Uint16)(_IQtoF(_IQmpy(vcs,pwmConf.OFFSETPWMDIVVBUS)));

Examples:
TIMotorLIBExample2/main.c, and TIMotorLIBExample3/main.c.

Definition at line 407 of file Epwm.h.

static void UpdatePWMA3ph ( _iq  vas,
_iq  vbs,
_iq  vcs,
char  saturate 
) [inline, static]

Update EPWMA configured for thee phase systems

Parameters:
vas voltage for phase a
vbs voltage for phase b
vcs voltage for phase c
saturate saturate to Vbus/2

Todo:
: Saturate using IQsat functions

(pwmAConf.cmp1) = (Uint16)(_IQtoF(_IQmpy(vas,pwmAConf.OFFSETPWMDIVVBUS))); (pwmAConf.cmp2) = (Uint16)(_IQtoF(_IQmpy(vbs,pwmAConf.OFFSETPWMDIVVBUS))); (pwmAConf.cmp3) = (Uint16)(_IQtoF(_IQmpy(vcs,pwmAConf.OFFSETPWMDIVVBUS)));

Definition at line 442 of file Epwm.h.

static void UpdatePWMADuty3ph ( _iq  vad,
_iq  vbd,
_iq  vcd 
) [inline, static]

update EPWMA duty for three phase configuration: cmpX = 2*OFFSETPWM(1 - vXd) vXd = [0,1]

Parameters:
vad duty for phase a
vbd duty for phase b
vcd duty for phase c

(pwmAConf.cmp1) = (Uint16)((pwmAConf.OFFSETPWM << 1) - _IQ16toF(_IQ16mpy(_IQtoIQ16(vad),(_IQ16(pwmAConf.OFFSETPWM << 1))))); (pwmAConf.cmp2) = (Uint16)((pwmAConf.OFFSETPWM << 1) - _IQ16toF(_IQ16mpy(_IQtoIQ16(vbd),(_IQ16(pwmAConf.OFFSETPWM << 1))))); (pwmAConf.cmp3) = (Uint16)((pwmAConf.OFFSETPWM << 1) - _IQ16toF(_IQ16mpy(_IQtoIQ16(vcd),(_IQ16(pwmAConf.OFFSETPWM << 1)))));

Examples:
TIMotorLIBExampleHrdw/main.c, and TIMotorLIBExampleSw/main.c.

Definition at line 513 of file Epwm.h.

static void UpdatePWMB3ph ( _iq  vas,
_iq  vbs,
_iq  vcs,
char  saturate 
) [inline, static]

Update EPWMB configured for thee phase systems

Parameters:
vas voltage for phase a
vbs voltage for phase b
vcs voltage for phase c
saturate saturate to Vbus/2

Todo:
: Saturate using IQsat functions

(pwmBConf.cmp1) = (Uint16)(_IQtoF(_IQmpy(vas,pwmBConf.OFFSETPWMDIVVBUS))); (pwmBConf.cmp2) = (Uint16)(_IQtoF(_IQmpy(vbs,pwmBConf.OFFSETPWMDIVVBUS))); (pwmBConf.cmp3) = (Uint16)(_IQtoF(_IQmpy(vcs,pwmBConf.OFFSETPWMDIVVBUS)));

Definition at line 467 of file Epwm.h.

static void UpdatePWMBDuty3ph ( _iq  vad,
_iq  vbd,
_iq  vcd 
) [inline, static]

update EPWMB duty for three phase configuration: cmpX = 2*OFFSETPWM(1 - vXd) vXd = [0,1]

Parameters:
vad duty for phase a
vbd duty for phase b
vcd duty for phase c
Examples:
TIMotorLIBExampleHrdw/main.c, and TIMotorLIBExampleSw/main.c.

Definition at line 537 of file Epwm.h.

static void UpdatePWMDuty3ph ( _iq  vad,
_iq  vbd,
_iq  vcd 
) [inline, static]
Deprecated:
: Not use UpdatePWMDuty3ph in new projects. Instead, UpdatePWMADuty3ph or UpdatePWMBDuty3ph
Deprecated:
: Use UpdatePWMADuty3ph or UpdatePWMBDuty3ph instead.

Definition at line 488 of file Epwm.h.


Variable Documentation

volatile Uint16* cmpPtr[PWM_OUTPUTS_SIZE]

fast access to EPWM comparison registers

Definition at line 35 of file Epwm.c.

struct EPWM_REGS* ePWM[]

acess pointers to pwm configuration registers

Definition at line 33 of file Epwm.c.

int MEP_ScaleFactor[PWM_CH]

Definition at line 36 of file Epwm.c.

int MEP_SF1

Definition at line 37 of file Epwm.c.

int MEP_SF2

Definition at line 37 of file Epwm.c.

int MEP_SF3

Definition at line 37 of file Epwm.c.

int MEP_SF4

Definition at line 37 of file Epwm.c.

int MEP_SF5

Definition at line 37 of file Epwm.c.

int MEP_SF6

Definition at line 37 of file Epwm.c.

Definition at line 31 of file Epwm.c.

Deprecated:
: Not use pwmConf in new projects. Instead, pwmAConf or pwmBConf

Definition at line 29 of file Epwm.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated on Mon Apr 23 12:59:21 2012 for TIMotorLIB by  doxygen 1.6.3