Skip to main content
Zhou JianQiang
Senior
April 23, 2018
Question

Nucleo-L476 HSI configuration

  • April 23, 2018
  • 8 replies
  • 1299 views
Posted on April 23, 2018 at 07:53

I use Stm32cubemx generate code with nucleo-l476 board.it run well if i use sw4stm32, but if i compile it using Clion with gcc, it will hand in HAL_RCC_ClockConfig(). After debugging and searching, i found the reasion should be missing one line.

 origin is :

 /**Initializes the CPU, AHB and APB busses clocks 

    */

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;

  RCC_OscInitStruct.HSIState = RCC_HSI_ON;

  

RCC_OscInitStruct.HSICalibrationValue =16;

  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

  RCC_OscInitStruct.PLL.PLLN = 10;

  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;

  RCC_OscInitStruct.PLL.PLLQ =

RCC_PLLQ_DIV2

;

  

RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;

it should be :

 /**Initializes the CPU, AHB and APB busses clocks 

    */

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;

  RCC_OscInitStruct.HSIState = RCC_HSI_ON;

  

RCC_OscInitStruct.HSICalibrationValue =16;

  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

  RCC_OscInitStruct.PLL.PLLM = 1;

  RCC_OscInitStruct.PLL.PLLN =

10;

  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7;

  RCC_OscInitStruct.PLL.PLLQ =

RCC_PLLQ_DIV2

;

  

RCC_OscInitStruct.PLL.PLLR

=

RCC_PLLR_DIV2;

is it a bug? or because my poor knowledge?

    This topic has been closed for replies.

    8 replies

    Tesla DeLorean
    Guru
    April 23, 2018
    Posted on April 23, 2018 at 09:04

    It is a bug in CubeMX that has been reported/described numerous times, hopefully it will be fixed in 4.26

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Zhou JianQiang
    Senior
    April 23, 2018
    Posted on April 23, 2018 at 09:18

    but i can't find solution on google & baidu(Chinese Searching Engine), and i just start to learn STM32.

    Tesla DeLorean
    Guru
    April 23, 2018
    Posted on April 23, 2018 at 17:12

    Just paste in the missing line, as needed, or run without PLL if you're continually rebuilding with 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..
    Khouloud GARSI
    ST Employee
    April 23, 2018
    Posted on April 23, 2018 at 10:36

    Hello

    hiwszjq

    ,

    As said by Clive, this is an issue on CubeMX version 4.25: The

    PLLM parameter

    is not generated for the STM32L4 MCUs.

    This is already reported internally and will be fixed in the next releases of CubeMX.

    Sorry for any inconvenience this may have caused.

    Khouloud.

    Nawres GHARBI
    ST Technical Moderator
    April 23, 2018
    Posted on April 23, 2018 at 15:10

    Hi Zhou 

    This will be fixed next release. As a workaround, you can use the RCC LL Driver where the PLLM is well configured..

    Zhou JianQiang
    Senior
    April 23, 2018
    Posted on April 23, 2018 at 15:26

    thankyou.i will try it

    Nawres GHARBI
    ST Technical Moderator
    May 7, 2018
    Posted on May 07, 2018 at 09:58

    the 4.25.1 will be available this week fixing this issue, stay tuned 

    Khouloud GARSI
    ST Employee
    May 18, 2018