I'm trying to use PWM module to drive on board RGB LED available on EK-TM4C123GXL board.
I'm using Keil MDK v5 as my IDE.
my code for PWM initialization is given below.
-----------------------------------------------------------------------------------------------------------------------------------
#include "tm4c123gh6pm.h"
void Pwm1Init(void)
{
volatile unsigned long delay;
SYSCTL_RCC_R &= 0xFFF1FFFF; //PWM CLOCK = SYS CLOCK /2
delay = SYSCTL_RCC_R; // 3 clock cycle delay
SYSCTL_RCGC0_R = 0x00100000; // enable run mode clock to PWM module
delay = SYSCTL_RCC_R; // 3 clock cycle delay
SYSCTL_RCGC2_R = 0x00000020; // PORT F clock enable
delay = SYSCTL_RCGC0_R; // 3 clock cycle delay
GPIO_PORTF_LOCK_R = 0x4C4F434B; // unlock PortF PF0
GPIO_PORTF_CR_R = 0x000000FF; // allow changes to PF4-0
GPIO_PORTF_AMSEL_R = 0x00000000;
GPIO_PORTF_AFSEL_R = 0x000000FF; //SELECT ALT FUNCTION FOR PF1,PF2,PF3
GPIO_PORTF_PCTL_R = 0x00001110; // PWM AS ALT FUNCTION FOR PF1,PF2,PF3
PWM1_CTL_R = 0x0000000F; // ENABLE PWM MASTER CONTROL CLOCK
PWM1_3_CTL_R = 0x00000001;
PWM1_3_GENA_R = 0x0000004C;
PWM1_3_GENB_R = 0x0000040C;
PWM1_3_LOAD_R = 0x0000018F; // 25 kHz PWM SIGNAL
PWM1_3_CMPA_R = 0x0000012B; // 50% DUTY CYCLE
PWM1_3_CMPB_R = 0x00000063; // 75% DUTY CYCLE
PWM1_ENABLE_R = 0x000000FF; // ENABLE OUTPUT ON PORT F
}
---------------------------------------------------------------------------------------------------------------------------
but the PWM output is not coming.
please inform what is the correction to this code to make it functional.