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 think I have to raise a ticket for support.
"I tried to change the CPU from Keil project configuration" (my emphasis)
Does that actually work?
What happens if you create a new project from scratch for the new part?
Also, as you're (significantly) increasing clock speed - do you also need to reconfigure waitstates, etc?
Have you checked that you're not exceeding the maximum clock of some part(s) ... ?
CPU change is quite straight forward I think. Just choose the write package and there is no much wide option to choose wrongly. I tried creating new project, referred the example programs not much difference in the output. Since I am new to RTX, I was managed to configure the OS clock input which is part of RTC configuration. As per my teammates there is not much changes required.
Stcube is an utility where I can verify my clock to all peripherals and I am warned if I am inputting any out of boundary values.
Thanks for helping me.
Try FLASH_LATENCY_7 to see if it addresses random Hard Faults Check power supply, and components/voltages on VCAP pins.
>>I think I have to raise a ticket for support.
With whom? Ultimately you are responsible for debugging your hardware and software issues.
Came back to update the hanging thread. Went with the workaround though Could not find out the root cause for main issue. Work around is to reduce the system clock from 200mhz to 168mhz and never saw the same issues again.
So did you follow the suggestions about Flash wait-states / latency?
Did you check that nothing in your system was being "over-clocked" after the speed increase?
So did you follow the suggestions about Flash wait-states / latency? Did you check that nothing in your system was being "over-clocked" after the speed increase?
Also, correct voltage regulator settings?
Did you check for any other speed-related settings?
Changing the latency converted the fatal error to hard fault and the fault report shows bus error with the address 0. I did not know from where to from here.
When I was testing the issue I had not included any peripherals in the project. It was just the OS, OSTimer, LED and UART.
So what did you change it to?
It sounds like your issue is with the configuration of the chip - so you should be asking ST (who design, make, & support the chip) rather than Keil (who just make the tools).
I changed the sysclk to 168mhz. And Microlib is enabled. This is a working combination.
"I changed the sysclk to 168mhz"
But you said you changed the Latency - that's what I was asking about.
"This is a working combination"
So why did you say initially that you needed 200 MHz ?
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.