AnsweredAssumed Answered

STM32CubeMX 4.22  SystemClock_Config Bug

Question asked by Subrat Sahu on Sep 7, 2017
Latest reply on Sep 9, 2017 by Vangelis Fortounas

I am using STM32CubeMX 4.22.0

 I am using STM32F103C8T6 chip with Keil v5 under Windows 10.

I configured only RCC to HSE  for Crystal\Ceramic Resonator and in Clock Configuration input frequency to 8 MHz and HCLK to 72MHz .I generated the code for keil, but at the function "SystemClock_Config()" the chip  falls into Error_Handler().

following code was generated:

 

void SystemClock_Config(void)
{

RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;

/**Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}

 

I debug step by step. At the point  "Error_Handler"  the program goes in to infinite loop of function "Error_Handler(char * file, int line) " I can not understand what is the problem.  I also attached the full project at the attachment.

Attachments

Outcomes