STM32F401CCU6 Crashes in empty while loop.
Hello
I am testing new MCU's. I have a ST-Link V2 and using a STM32F401CCU6.
At the start I had a simple LED flasher application however after I could not run it I started stripping everything out.
This is when I saw that I can actually not even run an empty while loop.
I have a very basic Clock setup that is suppose to be 84MHz. HOWEVER I had several Clock setup functions before and all of them end the same way ending in the while() loop.
This is for me to learn how STM works under the hood so I am not using the HAL. Also this error will also shine some lite on other matters of the STM MCU.
Below I attached some pictures of the steps it takes while crashing.
void SystemInitTrial(void){
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
RCC->CR |= RCC_CR_HSITRIM_4;
RCC->CR |= RCC_CR_HSION;
while (!(RCC->CR & RCC_CR_HSIRDY));
RCC->PLLCFGR |= RCC_PLLCFGR_PLLM_3;
RCC->PLLCFGR |= RCC_PLLCFGR_PLLN_2 | RCC_PLLCFGR_PLLN_4 | RCC_PLLCFGR_PLLN_6;
RCC->PLLCFGR |= RCC_PLLCFGR_PLLQ_2;
RCC->CR |= RCC_CR_PLLON;
while (!(RCC->CR & RCC_CR_PLLRDY));
RCC->CFGR |= RCC_CFGR_PPRE1_0 | RCC_CFGR_PPRE1_1 | RCC_CFGR_PPRE1_2;
RCC->CFGR |= RCC_CFGR_PPRE2_0 | RCC_CFGR_PPRE2_1 | RCC_CFGR_PPRE2_2;
RCC->CFGR |= RCC_CFGR_SWS_1;
while (!(RCC->CFGR & RCC_CFGR_SWS_PLL));
return;
}
int main(void)
{
SystemInitTrial();
while(1) {}
}


In the last picture it starts at the RED arrow and STEPS all the way down to line 100 Blue arrow and then jumps back up to the RED arrow after which it crashes.
Thanks
