Library 40- Output clocks from STM32F4

STM32F4 has capability to output different clocks on specific 2 pins. You are able to output clocks in original frequency (no prescaler) and also with prescaler values 2, 3, 4 and 5.

2 pins are used to output different frequencies. They are not able to output the same clocks. You can output:

  • MCO1
    • HSI: High Speed Internal oscillator, 16MHz RC
    • HSE: High Speed External oscillator, or External User clock
    • LSE: Low speed, 32768Hz oscillator or ceramic resonator
    • PLLCLK: Output clock from PLL
      • Differ between settings for PLL
  • MCO2
    • SYSCLK: System core clock output
    • PLLI2SCLK: Accurate clock for high-quality audio performance in I2S and SAI interfaces
    • HSE: High Speed External oscillator, or External User clock
    • PLLCLK: Output clock from PLL
      • Differ between settings for PLL

Each clock can be output with no prescaler, or value between 2 – 5.

Library

Features

  • Output different system clocks from STM32F4
  • 2 output pins supported

Depedencies

  • CMSIS
    • STM32F4xx
    • STM32F4xx RCC
    • STM32F4xx GPIO
  • TM
    • TM GPIO
    • defines.h
STM32F4xx MCOx Description
PA8 MCO1 MCO1 output pin
PC9 MCO2 MCO2 output pin

Functions and enumerations

Example

Example below outputs:

  • HSI clock on pin MCO1 (PA8) with prescaler 2 = 16MHz / 2 = 8MHz
  • SYSCLK clock on pin MCO2 (PC9) with prescaler 4
    • On STM32F4-Discovery = 168MHz / 4 = 42MHz
    • On STM32F429-Discovery = 180MHz / 4 = 45MHz
    • On Nucleo F401RE = 84MHz / 4 = 21MHz

Project is available on Github, download library below.

tilz0R

Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...