Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 9 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @brief UTILS LL module driver. |
5 | * @brief UTILS LL module driver. |
| 6 | ****************************************************************************** |
6 | ****************************************************************************** |
| 7 | * @attention |
7 | * @attention |
| 8 | * |
8 | * |
| 9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
| - | 10 | * All rights reserved.</center></h2> |
|
| 10 | * |
11 | * |
| 11 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
| 12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
| 13 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
| 14 | * this list of conditions and the following disclaimer. |
- | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
| 16 | * this list of conditions and the following disclaimer in the documentation |
- | |
| 17 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
| 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
| 19 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
| 20 | * without specific prior written permission. |
- | |
| 21 | * |
- | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
| 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
| 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
| 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
| 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
| 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
| 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
| 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
| 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
| 32 | * |
16 | * |
| 33 | ****************************************************************************** |
17 | ****************************************************************************** |
| 34 | */ |
18 | */ |
| - | 19 | ||
| 35 | /* Includes ------------------------------------------------------------------*/ |
20 | /* Includes ------------------------------------------------------------------*/ |
| 36 | #include "stm32f1xx_ll_rcc.h" |
21 | #include "stm32f1xx_ll_rcc.h" |
| 37 | #include "stm32f1xx_ll_utils.h" |
22 | #include "stm32f1xx_ll_utils.h" |
| 38 | #include "stm32f1xx_ll_system.h" |
23 | #include "stm32f1xx_ll_system.h" |
| 39 | #ifdef USE_FULL_ASSERT |
24 | #ifdef USE_FULL_ASSERT |
| Line 67... | Line 52... | ||
| 67 | /* Defines used for FLASH latency according to HCLK Frequency */ |
52 | /* Defines used for FLASH latency according to HCLK Frequency */ |
| 68 | #if defined(FLASH_ACR_LATENCY) |
53 | #if defined(FLASH_ACR_LATENCY) |
| 69 | #define UTILS_LATENCY1_FREQ 24000000U /*!< SYSCLK frequency to set FLASH latency 1 */ |
54 | #define UTILS_LATENCY1_FREQ 24000000U /*!< SYSCLK frequency to set FLASH latency 1 */ |
| 70 | #define UTILS_LATENCY2_FREQ 48000000U /*!< SYSCLK frequency to set FLASH latency 2 */ |
55 | #define UTILS_LATENCY2_FREQ 48000000U /*!< SYSCLK frequency to set FLASH latency 2 */ |
| 71 | #else |
56 | #else |
| 72 | /*!< No Latency Configuration in this device */ |
57 | /*!< No Latency Configuration in this device */ |
| 73 | #endif |
58 | #endif |
| 74 | /** |
59 | /** |
| 75 | * @} |
60 | * @} |
| 76 | */ |
61 | */ |
| 77 | /* Private macros ------------------------------------------------------------*/ |
62 | /* Private macros ------------------------------------------------------------*/ |
| Line 153... | Line 138... | ||
| 153 | /** @defgroup UTILS_LL_Private_Functions UTILS Private functions |
138 | /** @defgroup UTILS_LL_Private_Functions UTILS Private functions |
| 154 | * @{ |
139 | * @{ |
| 155 | */ |
140 | */ |
| 156 | static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, |
141 | static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, |
| 157 | LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct); |
142 | LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct); |
| 158 | #if defined(FLASH_ACR_LATENCY) |
- | |
| 159 | static ErrorStatus UTILS_SetFlashLatency(uint32_t Frequency); |
- | |
| 160 | #endif /* FLASH_ACR_LATENCY */ |
- | |
| 161 | static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); |
143 | static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); |
| 162 | static ErrorStatus UTILS_PLL_IsBusy(void); |
144 | static ErrorStatus UTILS_PLL_IsBusy(void); |
| 163 | /** |
145 | /** |
| 164 | * @} |
146 | * @} |
| 165 | */ |
147 | */ |
| Line 260... | Line 242... | ||
| 260 | /* HCLK clock frequency */ |
242 | /* HCLK clock frequency */ |
| 261 | SystemCoreClock = HCLKFrequency; |
243 | SystemCoreClock = HCLKFrequency; |
| 262 | } |
244 | } |
| 263 | 245 | ||
| 264 | /** |
246 | /** |
| - | 247 | * @brief Update number of Flash wait states in line with new frequency and current |
|
| - | 248 | voltage range. |
|
| - | 249 | * @param Frequency SYSCLK frequency |
|
| - | 250 | * @retval An ErrorStatus enumeration value: |
|
| - | 251 | * - SUCCESS: Latency has been modified |
|
| - | 252 | * - ERROR: Latency cannot be modified |
|
| - | 253 | */ |
|
| - | 254 | #if defined(FLASH_ACR_LATENCY) |
|
| - | 255 | ErrorStatus LL_SetFlashLatency(uint32_t Frequency) |
|
| - | 256 | { |
|
| - | 257 | uint32_t timeout; |
|
| - | 258 | uint32_t getlatency; |
|
| - | 259 | uint32_t latency = LL_FLASH_LATENCY_0; /* default value 0WS */ |
|
| - | 260 | ErrorStatus status = SUCCESS; |
|
| - | 261 | ||
| - | 262 | /* Frequency cannot be equal to 0 */ |
|
| - | 263 | if (Frequency == 0U) |
|
| - | 264 | { |
|
| - | 265 | status = ERROR; |
|
| - | 266 | } |
|
| - | 267 | else |
|
| - | 268 | { |
|
| - | 269 | if (Frequency > UTILS_LATENCY2_FREQ) |
|
| - | 270 | { |
|
| - | 271 | /* 48 < SYSCLK <= 72 => 2WS (3 CPU cycles) */ |
|
| - | 272 | latency = LL_FLASH_LATENCY_2; |
|
| - | 273 | } |
|
| - | 274 | else |
|
| - | 275 | { |
|
| - | 276 | if (Frequency > UTILS_LATENCY1_FREQ) |
|
| - | 277 | { |
|
| - | 278 | /* 24 < SYSCLK <= 48 => 1WS (2 CPU cycles) */ |
|
| - | 279 | latency = LL_FLASH_LATENCY_1; |
|
| - | 280 | } |
|
| - | 281 | else |
|
| - | 282 | { |
|
| - | 283 | /* else SYSCLK < 24MHz default LL_FLASH_LATENCY_0 0WS */ |
|
| - | 284 | latency = LL_FLASH_LATENCY_0; |
|
| - | 285 | } |
|
| - | 286 | } |
|
| - | 287 | ||
| - | 288 | if (status != ERROR) |
|
| - | 289 | { |
|
| - | 290 | LL_FLASH_SetLatency(latency); |
|
| - | 291 | ||
| - | 292 | /* Check that the new number of wait states is taken into account to access the Flash |
|
| - | 293 | memory by reading the FLASH_ACR register */ |
|
| - | 294 | timeout = 2; |
|
| - | 295 | do |
|
| - | 296 | { |
|
| - | 297 | /* Wait for Flash latency to be updated */ |
|
| - | 298 | getlatency = LL_FLASH_GetLatency(); |
|
| - | 299 | timeout--; |
|
| - | 300 | } while ((getlatency != latency) && (timeout > 0)); |
|
| - | 301 | ||
| - | 302 | if(getlatency != latency) |
|
| - | 303 | { |
|
| - | 304 | status = ERROR; |
|
| - | 305 | } |
|
| - | 306 | else |
|
| - | 307 | { |
|
| - | 308 | status = SUCCESS; |
|
| - | 309 | } |
|
| - | 310 | } |
|
| - | 311 | } |
|
| - | 312 | ||
| - | 313 | return status; |
|
| - | 314 | } |
|
| - | 315 | #endif /* FLASH_ACR_LATENCY */ |
|
| - | 316 | ||
| - | 317 | /** |
|
| 265 | * @brief This function configures system clock with HSI as clock source of the PLL |
318 | * @brief This function configures system clock with HSI as clock source of the PLL |
| 266 | * @note The application need to ensure that PLL is disabled. |
319 | * @note The application need to ensure that PLL is disabled. |
| 267 | * @note Function is based on the following formula: |
320 | * @note Function is based on the following formula: |
| 268 | * - PLL output frequency = ((HSI frequency / PREDIV) * PLLMUL) |
321 | * - PLL output frequency = ((HSI frequency / PREDIV) * PLLMUL) |
| 269 | * - PREDIV: Set to 2 for few devices |
322 | * - PREDIV: Set to 2 for few devices |
| 270 | * - PLLMUL: The application software must set correctly the PLL multiplication factor to |
323 | * - PLLMUL: The application software must set correctly the PLL multiplication factor to |
| 271 | * not exceed 72MHz |
324 | * not exceed 72MHz |
| 272 | * @note FLASH latency can be modified through this function. |
325 | * @note FLASH latency can be modified through this function. |
| 273 | * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains |
326 | * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains |
| 274 | * the configuration information for the PLL. |
327 | * the configuration information for the PLL. |
| 275 | * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains |
328 | * @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains |
| 276 | * the configuration information for the BUS prescalers. |
329 | * the configuration information for the BUS prescalers. |
| 277 | * @retval An ErrorStatus enumeration value: |
330 | * @retval An ErrorStatus enumeration value: |
| Line 326... | Line 379... | ||
| 326 | * @brief This function configures system clock with HSE as clock source of the PLL |
379 | * @brief This function configures system clock with HSE as clock source of the PLL |
| 327 | * @note The application need to ensure that PLL is disabled. |
380 | * @note The application need to ensure that PLL is disabled. |
| 328 | * @note Function is based on the following formula: |
381 | * @note Function is based on the following formula: |
| 329 | * - PLL output frequency = ((HSI frequency / PREDIV) * PLLMUL) |
382 | * - PLL output frequency = ((HSI frequency / PREDIV) * PLLMUL) |
| 330 | * - PREDIV: Set to 2 for few devices |
383 | * - PREDIV: Set to 2 for few devices |
| 331 | * - PLLMUL: The application software must set correctly the PLL multiplication factor to |
384 | * - PLLMUL: The application software must set correctly the PLL multiplication factor to |
| 332 | * not exceed @ref UTILS_PLL_OUTPUT_MAX |
385 | * not exceed @ref UTILS_PLL_OUTPUT_MAX |
| 333 | * @note FLASH latency can be modified through this function. |
386 | * @note FLASH latency can be modified through this function. |
| 334 | * @param HSEFrequency Value between Min_Data = RCC_HSE_MIN and Max_Data = RCC_HSE_MAX |
387 | * @param HSEFrequency Value between Min_Data = RCC_HSE_MIN and Max_Data = RCC_HSE_MAX |
| 335 | * @param HSEBypass This parameter can be one of the following values: |
388 | * @param HSEBypass This parameter can be one of the following values: |
| 336 | * @arg @ref LL_UTILS_HSEBYPASS_ON |
389 | * @arg @ref LL_UTILS_HSEBYPASS_ON |
| 337 | * @arg @ref LL_UTILS_HSEBYPASS_OFF |
390 | * @arg @ref LL_UTILS_HSEBYPASS_OFF |
| 338 | * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains |
391 | * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains |
| Line 380... | Line 433... | ||
| 380 | { |
433 | { |
| 381 | /* Wait for HSE ready */ |
434 | /* Wait for HSE ready */ |
| 382 | } |
435 | } |
| 383 | } |
436 | } |
| 384 | 437 | ||
| 385 | /* Configure PLL */ |
438 | /* Configure PLL */ |
| 386 | LL_RCC_PLL_ConfigDomain_SYS((RCC_CFGR_PLLSRC | UTILS_PLLInitStruct->Prediv), UTILS_PLLInitStruct->PLLMul); |
439 | LL_RCC_PLL_ConfigDomain_SYS((RCC_CFGR_PLLSRC | UTILS_PLLInitStruct->Prediv), UTILS_PLLInitStruct->PLLMul); |
| 387 | 440 | ||
| 388 | /* Enable PLL and switch system clock to PLL */ |
441 | /* Enable PLL and switch system clock to PLL */ |
| 389 | status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct); |
442 | status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct); |
| 390 | } |
443 | } |
| Line 407... | Line 460... | ||
| 407 | 460 | ||
| 408 | /** @addtogroup UTILS_LL_Private_Functions |
461 | /** @addtogroup UTILS_LL_Private_Functions |
| 409 | * @{ |
462 | * @{ |
| 410 | */ |
463 | */ |
| 411 | /** |
464 | /** |
| 412 | * @brief Update number of Flash wait states in line with new frequency and current |
- | |
| 413 | voltage range. |
- | |
| 414 | * @param Frequency SYSCLK frequency |
- | |
| 415 | * @retval An ErrorStatus enumeration value: |
- | |
| 416 | * - SUCCESS: Latency has been modified |
- | |
| 417 | * - ERROR: Latency cannot be modified |
- | |
| 418 | */ |
- | |
| 419 | #if defined(FLASH_ACR_LATENCY) |
- | |
| 420 | static ErrorStatus UTILS_SetFlashLatency(uint32_t Frequency) |
- | |
| 421 | { |
- | |
| 422 | ErrorStatus status = SUCCESS; |
- | |
| 423 | - | ||
| 424 | uint32_t latency = LL_FLASH_LATENCY_0; /* default value 0WS */ |
- | |
| 425 | - | ||
| 426 | /* Frequency cannot be equal to 0 */ |
- | |
| 427 | if (Frequency == 0U) |
- | |
| 428 | { |
- | |
| 429 | status = ERROR; |
- | |
| 430 | } |
- | |
| 431 | else |
- | |
| 432 | { |
- | |
| 433 | if (Frequency > UTILS_LATENCY2_FREQ) |
- | |
| 434 | { |
- | |
| 435 | /* 48 < SYSCLK <= 72 => 2WS (3 CPU cycles) */ |
- | |
| 436 | latency = LL_FLASH_LATENCY_2; |
- | |
| 437 | } |
- | |
| 438 | else |
- | |
| 439 | { |
- | |
| 440 | if (Frequency > UTILS_LATENCY1_FREQ) |
- | |
| 441 | { |
- | |
| 442 | /* 24 < SYSCLK <= 48 => 1WS (2 CPU cycles) */ |
- | |
| 443 | latency = LL_FLASH_LATENCY_1; |
- | |
| 444 | } |
- | |
| 445 | /* else SYSCLK < 24MHz default LL_FLASH_LATENCY_0 0WS */ |
- | |
| 446 | } |
- | |
| 447 | - | ||
| 448 | LL_FLASH_SetLatency(latency); |
- | |
| 449 | - | ||
| 450 | /* Check that the new number of wait states is taken into account to access the Flash |
- | |
| 451 | memory by reading the FLASH_ACR register */ |
- | |
| 452 | if (LL_FLASH_GetLatency() != latency) |
- | |
| 453 | { |
- | |
| 454 | status = ERROR; |
- | |
| 455 | } |
- | |
| 456 | } |
- | |
| 457 | return status; |
- | |
| 458 | } |
- | |
| 459 | #endif /* FLASH_ACR_LATENCY */ |
- | |
| 460 | - | ||
| 461 | /** |
- | |
| 462 | * @brief Function to check that PLL can be modified |
465 | * @brief Function to check that PLL can be modified |
| 463 | * @param PLL_InputFrequency PLL input frequency (in Hz) |
466 | * @param PLL_InputFrequency PLL input frequency (in Hz) |
| 464 | * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains |
467 | * @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains |
| 465 | * the configuration information for the PLL. |
468 | * the configuration information for the PLL. |
| 466 | * @retval PLL output frequency (in Hz) |
469 | * @retval PLL output frequency (in Hz) |
| Line 473... | Line 476... | ||
| 473 | assert_param(IS_LL_UTILS_PLLMUL_VALUE(UTILS_PLLInitStruct->PLLMul)); |
476 | assert_param(IS_LL_UTILS_PLLMUL_VALUE(UTILS_PLLInitStruct->PLLMul)); |
| 474 | 477 | ||
| 475 | /* Check different PLL parameters according to RM */ |
478 | /* Check different PLL parameters according to RM */ |
| 476 | #if defined (RCC_CFGR2_PREDIV1) |
479 | #if defined (RCC_CFGR2_PREDIV1) |
| 477 | pllfreq = __LL_RCC_CALC_PLLCLK_FREQ(PLL_InputFrequency / (UTILS_PLLInitStruct->Prediv + 1U), UTILS_PLLInitStruct->PLLMul); |
480 | pllfreq = __LL_RCC_CALC_PLLCLK_FREQ(PLL_InputFrequency / (UTILS_PLLInitStruct->Prediv + 1U), UTILS_PLLInitStruct->PLLMul); |
| 478 | #elif defined(RCC_CFGR2_PREDIV1SRC) |
- | |
| 479 | pllfreq = __LL_RCC_CALC_PLLCLK_FREQ(PLL_InputFrequency, UTILS_PLLInitStruct->PLLMul, UTILS_PLLInitStruct->PLLDiv); |
- | |
| 480 | #else |
481 | #else |
| 481 | pllfreq = __LL_RCC_CALC_PLLCLK_FREQ(PLL_InputFrequency / ((UTILS_PLLInitStruct->Prediv >> RCC_CFGR_PLLXTPRE_Pos) + 1U), UTILS_PLLInitStruct->PLLMul); |
482 | pllfreq = __LL_RCC_CALC_PLLCLK_FREQ(PLL_InputFrequency / ((UTILS_PLLInitStruct->Prediv >> RCC_CFGR_PLLXTPRE_Pos) + 1U), UTILS_PLLInitStruct->PLLMul); |
| 482 | #endif /*RCC_CFGR2_PREDIV1SRC*/ |
483 | #endif /*RCC_CFGR2_PREDIV1SRC*/ |
| 483 | assert_param(IS_LL_UTILS_PLL_FREQUENCY(pllfreq)); |
484 | assert_param(IS_LL_UTILS_PLL_FREQUENCY(pllfreq)); |
| 484 | 485 | ||
| Line 550... | Line 551... | ||
| 550 | /* Increasing the number of wait states because of higher CPU frequency */ |
551 | /* Increasing the number of wait states because of higher CPU frequency */ |
| 551 | #if defined (FLASH_ACR_LATENCY) |
552 | #if defined (FLASH_ACR_LATENCY) |
| 552 | if (sysclk_frequency_current < SYSCLK_Frequency) |
553 | if (sysclk_frequency_current < SYSCLK_Frequency) |
| 553 | { |
554 | { |
| 554 | /* Set FLASH latency to highest latency */ |
555 | /* Set FLASH latency to highest latency */ |
| 555 | status = UTILS_SetFlashLatency(SYSCLK_Frequency); |
556 | status = LL_SetFlashLatency(SYSCLK_Frequency); |
| 556 | } |
557 | } |
| 557 | #endif /* FLASH_ACR_LATENCY */ |
558 | #endif /* FLASH_ACR_LATENCY */ |
| 558 | 559 | ||
| 559 | /* Update system clock configuration */ |
560 | /* Update system clock configuration */ |
| 560 | if (status == SUCCESS) |
561 | if (status == SUCCESS) |
| 561 | { |
562 | { |
| 562 | #if defined(RCC_PLL2_SUPPORT) |
563 | #if defined(RCC_PLL2_SUPPORT) |
| 563 | /* Enable PLL2 */ |
- | |
| 564 | LL_RCC_PLL2_Enable(); |
- | |
| 565 | while (LL_RCC_PLL2_IsReady() != 1U) |
564 | if (LL_RCC_PLL_GetMainSource() != LL_RCC_PLLSOURCE_HSI_DIV_2) |
| 566 | { |
565 | { |
| - | 566 | /* Enable PLL2 */ |
|
| - | 567 | LL_RCC_PLL2_Enable(); |
|
| - | 568 | while (LL_RCC_PLL2_IsReady() != 1U) |
|
| - | 569 | { |
|
| 567 | /* Wait for PLL2 ready */ |
570 | /* Wait for PLL2 ready */ |
| - | 571 | } |
|
| 568 | } |
572 | } |
| 569 | - | ||
| 570 | #endif /* RCC_PLL2_SUPPORT */ |
573 | #endif /* RCC_PLL2_SUPPORT */ |
| 571 | /* Enable PLL */ |
574 | /* Enable PLL */ |
| 572 | LL_RCC_PLL_Enable(); |
575 | LL_RCC_PLL_Enable(); |
| 573 | while (LL_RCC_PLL_IsReady() != 1U) |
576 | while (LL_RCC_PLL_IsReady() != 1U) |
| 574 | { |
577 | { |
| Line 591... | Line 594... | ||
| 591 | /* Decreasing the number of wait states because of lower CPU frequency */ |
594 | /* Decreasing the number of wait states because of lower CPU frequency */ |
| 592 | #if defined (FLASH_ACR_LATENCY) |
595 | #if defined (FLASH_ACR_LATENCY) |
| 593 | if (sysclk_frequency_current > SYSCLK_Frequency) |
596 | if (sysclk_frequency_current > SYSCLK_Frequency) |
| 594 | { |
597 | { |
| 595 | /* Set FLASH latency to lowest latency */ |
598 | /* Set FLASH latency to lowest latency */ |
| 596 | status = UTILS_SetFlashLatency(SYSCLK_Frequency); |
599 | status = LL_SetFlashLatency(SYSCLK_Frequency); |
| 597 | } |
600 | } |
| 598 | #endif /* FLASH_ACR_LATENCY */ |
601 | #endif /* FLASH_ACR_LATENCY */ |
| 599 | 602 | ||
| 600 | /* Update SystemCoreClock variable */ |
603 | /* Update SystemCoreClock variable */ |
| 601 | if (status == SUCCESS) |
604 | if (status == SUCCESS) |