title: How to realise on a STM32F3 a PWM without CubeMX?
body: <p>first of all, thx to everyone who read this an trys to help.</p>
  
  <p>I got a little Project. A 3x3x3 LED Cupe, build with the STM32F303.
  I try to get the TIM2 to work with three channels , but .. nothing happens.</p>
  
  <p>Here's the Code:</p>
  
  <pre><code>#include "stm32f3xx.h" 
  #include "stm32f3xx_nucleo.h"
  
  int main(void){ 
  RCC-&gt;AHBENR |= RCC_AHBENR_GPIOAEN;
  RCC-&gt;APB1ENR |= RCC_APB1ENR_TIM2EN;
  
  GPIOA-&gt;MODER |= 0b10;           //PA0
  GPIOA-&gt;MODER |= 0b10 &lt;&lt; 2;      //PA1
  GPIOA-&gt;MODER |= 0b10 &lt;&lt; 4;      //PA2
  
  GPIOA-&gt;AFR[0] |= 0b0001;
  GPIOA-&gt;AFR[0] |= 0b0001 &lt;&lt; 4;
  GPIOA-&gt;AFR[0] |= 0b0001 &lt;&lt; 8;
  
  TIM2-&gt;CCMR1 = (0b0110 &lt;&lt; 4) | (0b0110 &lt;&lt; 12);
  TIM2-&gt;CCMR2 = 0b0110 &lt;&lt; 4;
  
  TIM2-&gt;CCER = TIM_CCER_CC1E;
  TIM2-&gt;CCER = TIM_CCER_CC2E;
  TIM2-&gt;CCER = TIM_CCER_CC3E;
  
  
  TIM2-&gt;PSC = 7999;
  TIM2-&gt;ARR = 999;
  
  TIM2-&gt;CCR1 = 99;
  TIM2-&gt;CCR2 = 399;
  TIM2-&gt;CCR3 = 699;
  
  TIM2-&gt;CR1 = TIM_CR1_CEN;
  
  while (1)
  {
      ;
  }
  </code></pre>
  
  <p>Any ideas?</p>