title: How to get a PWM signal on port D6 (PE_9) on a STM board?
body: <p>I'm programming a board and want a PWM signal to appear on a pin to drive a LED. I'm using a STM32 NUCLEO-F207ZG board, and only low-level register programming. It is not working. </p>
  
  <p>I've looked into the manual, datasheet and application note. Also some Google searches have been done.</p>
  
  <p>//Enable timer 1 clock:
      RCC->APB2ENR |= BIT0;</p>
  
  <pre><code>//Output mode on PWM
  TIM1-&gt;CCMR1 |= BIT5 | BIT6;
  
  //Period:
  TIM1-&gt;ARR = 0x0000FFFF;
  
  //Duty cycle:
  TIM1-&gt;CCR1 = 0x00007FFF;
  
  //Enable preload
  TIM1-&gt;CCMR1 |= BIT3;
  TIM1-&gt;CR1 |= BIT7;
  
  //Enable CC1 output
  TIM1-&gt;CCER |= BIT0;
  
  //Enable timer
  TIM1-&gt;CR1 |= BIT0;
  
  //Enable GPIOE clock
  RCC-&gt;AHB1ENR |= BIT4;
  
  //Alternate function mode voor pin PE_9
  GPIOE-&gt;MODER |= BIT19;
  GPIOE-&gt;AFR[1] |= BIT4;
  </code></pre>
  
  <p>I expect a PWM signal on pin D6 (PE_9), to drive a LED. But the LED doesn't seem to do anything.</p>