cancel
Showing results for 
Search instead for 
Did you mean: 

HSI, HSE, LSI, LSE and clock nonsense

Rami Rosenbaum (old)
Associate II
Posted on February 22, 2017 at 22:05

Hi,

I'm working on a stm32F101CBT6.

The board has a 16 MHz HSE (connected to PD0.PD1) and a 32.768 KHz LSE (connected to PC14/PC15).

The board will use SPI1, SPI2, USART1, USART2, I2C1 and a few GPIOs.

I've worked with ST microcontrollers before, but never had to configure the clocks, so I'll be probably asking some naive questions, please be gentle... I do know that external oscillators are much more precise than the internal ones.

When creating a new project with CubeMX, it defaults to HSI and LSI.

If I enable MCO (PA8) and listen with an analyzer - I get 8 MHz. That seems correct.

1. If I configure the clock configuration, via CubeMX, to use HSE with 16 MHz (the board schema says 16 MHz) - I see on MCO 16.67 MHz. Is that correct?

2. What is the logic, the aim of playing with the PLL, and - should I use it?

My common sense says I should aim for the highest frequency in the SYSCLK and the buses.

I've attached my CubeMX project file, if it helps.

Thanks

#hse-hsi-pll-rcc
11 REPLIES 11
Posted on February 23, 2017 at 13:30

Read out the time between first and say 100th leading edge.

JW

Posted on February 24, 2017 at 00:42

Abracom ABMM2 from 2005, looks to be 16.0 MHz, I'd use a calibrated scope. Alternately divide it down, compare count on 1 Hz RTC clocking from an external 32.768 KHz source.

I've typically benched STM32F4 using a 32-bit counter, and a 1PPS signal on a channel to do capture-compare.

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