Hello
Why does not the PWM output ?
thanks
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/timer.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
#include "driverlib/pwm.h"
//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif
void
ConfigureUART(void)
{
// Enable the GPIO Peripheral used by the UART.
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
// Enable UART0
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
// Configure GPIO Pins for UART mode.
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
// Use the internal 16MHz oscillator as the UART clock source.
UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
// Initialize the UART for console I/O.
UARTStdioConfig(0, 115200, 16000000);
}
void
PWM0IntHandler(void)
{
// Clear the pwm0 interrupt.
PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_ZERO);
}
int
main(void)
{
//
// Enable lazy stacking for interrupt handlers. This allows floating-point
// instructions to be used within interrupt handlers, but at the expense of
// extra stack usage.
//
ROM_FPULazyStackingEnable();
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
// Initialize the UART and write status.
ConfigureUART();
// PWM Clock set
ROM_SysCtlPWMClockSet(SYSCTL_PERIPH_PWM0);
// PWM0 Peripheral Enable
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
//PWM Corresponding GPIO Port Enable
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
//GPIO Anternate Function.
GPIOPinConfigure(GPIO_PH0_M0PWM0);
// PWM Config Set
PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC);
// Set the period
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, 400);
//Set the pulse width of PWM0 for a 25% duty cycle.
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, 100);
// Set the pulse width of PWM1 for a 75% duty cycle.1
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_1, 300);
// Start the timers in generator 0.
PWMGenEnable(PWM0_BASE, PWM_GEN_0);
// Enable the outputs.
PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT), true);
UARTprintf(" PWM Out , GPIO PH0(Gen0)_ PH1(Gen1)\n");
ROM_IntMasterEnable();
ROM_PWMIntEnable(PWM0_BASE,PWM_INT_GEN_0 );
//
// Loop forever while the timers run.
//
while(1)
{
}
}