How to configure PWM on STM32F429I-Discovery Board
The hardware solution

Find two suitable timer output pins (check the STM32 pin description versus board functions table in the user manual of the board), and connect them with jumper wires to PG13 and PG14 on the board headers.



Then proceed to configuring the PWM outputs on the selected pins. Always set PG13 and PG14 as inputs, otherwise the MCU might be damaged.

The software solution

If your program has a functioning SysTick interrupt handler, you can toggle the pins in the handler function. If you don't want the LEDs to visibly flicker, you'd need at least 20 Hz frequency. With a SysTick frequency of 1 kHz, 51 distinct output levels are possible, 0% to 100% in 2% steps.

volatile int led1_level; // set this variable to control the duty cycle in 2% steps
void dim_leds() { // call this function from SysTick_Handler()
  static int cnt;
  cnt = (cnt + 1) % 50;
  if(cnt &lt; led1_level)
    GPIOG-&gt;BSRR = 1 &lt;&lt; 13;
  else
    GPIOG-&gt;BSRR = 1 &lt;&lt; (13 + 16);
}


Controlling PG14 is left as an exercise to the reader.