cancel
Showing results for 
Search instead for 
Did you mean: 

External Clock for STM32F303RE Nucleo board?

David Pekin
Senior

Hello,

I'm wonder if the F303RE Nucleo board can be configured to use an external 16MHz TCXO. If so, where can I find documentation on how to configure.

Thanks in advance,

Dave

5 REPLIES 5

Hi.

Yes this Nucleo board can be configured to do this .

This board clocked by Onboard STLink.

Soldering Bridges SB50 and SB16 must be removed to cut the connection with Stlink MCO.

TCXO output must be connect to PF0 pin of the board. (RCC OSC Input)

The clock configuration will remain the same as before. {HSEBYP(HSE bypass) bit of RCC must be set to 1.}

All this information with schematic can be found here by opening DB2196 document.

Information about the input signal characteristics can found here at par. 6.3.7

MCO clock is 8 MHz​. You'd need to change PLL settings and HSE_VALUE definition to match new expectations.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

The EE tells me we've got a 20Mhz clock on the system already that we can use as the external clock. I assume that should work, with the correct PLL divisor/multiplier changes, right?

Thanks

Yes.

My recollection is the F3 isn't super flexible, compared to F2/F4/F7 but should suffice. ​

Input clock ceiling is typically 50MHz, for crystals 26MHz.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I've done some research and the F303RE should accept a 20MHz clock no problem. I've removed and added the appropriate SBs per the doc. SB50, R35 and R37 off. SB55 on.

The default SysClock_config uses the incoming Nucleo board 8M clock, divides by 2 and multiplies by 16 to yield the default 64MHz. I figured it would be simple to change that to external 20MHz div by 5 and multiply by 16 to generate the same 64MHz by the external clock.

Below is the new SysClock_Config.

It seems to be starting to work but I'm not sure what to do now. I say "starting to work" because the first thing the app does is send out a string to the serial port saying "I'm alive." This works fine w/ the default clock but with the External clock I get jibberish. I receive fewer about 15% fewer characters.

There are a number of possible problems, I guess. The clock isn't super clean. It's on a breadboard and wired to F0 with a 8" wire. It is 20M though. Anything else I'm missing or is the SysClock_config the only thing I should need to modify?

Thanks in advance,

Dave

/**

 * @brief System Clock Configuration

 *     The system Clock is configured as follow :

 *      System Clock source      = PLL (HSI)

 *      SYSCLK(Hz)           = 64000000

 *      HCLK(Hz)            = 64000000

 *      AHB Prescaler         = 1

 *      APB1 Prescaler         = 2

 *      APB2 Prescaler         = 1

 *      HSI Frequency(Hz)       = 8000000

 *      PREDIV             = RCC_PREDIV_DIV2 (2)

 *      PLLMUL             = RCC_PLL_MUL16 (16)

 *      Flash Latency(WS)       = 2

 * @param None

 * @retval None

 */

void SystemClock_Config(void)

{

  RCC_ClkInitTypeDef RCC_ClkInitStruct;

  RCC_OscInitTypeDef RCC_OscInitStruct;

  /* HSI Oscillator already ON after system reset, activate PLL with HSI as source */

  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_NONE;

  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

#if EXTERNAL_CLOCK

RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;

RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV5;  //20M div 5 = 4M

#else

  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;

  RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV2;  //8M div 2 = 4M

#endif

  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16; // 16 x 4m = 64m

  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

  if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK)

  {

    /* Initialization Error */

    while(1);

  }

  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2

    clocks dividers */

  RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);

  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;

  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2)!= HAL_OK)

  {

    /* Initialization Error */

    while(1);

  }

}