Output Compare not working for STM32F407 Discovery Board

Hi,

I am working on STM32F407 Discovery board. I am trying to use output compare mode in stm32 for led toggle. Here is the code I have written

#include "stm32f4xx.h" //Header File for STM32F4 device

int main(void)
{
    //
    RCC->AHB1ENR |=1;          //Enable GPIOA Port Clock    
    GPIOA->MODER|= 0X800 ;      //Configure I/O direction for PA5 as Alternatefunction   0100 0000 0000
    GPIOA->AFR[0]|=0X00100000;
    RCC->APB1ENR|=1;
    TIM2->PSC=1600-1;
    TIM2->ARR=10000-1;
    TIM2->CCMR1=0X30;
    TIM2->CCR1=0;
    TIM2->CCER|=1;
    TIM2->CNT=0;
    TIM2->CR1=1;
    
    while(1)
    {
        
        
    }
        
    return 0;    
}

But, the code is not working. Can any one help me if there is any error in this code.

More questions in this forum