cancel
Showing results for 
Search instead for 
Did you mean: 

How many mhz oscillator can run or external clock mod 2 ?

hdemi.1
Associate III

I am using STM32F030C8T6TR.

I have a process that needs to be counted precisely, so I'm connecting a timer oven oscillator with an extenal clock mod 2. How many MHz can I use( for maximum)? I'm using an internal clock for processor, it works at maximum 48 mhz.

  TIM1->CR1 &= (uint16_t)(~(TIM_CR1_DIR | TIM_CR1_CMS | TIM_CR1_CKD));

  TIM1->ARR = 40500 - 1 ;

  TIM1->PSC = 0x0000;

  TIM1->CCMR1 &= (uint16_t)~TIM_CCMR1_IC1F;  // input filter

  TIM1->CCER = TIM_CCER_CC1P;   // positive edge

  TIM1->SMCR &= (uint16_t)~(TIM_SMCR_SMS | TIM_SMCR_TS | TIM_SMCR_ECE);

  TIM1->SMCR |= (uint16_t)(TIM_TS_TI1FP1 | TIM_SMCR_SMS); // external mode 1

The second thing I want to ask is what kind of process is it running in the background while the timer counter setting zero (TIM1->CNT = 0). To try this, I did a led turn-off operation. When I reset the timer, the time elapsed takes about 1 microsecond more than the time I did not reset it. But I need to reset it for the operation. I hope I was able to explain :))

Thanks for now

3 REPLIES 3

> with an extenal clock mod 2.

> TIM1->SMCR |= (uint16_t)(TIM_TS_TI1FP1 | TIM_SMCR_SMS); // external mode 1

So, mode 1 or mode 2?

Although in both cases, the maximum input clock frequency is internal timer clock frequency / 2:


_legacyfs_online_stmicro_images_0693W00000bjmh1QAA.png 

> I hope I was able to explain

No.

> To try this, I did a led turn-off operation.

What is that?

Why wouldn't you use the OCXO clock to run the MCU / PLL ? Should have fHSEext of 48 MHz

A slow MCU with 16-bit TIM, probably a poor choice for precision timing.

There should be an ETR connection allowing the TIM to reset against a 1PPS edge (or whatever), in HW with no SW or interrupt latency.

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

The schematic pcb is not mine and the external oscillator is not connected to the processor.