Hello everyone,
I am stuck trying to figure out if I can manipulate the deadband on certain pins for the PWM. I am driving an H-Bridge with the PWM signals. The FETs on the H-Bridge are turned on active high, so I have the deadband in there to make sure I never have both FETs on. In the waveform screen shot you can seethe first two patterns are from GEN_0, with a deadband on the rising and falling edge to make sure they are never both high. I need the inverse of these signals on the other side of the H-Bridge, but if I invert them the deadband follows (second two signals from GEN_1). As you can see, this would be bad because now I will have both FETs turned on on this side of the bridge. My question is, how can I set the deadband individually and keep my inversion? Is this even possible? I may have to switch my hardware lines or do something of that nature so I am looking for any suggestions. Thank you.
Code that controls the PWMs:
//Configure PWM Clock to match system clock
SysCtlPWMClockSet(SYSCTL_PWMDIV_1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
//Configure PF0, PF1, PF2, PF3 Pins as PWM
GPIOPinConfigure(GPIO_PF0_M0PWM0);
GPIOPinConfigure(GPIO_PF1_M0PWM1);
GPIOPinConfigure(GPIO_PF2_M0PWM2);
GPIOPinConfigure(GPIO_PF3_M0PWM3);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
//Configure PWM Options
PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);
PWMGenConfigure(PWM0_BASE, PWM_GEN_1, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);
// make sure pins are not inverted
PWMOutputInvert(PWM0_BASE, PWM_OUT_2_BIT, FALSE);
PWMOutputInvert(PWM0_BASE, PWM_OUT_3_BIT, FALSE);
// Turn off the Output pins
PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, FALSE);
PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT, FALSE);
PWMOutputState(PWM0_BASE, PWM_OUT_2_BIT, FALSE);
PWMOutputState(PWM0_BASE, PWM_OUT_3_BIT, FALSE);
// Disable the PWM generator
PWMGenDisable(PWM0_BASE, PWM_GEN_0);
PWMGenDisable(PWM0_BASE, PWM_GEN_1);
//Set the Period (expressed in clock ticks)
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, PULSE_TICKS);
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_1, PULSE_TICKS);
// Enable the dead-band generation on the PWM0 output signal.
PWMDeadBandEnable(PWM0_BASE, PWM_GEN_0, DB_RISING, DB_FALLING);
PWMDeadBandEnable(PWM0_BASE, PWM_GEN_1, DB_RISING, DB_FALLING);
// Invert the GEN_1 PWMs
PWMOutputInvert(PWM0_BASE, PWM_OUT_2_BIT, TRUE);
PWMOutputInvert(PWM0_BASE, PWM_OUT_3_BIT, TRUE);
// Turn on the Output pins
PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, TRUE);
PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT, TRUE);
PWMOutputState(PWM0_BASE, PWM_OUT_2_BIT, TRUE);
PWMOutputState(PWM0_BASE, PWM_OUT_3_BIT, TRUE);
// Enable the PWM generator
PWMGenEnable(PWM0_BASE, PWM_GEN_0);
PWMGenEnable(PWM0_BASE, PWM_GEN_1);
// Enables 15v regulator for H-Bridge
//GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_PIN_4);
// Set pulse width, 50% duty-cycle for now
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, PULSE_TICKS / 2);
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_2, PULSE_TICKS / 2);