Working with the EK-TM4C123GXL launch pad with CCS Version: 6.1.0.00104, I attempted to adapt the dead_band.c example (from Tivaware_C_Series-2.1.0.12573) to pins PF0/PF1. I see no output on the 'scope, so I am overlooking something, no doubt. Here is the code. Please advise.
#include "C:\ti\TivaWare_C_Series-2.1.1.71\driverlib\pin_map.h" #include <stdint.h> #include <stdbool.h> #include "C:\ti\TivaWare_C_Series-2.1.1.71\inc\hw_gpio.h" #include "C:\ti\TivaWare_C_Series-2.1.1.71\inc\hw_types.h" #include "C:\ti\TivaWare_C_Series-2.1.1.71\inc\hw_memmap.h" #include "C:\ti\TivaWare_C_Series-2.1.1.71\driverlib\sysctl.h" #include "C:\ti\TivaWare_C_Series-2.1.1.71\driverlib\gpio.h" #include "C:\ti\TivaWare_C_Series-2.1.1.71\driverlib\pwm.h" int main(void) { //Set the clock SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); //Configure PWM Clock to match system SysCtlPWMClockSet(SYSCTL_PWMDIV_1); // Enable the peripherals used by this program. SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1); //The Tiva Launchpad has two modules (0 and 1). // Unlock the Pin PF0 and Set the Commit Bit // See datasheet table 10-1 for explanation of why this pin needs unlocking HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x01; //Configure PF0 and PF1 Pins as PWM //See table 20-1 for these assignments GPIOPinConfigure(GPIO_PF0_M1PWM4); GPIOPinConfigure(GPIO_PF1_M1PWM5); GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1); //Configure PWM Options:PWM_GEN_2 Covers M1PWM4 and M1PWM5 PWMGenConfigure(PWM1_BASE, PWM_GEN_2, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); unsigned long period = 64000; //Set the Period (expressed in clock ticks) PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, period); //Set PWM duty PWMPulseWidthSet(PWM1_BASE, PWM_OUT_4, PWMGenPeriodGet(PWM1_BASE, PWM_OUT_4) / 4); PWMDeadBandEnable(PWM1_BASE, PWM_GEN_2, 160, 160); // Turn on the Output pins PWMOutputState(PWM1_BASE, PWM_OUT_4_BIT | PWM_OUT_5_BIT, true); // Enable the PWM generator PWMGenEnable(PWM1_BASE, PWM_GEN_2); while(1) { } }