I have hardware PWM working but I can't get it to appear on any pins other than the three that drive the LEDs. Is my code wrong?
In this case I'm looking for a PWM signal on PF0 and PA6 but not finding it.
/*################################################ # Hardware PWM proof of concept using # the Tiva C Launchpad # # Started with example code by # lawrence_jeff found here: # http://forum.stellarisiti.com/topic/707-using-hardware-pwm-on-tiva-launchpad/ # # Altered to use code found on section # 22.3 of the TivaWare Peripheral Driver # Library User's Guide found here: # http://www.ti.com/lit/ug/spmu298a/spmu298a.pdf # # # This example pulses three on-board LEDs # #################################################*/ #include "driverlib/pin_map.h" #include <stdint.h> #include <stdbool.h> #include "inc/hw_gpio.h" #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/pin_map.h" #include "driverlib/gpio.h" #include "driverlib/pwm.h" void delayMS(int ms) { SysCtlDelay( (SysCtlClockGet()/(3*1000))*ms ) ; } 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_64); // Enable the peripherals used by this program. SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1); //The Tiva Launchpad has two modules (0 and 1). Module 1 covers the LED pins //Configure PF1,PF2,PF3 Pins as PWM GPIOPinConfigure(GPIO_PA6_M1PWM2); GPIOPinConfigure(GPIO_PF0_M1PWM4); GPIOPinConfigure(GPIO_PF1_M1PWM5); GPIOPinConfigure(GPIO_PF2_M1PWM6); GPIOPinConfigure(GPIO_PF3_M1PWM7); GPIOPinTypePWM(GPIO_PORTA_BASE, GPIO_PIN_6); GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3); //Configure PWM Options //PWM_GEN_2 Covers M1PWM4 and M1PWM5 //PWM_GEN_3 Covers M1PWM6 and M1PWM7 See page 207 4/11/13 DriverLib doc PWMGenConfigure(PWM1_BASE, PWM_GEN_1, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenConfigure(PWM1_BASE, PWM_GEN_2, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenConfigure(PWM1_BASE, PWM_GEN_3, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC); unsigned long period = 5000; unsigned long pwmNow = period/10; //Set the Period (expressed in clock ticks) PWMGenPeriodSet(PWM1_BASE, PWM_GEN_1, period); PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, period); PWMGenPeriodSet(PWM1_BASE, PWM_GEN_3, period); //Set PWM duty-50% (Period /2) PWMPulseWidthSet(PWM1_BASE, PWM_OUT_1,pwmNow); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_4,pwmNow); //90 degrees PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5,pwmNow); //90 degrees PWMPulseWidthSet(PWM1_BASE, PWM_OUT_6,pwmNow); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_7,pwmNow); // Enable the PWM generator PWMGenEnable(PWM1_BASE, PWM_GEN_1); PWMGenEnable(PWM1_BASE, PWM_GEN_2); PWMGenEnable(PWM1_BASE, PWM_GEN_3); // Turn on the Output pins PWMOutputState(PWM1_BASE, PWM_OUT_2_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT | PWM_OUT_6_BIT | PWM_OUT_7_BIT, true); //Fade bool fadeUp = true; unsigned long increment = 10; while(1) { /* delayMS(2000); pwmNow = period/20; PWMPulseWidthSet(PWM1_BASE, PWM_OUT_4,pwmNow); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5,pwmNow); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_6,pwmNow); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_7,pwmNow); delayMS(2000); pwmNow = period/10; PWMPulseWidthSet(PWM1_BASE, PWM_OUT_4,pwmNow); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5,pwmNow); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_6,pwmNow); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_7,pwmNow); */ } }