Skip to content

Commit f36982c

Browse files
committed
TARGET_STM: STM32H7 HAL_RCC_OscConfig update in PLL configuration
port fix #5896 on STM32H7 Cube HAL ST internal ticket 42806 not yet released for STM32H7
1 parent df7431d commit f36982c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

targets/TARGET_STM/TARGET_STM32H7/device/stm32h7xx_hal_rcc.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,19 @@ __weak HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruc
803803
}
804804
else
805805
{
806-
return HAL_ERROR;
806+
/* Do not return HAL_ERROR if request repeats the current configuration */
807+
uint32_t temp1_pllckcfg = RCC->PLLCKSELR;
808+
uint32_t temp2_pllckcfg = RCC->PLL1DIVR;
809+
if(((RCC_OscInitStruct->PLL.PLLState) == RCC_PLL_OFF) ||
810+
(READ_BIT(temp1_pllckcfg, RCC_PLLCKSELR_PLLSRC) != RCC_OscInitStruct->PLL.PLLSource) ||
811+
((READ_BIT(temp1_pllckcfg, RCC_PLLCKSELR_DIVM1) >> RCC_PLLCKSELR_DIVM1_Pos) != RCC_OscInitStruct->PLL.PLLM) ||
812+
(READ_BIT(temp2_pllckcfg, RCC_PLL1DIVR_N1) != (RCC_OscInitStruct->PLL.PLLN - 1U)) ||
813+
((READ_BIT(temp2_pllckcfg, RCC_PLL1DIVR_P1) >> RCC_PLL1DIVR_P1_Pos) != (RCC_OscInitStruct->PLL.PLLP - 1U)) ||
814+
((READ_BIT(temp2_pllckcfg, RCC_PLL1DIVR_Q1) >> RCC_PLL1DIVR_Q1_Pos) != (RCC_OscInitStruct->PLL.PLLQ - 1U)) ||
815+
((READ_BIT(temp2_pllckcfg, RCC_PLL1DIVR_R1) >> RCC_PLL1DIVR_R1_Pos) != (RCC_OscInitStruct->PLL.PLLR - 1U)))
816+
{
817+
return HAL_ERROR;
818+
}
807819
}
808820
}
809821
return HAL_OK;

0 commit comments

Comments
 (0)