Hi,
i'm trying to use the PWM to change the LEDs (PF1 PF2 PF3) brightness can you help me out?
SYSCTL->RCGC0 |= (1U << 20); /* enable clock for PWM */
SYSCTL->RCGCPWM |= (1U << 1); // for PWM MODULE 1
SYSCTL->RCGC2 |= (1U << 5); /* enable clock for GPIOF */
GPIOF->AFSEL |=(1U << 1 ) | (1U << 2) | (1U << 3); /* Set the GPIO AFSEL bits PF1 PF2 & PF3 */
GPIOF->PCTL |=(5 << 4 ) | (5 << 8) | (5 << 12); /* Configure the PMCn fields in the GPIOPCTL register 5=PWM */
SYSCTL->RCC |=(1U << 20 ); /*set the RCC divider for PWM */
SYSCTL->RCC &= ~((0U << 17 ) | (0U << 18 ) | (0U << 19 ));
//Configure the PWM generator for countdown mode with immediate updates to the parameters.
PWM1->_2_CTL |= (0x0000 << 0);
PWM1->_3_GENA |=(0x8C << 0);
PWM1->_2_GENB |=(0x80C << 0);
PWM1->_3_GENB |=(0x80C << 0);
//Set the period. For a 50Hz frequency
PWM1->_2_LOAD |=(0x3E7F << 0);
PWM1->_3_LOAD |=(0x3E7F << 0);
//Set the pulse width pin for a 25% duty cycle
PWM1->_2_CMPB |=(0x12B <<0);
PWM1->_3_CMPA |=(0x12B <<0);
PWM1->_3_CMPB |=(0x12B <<0);
//Start the timers in PWM generators.
PWM1->_2_CTL |=(1U << 0 );
PWM1->_3_CTL |=(1U << 0 );
//Enable PWM outputs.
PWM1->ENABLE |=(0xE << 4);
while(1){}

