We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi All, Due to CPU package change, I tried to change the CPU from Keil project configuration. But the new project does not work. So when I check the problem part, it is SystemClock_Config() where I am configuring the sysclk. I want to achieve 200mhz system clock. To be more clear, it is a STM32f769NI based project which is not working while stm32f769BI based project is working without any issue. I have not changed anything but only the CPU. I have verified with two of my new hardware's. Unfortunately I do not have any evaluation board to verify this.
To make it simpler, I copied RTX blink example program with 25MHZ clock. Since my hardware is 8mhz, I just reconfigured those clock portion such as OS_CLOCK = 200mhz, Xtal = 8mhz, HSE_VALUE = 8mhz.
When I tried to configure the CCR to achieve HCLK = 200MHZ, It always goes to Hardfault_handler or Can not stop debugger state whether the clock source is HSI or HSE. Using MCO2 on PC9 pin, I am able to see the PLLCLK is generating 200MHZ when it does not completely dead. with the AHB prescaller is set to 1, HCLK is supposed to be same as PLLCLK.
I compared the working board CPU RCC registers and not working board CPU RCC registers. It is more or less same(Same in the necessary section).
Just to try, I reduced the clock to 150MHZ by changing the PLLM and PLLN, I am able to see the LED blinking. And I am able to see the LED blinking when I comment out the OS functions or use MicroLIB with RTX with 200mhz sysclk.
When I tried to trace the hardfault source, it is showing different unknown address different time.
Can anyone help me understand the problem?
My SystemClock_Config code which was generated by stcube utility.
RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLM = 4; RCC_OscInitStruct.PLL.PLLN = 200; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; RCC_OscInitStruct.PLL.PLLQ = 2; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } /**Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_6) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } HAL_RCC_MCOConfig(RCC_MCO2, RCC_MCO2SOURCE_SYSCLK, RCC_MCODIV_1); /**Configure the Systick interrupt time */ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); /**Configure the Systick */ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); /* SysTick_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
I changed and tested the latency which helped the fatal error to go away. But I was getting hard fault and the reason was bus error. But I couldn't clear the bus error fault.
200mhz come from the old project so when I was importing to new CPU package, I wanted to keep the same. I checked all the peripherals can run with lower sysclk as well without any performance compensation. Since the lower clock was a working solution I went with that.