2010-12-01 08:52 AM
set timer to pin
2011-05-17 05:17 AM
Hi rbpeter,
You have to do it by yourself. 1- Configure PC6 in output push pull 2- In the Interrupt Toggle the PC6 stateMCU Lüfter2011-05-17 05:17 AM
2011-05-17 05:17 AM
Thanks for the answer. This is what I was trying to do and it sets bits to PC6 when the timer interrupts, so:
using a 36Mhz frequency I get 550 Overflows so I see 275Hz in the oscilloscope. But changing the question: Is it possible to force the timer to use the crystal's clock (25Mhz)? Thanks2011-05-17 05:17 AM
Hi rbpeter,
I have found in the reference manual the following descrption: The counter clock can be provided by the following clock sources: �? Internal clock (CK_INT) --> The system clock �? External clock mode1: external input pin (TIx) --> Timer channels (CH1, CH2, ...) �? External clock mode2: external trigger input (ETR) --> TIMx_ETR �? Internal trigger inputs (ITRx): using one timer as prescaler for another timer So I think it is not possible to increment your timer directely by external crystal. If you provide much more details, perhaps I can find an idea. Herzlich, MCU Lüfter2011-05-17 05:17 AM
For output you might want to use PWM rather that ISR and GPIO.
> Is it possible to force the timer to use the crystal's clock (25Mhz)? You should look at the clock tree. RM0008 at just over 1K pages is for your reading pleasure and general edification. Read it all - become your local expert. Xtal => PLL multiplier => PLLCLK or Xtal => PLLCLK directly then PLLCLK => AHB Prescaler (div 1..512 in powers of 2) => (next line) AHB Prescaler => APB1 Prescaler (div 1..16) => (@36MHz max) APB1 APB1 Prescaler => *1 or *2 => timers 2..7 AHB Prescaler => APB2 Prescaler => *1 or *2 => timers 1 & 8 $1 8-bit microcontrollers have clock options. STM32 has more options.2011-05-17 05:17 AM
The timer clocks can be anything you want to set the system too. You can use the prescaler to get counts to fit in the 16-bit counter. You can program the timers to output frequency to a pin directly, and you can control the frequency and duty cycle (pulse width).
With a PLL clock of 72 MHz, you can get timers on both the APB1 and APB2 running at that speed given they way the timer clocks are gated, compared to the main peripheral clocks. Not sure why 25 MHz from the oscillator is particularly desirable for you, perhaps you can provide some more specifics.