Skip to main content
Larry Lukis
Associate II
Mar 26, 2017 11:42 PM UTC
Solved

HSE Bypass Clock Source w/CubeMX and Nucleo 303ZE fails

Posted on March 27, 2017 at 01:42

Possible bug in CubeMX 4.20.0?

Using Nucleo 303ZE board, and Atollic 7.1.1

Build dead simple default project, except in RCC, set High Speed Clock to 'BYPASS Clock Source', and select HSE as input to PLL.

In main.c you'll have this routine:

void SystemClock_Config(void)

{

RCC_OscInitTypeDef RCC_OscInitStruct;

RCC_ClkInitTypeDef RCC_ClkInitStruct;

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

*/

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;

RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL2;

RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;

if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

{

Error_Handler();

}

,,, etc,

Results in bad return from HAL_RCC_OscConfig() and call to Error_Handler().

If you change this line:

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;

to 

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;

it runs fine.

Not sure if there is something I don't understand, or if it is possibly a bug in CubeMX. my .ioc file attached.

    This topic has been closed for replies.
    Jeanne Joly
    Jeanne JolyBest answer
    Associate
    Apr 28, 2017 7:38 AM UTC
    Posted on April 28, 2017 at 09:38

    Hi

    Lukis.Larry

    ,

    I would inform you that anew patch

    http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

    V 4.1is available to fix this issue.

    Sorry for any inconvenience this may cause you.

    BR. Eric

    2 replies

    Nesrine M_O
    Associate
    Mar 27, 2017 10:43 AM UTC
    Posted on March 27, 2017 at 12:43

    Hi

    larry.lukis

    ,

    Please note that this is a confirmed CubeMX bug whichwill be fixed in a patch to be delivered soon.

    Sorry for anyinconvenience it may bring.

    -Nesrine-

    Jeanne Joly
    Jeanne JolyBest answer
    Associate
    Apr 28, 2017 7:38 AM UTC
    Posted on April 28, 2017 at 09:38

    Hi

    Lukis.Larry

    ,

    I would inform you that anew patch

    http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-configurators-and-code-generators/stm32cubemx.html

    V 4.1is available to fix this issue.

    Sorry for any inconvenience this may cause you.

    BR. Eric