2022-06-10 10:54 AM
STM32CubeIDE
Version: 1.9.0
Build: 12015_20220302_0855 (UTC)
Processor: STM32H7
My issue is when i start debugging my project, it crashes while configuring my System Clock Config, but there is no real error. The debug just says "Target Lost" and tries to reconnect but cannot. It always crashes at line
MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, RCC_ClkInitStruct->SYSCLKSource);
What is interesting is it works fine on my nucleo (STM32H743) but not on my board I layed out. So that would seem to point to a hardware issue on my side, but what could that be? I tried pulling the crystal (x3) off the nucleo just to see if it would cause the same problem, it still runs (granted the application part doesnt but thats to be expected). Anyone seen this issue before?
Solved! Go to Solution.
2022-12-08 12:26 AM
Never mind. I just find out the solution from here:
https://community.st.com/s/question/0D53W00001yDuWXSA0/did-cubemx-67-break-h7-clock-configuration
2022-06-11 04:36 AM
What do you put in RCC_ClkInitStruct->SYSCLKSource ?
Which nucleoH7 ?
On my Nucleo-H743ZI the quartz X3 is not welded. It use the STLINK MCO.
HSE bypass configuration ?
Post your SystemClock_config.
2022-12-08 12:21 AM
I encounter the exact same problem right now. After I updated STM32CudeIDE to 1.11.0, it crashed in SystemClock_Config at the line where the OP indicated. My processor is STM32H755, and below is my SystemClock_Config setting.
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Supply configuration update enable
*/
HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY);
/** Configure the main internal regulator output voltage
*/
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 4;
RCC_OscInitStruct.PLL.PLLN = 60;
RCC_OscInitStruct.PLL.PLLP = 2;
RCC_OscInitStruct.PLL.PLLQ = 2;
RCC_OscInitStruct.PLL.PLLR = 2;
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_3;
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
RCC_OscInitStruct.PLL.PLLFRACN = 0;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
|RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
{
Error_Handler();
}
}
2022-12-08 12:26 AM
Never mind. I just find out the solution from here:
https://community.st.com/s/question/0D53W00001yDuWXSA0/did-cubemx-67-break-h7-clock-configuration