2012-04-09 09:46 AM
Thanks!
EDIT: Never mind about #2. I realized after posting that I had a timer interrupt that checks for something and it disables the timer if that condition is met.2012-04-09 11:22 AM
Hate to post in my own thread but...
Even though I have an external oscillator (provided by a function generator) running the timer through TI2, I've noticed some anomalies while messing around with this setup.So I ask, is there something going on that I'm missing here?
2012-04-09 11:59 AM
Isn't there a synchronizer circuit parked on the timers input pins?
What is the TIMCLK, and the SYSCLK in this system?2012-04-09 01:06 PM
Isn't there a synchronizer circuit parked on the timers input pins?
If this is something external, then no. I just have an arbitrary function generator hooked up to GND and the input pin. I'm having an external oscillator circuit being made elsewhere, but I figured I'd use an arb to see what I can do.What is the TIMCLK, and the SYSCLK in this system? TIMCLK needs to be either 1.536MHz or 15MHz with no prescaling. SYSCLK is going to be the HSI. On my earlier thread, I was switching to the HSE as the SYSCLK as the timer was running off of it. But the clock had to be stable otherwise the timing would be thrown off and my timing requirements for this project are pretty insane.2012-04-09 02:33 PM
Well HSI is going to be pretty sloppy if you have especially tight timing requirements. Each chip is unique due to process variations, there might be some trimming, but there is no thermal characterization over temperature as far as I'm aware. An external TCXO might be a better choice.
TIMCLK is typically APB or APB * 2, so if you're using HSI probably 16 MHz, check your APB divider settings and clock tree diagram. The circuit I'm talking about is internal, probably the ''FILTER'' block in the manual, but relates to bring input signals into sync with the internal clock domains. This might impose some nyquist limits, I haven't really thought about it, but it's definitely there to protect from glitches, and enforce setup/hold constraints. From RM0038 TIM2 to TIM4 features ''Synchronization circuit to control the timer with external signals and to interconnect several timers.'' ''The delay between the rising edge on ETR and the actual clock of the counter is due to the resynchronization circuit on the ETRP signal.''2012-04-09 04:29 PM
Sorry, should explain my setup better.
I'm running a timer through an external clock (16.3.3 in RM0038 details this) directly, since waiting for HSE and switching to that takes too long. The problem is when I do this and I output the clock signal more or less directly (the ARR and CCR registers are 1), the signal is jittery and significantly delayed. I've tried both External Clock 1 (through TI2) and External Clock 2 (ETR) and I get the same thing. I don't think the external goes through the APB prescaler (figure 101 is the setup, supposedly). But what's bugging me is when I do it all from SysClock, the signal's clean.2012-04-09 04:54 PM
Fact 1 : The internal timers, registers, and other peripherals attached to the peripheral bus are synchronously clocked by the APB at some level, regardless of what you feed in externally on the inputs.
Fact 2 : Input signals are fed through a resychronizer circuit, probably three flip-flops but chat with an FAE, these will induce a phase-shift between the input clock from the outside, and the edge that clocks the timebase. Now I would imagine if you were sampling a 15.5 MHz signal at 16 MHz, one could expect it to rotate backward at 500 KHz. The actual effect will depend on the input circuit, and the assorted frequencies. It's called aliasing, and it's an effect described by Nyquist. Depending on how the frequencies ''beat'' together there will also be significant jitter as one is ''synchronized'' against the other.2012-04-09 06:04 PM
So basically at this point, using the external clock to drive a timer at 15MHz is a bad idea.
Which I'm sort of confused since I thought doing this was basically like feeding the timer some output instead of say CK_INT. Unless that edge detector is doing sampling and needs to be in compliance with the Nyquist theorem.