Skip to main content
eittinfo
Associate II
February 25, 2019
Solved

stm32h750 Configure the main internal regulator problem

  • February 25, 2019
  • 4 replies
  • 1307 views

hi

i have a problem

when i generate a code by cubemx v5 ,i have a problem for my stm32h7 board.

mcu wait at this line and can't init voltage regulator well, and wait on this infinity loop.

/**
 * @brief System Clock Configuration
 * @retval None
 */
void SystemClock_Config(void)
{
 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
 
 /**Configure the main internal regulator output voltage 
 */
 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
 
 while ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY) 
 {
 
 }

i use debugger and saw at this loop

while ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY) 
 {
 
 }

mcu can not run over this while code.

i check register value of this code and this result:

PWR->D3CR=0x0000C000

PWR_D3CR_VOSRDY=0x00002000

if i comment this lines my mcu continue init routine

void SystemClock_Config(void)
{
 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
 
 /**Configure the main internal regulator output voltage 
 */
 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
 
 //while ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY) 
 //{
 
 //}
 /**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 = 3;
 RCC_OscInitStruct.PLL.PLLN = 200;
 RCC_OscInitStruct.PLL.PLLP = 2;
 RCC_OscInitStruct.PLL.PLLQ = 2;
 RCC_OscInitStruct.PLL.PLLR = 2;
 RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
 RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
 RCC_OscInitStruct.PLL.PLLFRACN = 0;
 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
 {
 Error_Handler();
 }

what's problem?????

crystal osc HSE=12MHz

cubemx v5

tnx for help

This topic has been closed for replies.
Best answer by Tesla DeLorean

There are multiple questions being raised over this. I don't have an H750 to test/evaluate

static void SystemClock_Config(void)
{
 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
 HAL_StatusTypeDef ret = HAL_OK;
 
 /*!< Supply configuration update enable */
 MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN, 0);
 
 /* The voltage scaling allows optimizing the power consumption when the device is
 clocked below the maximum system frequency, to update the voltage scaling value
 regarding system frequency refer to product datasheet. */
 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
 
 while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
...

This is the code from the template

4 replies

eittinfo
eittinfoAuthor
Associate II
February 25, 2019

crystal osc HSE=12Mhz

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
February 25, 2019

There are multiple questions being raised over this. I don't have an H750 to test/evaluate

static void SystemClock_Config(void)
{
 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
 HAL_StatusTypeDef ret = HAL_OK;
 
 /*!< Supply configuration update enable */
 MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN, 0);
 
 /* The voltage scaling allows optimizing the power consumption when the device is
 clocked below the maximum system frequency, to update the voltage scaling value
 regarding system frequency refer to product datasheet. */
 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
 
 while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
...

This is the code from the template

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
eittinfo
eittinfoAuthor
Associate II
February 25, 2019

tnx clive two.zero , i test your code and work correctly ,why cubemx generate those code automatic?

i ask a question, i use cubemx_v4.27.0 for my stm32h750 board, but i have problem in

HAL_RCC_OscConfig(&RCC_OscInitStruct) 

i got fatal error on this routin

 /**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 = 3;
 RCC_OscInitStruct.PLL.PLLN = 200;
 RCC_OscInitStruct.PLL.PLLP = 2;
 RCC_OscInitStruct.PLL.PLLQ = 2;
 RCC_OscInitStruct.PLL.PLLR = 2;
 RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
 RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
 RCC_OscInitStruct.PLL.PLLFRACN = 0;
 
 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
 {
 Error_Handler();
 }

which version of cubemx before v5 is good for stm32h7 boards?

tnx clive

Tesla DeLorean
Guru
February 25, 2019

I don't use CubeMX

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..