From bece446faacd59c9a48c391cb34fac76fdbabac6 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 22 Jul 2018 09:29:16 +0000 Subject: Fixed bug #967. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12186 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/ports/STM32/STM32L4xx/hal_lld.h | 34 +++++++++++++++++++++++++++++++--- readme.txt | 2 ++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/os/hal/ports/STM32/STM32L4xx/hal_lld.h b/os/hal/ports/STM32/STM32L4xx/hal_lld.h index c2a861b4c..d18ed02e2 100644 --- a/os/hal/ports/STM32/STM32L4xx/hal_lld.h +++ b/os/hal/ports/STM32/STM32L4xx/hal_lld.h @@ -488,7 +488,7 @@ #endif /** - * @brief STM32_PLLPDIV_VALUE divider value or zero if disabled. + * @brief PLLPDIV divider value or zero if disabled. * @note The allowed values are 0, 2..31. */ #if !defined(STM32_PLLPDIV_VALUE) || defined(__DOXYGEN__) @@ -584,6 +584,14 @@ #define STM32_PLLSAI1N_VALUE 80 #endif +/** + * @brief PLLSAI1PDIV divider value or zero if disabled. + * @note The allowed values are 0, 2..31. + */ +#if !defined(STM32_PLLSAI1PDIV_VALUE) || defined(__DOXYGEN__) +#define STM32_PLLSAI1PDIV_VALUE 0 +#endif + /** * @brief PLLSAI1P divider value. * @note The allowed values are 7, 17. @@ -616,6 +624,14 @@ #define STM32_PLLSAI2N_VALUE 80 #endif +/** + * @brief PLLSAI2PDIV divider value or zero if disabled. + * @note The allowed values are 0, 2..31. + */ +#if !defined(STM32_PLLSAI2PDIV_VALUE) || defined(__DOXYGEN__) +#define STM32_PLLSAI2PDIV_VALUE 0 +#endif + /** * @brief PLLSAI2P divider value. * @note The allowed values are 7, 17. @@ -914,9 +930,9 @@ #elif STM32_VOS == STM32_VOS_RANGE2 #define STM32_SYSCLK_MAX 26000000 -#define STM32_HSECLK_MAX 48000000 +#define STM32_HSECLK_MAX 26000000 #define STM32_HSECLK_BYP_MAX 26000000 -#define STM32_HSECLK_MIN 4000000 +#define STM32_HSECLK_MIN 8000000 #define STM32_HSECLK_BYP_MIN 8000000 #define STM32_LSECLK_MAX 32768 #define STM32_LSECLK_BYP_MAX 1000000 @@ -1331,7 +1347,11 @@ /** * @brief PLL P output clock frequency. */ +#if (STM32_PLLPDIV_VALUE == 0) || defined(__DOXYGEN__) #define STM32_PLL_P_CLKOUT (STM32_PLLVCO / STM32_PLLP_VALUE) +#else +#define STM32_PLL_P_CLKOUT (STM32_PLLVCO / STM32_PLLPDIV_VALUE) +#endif /** * @brief PLL Q output clock frequency. @@ -1632,7 +1652,11 @@ /** * @brief PLLSAI1-P output clock frequency. */ +#if (STM32_PLLSAI1PDIV_VALUE == 0) || defined(__DOXYGEN__) #define STM32_PLLSAI1_P_CLKOUT (STM32_PLLSAI1VCO / STM32_PLLSAI1P_VALUE) +#else +#define STM32_PLLSAI1_P_CLKOUT (STM32_PLLSAI1VCO / STM32_PLLSAI1PDIV_VALUE) +#endif /** * @brief PLLSAI1-Q output clock frequency. @@ -1778,7 +1802,11 @@ /** * @brief PLLSAI2-P output clock frequency. */ +#if (STM32_PLLSAI2PDIV_VALUE == 0) || defined(__DOXYGEN__) #define STM32_PLLSAI2_P_CLKOUT (STM32_PLLSAI2VCO / STM32_PLLSAI2P_VALUE) +#else +#define STM32_PLLSAI2_P_CLKOUT (STM32_PLLSAI2VCO / STM32_PLLSAI2PDIV_VALUE) +#endif /** * @brief PLLSAI2-R output clock frequency. diff --git a/readme.txt b/readme.txt index bc37bfaf3..d6af48955 100644 --- a/readme.txt +++ b/readme.txt @@ -141,6 +141,8 @@ - EX: Updated LIS302DL to 1.1.0 (backported to 18.2.1). - EX: Updated LPS25H to 1.1.0 (backported to 18.2.1). - EX: Updated LSM303DLHC to 1.1.0 (backported to 18.2.1). +- HAL: Fixed incorrect handling of PDIV dividers in STM32L4 HAL (bug #967) + (backported to 18.2.2). - HAL: Fixed documentation error in spiStop() (bug #966)(backported to 18.2.2 and 17.6.5). - HAL: Fixed missing parenthesis in STM32L073 registry entry (bug #965) -- cgit v1.2.3