void initDiscovery(void)
{
RCC->CR &= 0xf0f0ff04; //Clear Register without changing reserved bits or Calibration
RCC->PLLCFGR &= 0xf0bc0000; //Clear Register without changing reserved bits
RCC->PLLCFGR |= 0x7402a04; // PLLQ:7, PLLSRC:HSE, PLLP:2, PLLN:168,PLLM:4
RCC->CFGR &= 0x300; //Clear Register without changing reserved bits
RCC->CFGR |= 0xc0689402; //MCO2:PLL, MCO1:PLL, RTCPRE:8, PPRE2:2, PPRE1:4, SW:PLL
RCC->CR |= 0x1010000; //PLL ON, HSE ON
while((RCC->CR & 0x2020000)==0); //Wait for HSE and PLL to stabilize
RCC->AHB1ENR &= 0x818bee00; //Clear Register without changing reserved bits
RCC->AHB1ENR |= 0x1ff; //IO port A:I clock enable
GPIOA->MODER = 0x55555555; // ALL GPO (General Purpose Output)
GPIOA->OSPEEDR = 0xaaaaaaaa; //50Mhz Speed
GPIOA->PUPDR = 0; //NO PULL UP/DOWN
GPIOB->MODER = 0x55555555; // ALL GPO (General Purpose Output)
GPIOB->OSPEEDR = 0xaaaaaaaa; //50Mhz Speed
GPIOB->PUPDR = 0; //NO PULL UP/DOWN
GPIOC->MODER = 0x55555555; // ALL GPO (General Purpose Output)
GPIOC->OSPEEDR = 0xaaaaaaaa; //50Mhz Speed
GPIOC->PUPDR = 0; //NO PULL UP/DOWN
GPIOD->MODER = 0x55555555; // ALL GPO (General Purpose Output)
GPIOD->OSPEEDR = 0xaaaaaaaa; //50Mhz Speed
GPIOD->PUPDR = 0; //NO PULL UP/DOWN
GPIOE->MODER = 0x55555555; // ALL GPO (General Purpose Output)
GPIOE->OSPEEDR = 0xaaaaaaaa; //50Mhz Speed
GPIOE->PUPDR = 0; //NO PULL UP/DOWN
GPIOF->MODER = 0x55555555; // ALL GPO (General Purpose Output)
GPIOF->OSPEEDR = 0xaaaaaaaa; //50Mhz Speed
GPIOF->PUPDR = 0; //NO PULL UP/DOWN
GPIOG->MODER = 0x55555555; // ALL GPO (General Purpose Output)
GPIOG->OSPEEDR = 0xaaaaaaaa; //50Mhz Speed
GPIOG->PUPDR = 0; //NO PULL UP/DOWN
GPIOH->MODER = 0x55555555; // ALL GPO (General Purpose Output)
GPIOH->OSPEEDR = 0xaaaaaaaa; //50Mhz Speed
GPIOH->PUPDR = 0; //NO PULL UP/DOWN
GPIOI->MODER = 0x55555555; // ALL GPO (General Purpose Output)
GPIOI->OSPEEDR = 0xaaaaaaaa; //50Mhz Speed
GPIOI->PUPDR = 0; //NO PULL UP/DOWN
}