AnsweredAssumed Answered

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

Question asked by Larry Lukis on Mar 27, 2017
Latest reply on Apr 28, 2017 by Jeanne Joly

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.

Attachments

Outcomes