Hi,
I am having an issue with inverting one of the PWM. I used a scope to look at my outputs they are both the exact same, while I was attempting to have them be inverts of one another. Any ideas as what could be causing this issue?
//Check mode and set frequency accordingly
// if (operatingMode == 0) //Legacy
// {
Ticks = 2000; //4000; //30KHz
//}
//else if (operatingMode == 1) //Smart
//{
// Ticks = Number_Ticks_Freq();
//}
//
// Enable the GPIO Peripheral used by PWM (PF0, PF1)
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
//
// Enable PWM0
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF)){};
//
//Dividing the clock for PWM use - Will use one for now
//
SysCtlPWMClockSet(SYSCTL_PWMDIV_1);
//
//Unlocking the pins
//
HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
HWREG(GPIO_PORTF_BASE + GPIO_O_CR) = 0x01;
//
// Configure GPIO pin for PWM
//
GPIOPinConfigure(GPIO_PF0_M0PWM0);
GPIOPinConfigure(GPIO_PF1_M0PWM1);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Configure PWM
//
PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);
//
//Setting PWM Period
//
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, Ticks);
//
//Setting duty cycle
//
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0 , ceil(Ticks/2)); //50% duty cycle
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_1 , ceil(Ticks/2)); //50% duty cycle
//
// Enable PWM
//
PWMGenEnable(PWM0_BASE, PWM_GEN_0);
PWMOutputInvert(PWM0_BASE, PWM_OUT_1_BIT, true);
PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT, true);