This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I have EPWM trip zone defined as:
// Set up what to do when we disable EPWM output EPWM_setTripZoneAction(A_PWM_HS_BASE, EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(A_PWM_HS_BASE, EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(B_PWM_HS_BASE, EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(B_PWM_HS_BASE, EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(C_PWM_HS_BASE, EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW); EPWM_setTripZoneAction(C_PWM_HS_BASE, EPWM_TZ_ACTION_EVENT_TZB, EPWM_TZ_ACTION_LOW);
After running my motor, I disable EPWM like this:
bool Motor_PWMDisable() { pwmEnable = false; // clear PWM data Vabc_pu.value[0] = 0.0f; Vabc_pu.value[1] = 0.0f; Vabc_pu.value[2] = 0.0f; // Disable PWM output EPWM_forceTripZoneEvent(A_PWM_HS_BASE, EPWM_TZ_FORCE_EVENT_OST); EPWM_forceTripZoneEvent(B_PWM_HS_BASE, EPWM_TZ_FORCE_EVENT_OST); EPWM_forceTripZoneEvent(C_PWM_HS_BASE, EPWM_TZ_FORCE_EVENT_OST); return 0; }
This causes a shoot through condition because both the HS and LS turn on. Is there something I can do to prevent this? What am I doing wrong?
Thanks for the help!
Hi Derek,
I'm not sure I completely understand your problem. Are you trying to disable all 3 PWMs at the exact same time but there's a delay between each OST force, or are your PWMs not disabling at all?
Thank you,
Luke
Hi Derek,
I did some testing and calculated a 0.8 microsecond delay between each of the software forces. If you system relies on all 3 PWMs being disabled at the same time, you can achieve this by using a single INPUTXBAR as your trip source for all 3 PWMs, and then setting a GPIO high to trigger the INPUTXBAR trip. Let me know if you need help setting up this configuration.
--Luke
Hi Luke,
Thanks for the help! Could you share this configuration and I can try it?
I do not think I am seeing a shoot-through condition though. I do not see both HS and LS PWMs going high at the same time. Instead both PWMs are low (like I'd expect) and I see the same noise I see on my IOC line.
Therefore, I do not think this issue is what I think it is. I've got more investigation to do.
Thanks for the help!
Hi Derek,
Apologies for the delayed response, here is the configuration I used for testing:
main.c:
#include "driverlib.h"
#include "device.h"
#include "board.h"
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pull-ups.
//
Device_initGPIO();
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Disable sync(Freeze clock to PWM as well)
//
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
//
// Configure ePWM1, ePWM2 GPIOs and Modules
//
Board_init();
//
// Enable sync and clock to PWM
//
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
EPWM_setTripZoneAction(EPWM1_BASE, EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW);
EPWM_setTripZoneAction(EPWM2_BASE, EPWM_TZ_ACTION_EVENT_TZA, EPWM_TZ_ACTION_LOW);
//
// Enable Global Interrupt (INTM) and real time interrupt (DBGM)
//
EINT;
ERTM;
//
// IDLE loop. Just sit and loop forever (optional):
//
for(;;)
{
SysCtl_delay(100);
//EPWM_forceTripZoneEvent(EPWM1_BASE, EPWM_TZ_FORCE_EVENT_OST);
EALLOW;
HWREGH(EPWM1_BASE + EPWM_O_TZFRC) |= EPWM_TZ_FORCE_EVENT_OST;
//EPWM_forceTripZoneEvent(EPWM2_BASE, EPWM_TZ_FORCE_EVENT_OST);
EALLOW;
HWREGH(EPWM2_BASE + EPWM_O_TZFRC) |= EPWM_TZ_FORCE_EVENT_OST;
SysCtl_delay(100);
EPWM_clearTripZoneFlag(EPWM1_BASE, EPWM_TZ_FLAG_OST);
EPWM_clearTripZoneFlag(EPWM2_BASE, EPWM_TZ_FLAG_OST);
}
}
.syscfg file:
/**
* Import the modules used in this configuration.
*/
const epwm = scripting.addModule("/driverlib/epwm.js", {}, false);
const epwm1 = epwm.addInstance();
const epwm2 = epwm.addInstance();
const inputxbar = scripting.addModule("/driverlib/inputxbar.js", {}, false);
const inputxbar1 = inputxbar.addInstance();
const inputxbar_input = scripting.addModule("/driverlib/inputxbar_input.js");
const inputxbar_input1 = inputxbar_input.addInstance();
const sync = scripting.addModule("/driverlib/sync.js");
/**
* Write custom configuration values to the imported modules.
*/
epwm1.$name = "myEPWM0";
epwm1.epwmTimebase_period = 100;
epwm1.epwmTimebase_counterMode = "EPWM_COUNTER_MODE_UP";
epwm1.epwmActionQualifier_EPWM_AQ_OUTPUT_A_ON_TIMEBASE_ZERO = "EPWM_AQ_OUTPUT_HIGH";
epwm1.epwm.epwm_aPin.$assign = "ball.63";
epwm2.$name = "myEPWM1";
epwm2.epwmTimebase_period = 100;
epwm2.epwmTimebase_counterMode = "EPWM_COUNTER_MODE_UP";
epwm2.epwmActionQualifier_EPWM_AQ_OUTPUT_A_ON_TIMEBASE_ZERO = "EPWM_AQ_OUTPUT_HIGH";
epwm2.epwm.epwm_aPin.$assign = "ball.61";
inputxbar1.$name = "myINPUTXBAR1";
inputxbar_input1.$name = "myINPUTXBARINPUT0";
inputxbar_input1.inputxbarInput = "XBAR_INPUT5";
inputxbar_input1.inputxbarGpio = "GPIO2";
/**
* Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
* version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
* re-solve from scratch.
*/
epwm1.epwm.$suggestSolution = "EPWM1";
epwm1.epwm.epwm_bPin.$suggestSolution = "ball.62";
epwm2.epwm.$suggestSolution = "EPWM2";
epwm2.epwm.epwm_bPin.$suggestSolution = "ball.60";