Electronic – STM32F4 Discovery Board Control Register Value Problem

stm32

In Atollic TrueSTUDIO I open an empty project without any settings.

#include "stm32f4xx.h"
#include "stm32f4_discovery.h"

int main(void)
{
  while (1)
  {

  }
}

void EVAL_AUDIO_TransferComplete_CallBack(uint32_t pBuffer, uint32_t Size){
  /* TODO, implement your code here */
  return;
}

uint16_t EVAL_AUDIO_GetSampleCallBack(void){
  /* TODO, implement your code here */
  return -1;
}

and I observe the values in the CR register.

enter image description here

As seen in the photo it comes full of many bits. Even both HSE and HSI are active. Why? How?

I was just expecting HSI to be active because the reset value of this register is 0x83.

I also cannot reset the values of the bits when I add the RCC->CR=0x83; code to the program. Where am I making a mistake? (I adding the RCC->CR=0x83; code to the top of the while.)

Why are these settings pre-defined? Why doesn't the register change when I assign a value?


STM32F407xx RCC Register from Reference Manual:

STM32F407xx RCC Register from Reference Manual

Best Answer

Main() is not where the chip boots.
Find the reset interrupt handler. In there you will find it calls SystemInit, which does some basic setup and clocks for you.