Hello Team,
I'm posting on behalf of my customer. Please see below my customer's inquiry:
Hello TI,
I have been trying for a while to create a PWM code that will flash LED's. I have tried several examples online and even tried mixing and matching from the examples and following the documentation for the board. I cannot seem to get any PWM signal out. The signal is always high and does not seem to oscillate. I do not have an oscilloscope to verify, but based on the LED's I have hooked up, the lights are always on, no matter how low I set the oscillations. I am attaching the code that I have right now. I do not know if my boards' onboard oscillators are not working, or if the code is wrong.
#include <stdint.h>
#include <stdbool.h>
#include "driverlib/pwm.h"
#include "driverlib/pin_map.h"
#include "inc/hw_memmap.h"
#include "inc/hw_gpio.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "inc/hw_ints.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
void main (void){
SysCtlClockSet(SYSCTL_XTAL_25MHZ|SYSCTL_OSC_MAIN|SYSCTL_USE_PLL|SYSCTL_CFG_VCO_480);
SysCtlPWMClockSet(SYSCTL_PWMDIV_1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); //Enables GPIO Port F
// Enable PMW0
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0);
GPIOPinConfigure(GPIO_PF0_M0PWM0);
PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, 400);
// Set to 75% duty cycle
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, 300);
PWMGenEnable(PWM0_BASE, PWM_GEN_0);
PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, true);
while(1){
}
}
Regards,
Renan