cancel
Showing results for 
Search instead for 
Did you mean: 

Timer/PWM Question

aerospacengineer
Associate II
Posted on February 01, 2014 at 01:59

I have tried searching through the web, as well as the forum, as well as the Programming Manuals for various STM32F4 devices, but I cannot seem to get a good description of what TIM_ClockDivision in the TimeBaseStructure actually is.  In almost all the examples I see, this gets set to zero.  As I was able to read in the literature, it does seem as some sort of scalar.  I do not have hardware to play with right now, so I was hoping that someone might give me some insight, and more importantly, where I might have gone to be able to find the answer myself.  Coming over from using Microchip products, I find the STM documentation to be rather lacking.

Adam
4 REPLIES 4
os_kopernika
Associate II
Posted on February 01, 2014 at 02:28

1. Search in *tim.c peripheral lib file where this symbol is referenced.

2. The value ends in TIMx->CR1

3. Read the CR1 description in TFRM

4. rinse & repeat

Self-explanatory after running through 1315 pages of RM0090 🙂

If you want something faster, downgrade to CM0 (RM has only 700 pages).

Posted on February 01, 2014 at 02:31

TIM_ClockDivision relates to a divider of TIMCLK feed to the synchronizer/filter circuit on the timer input pins, in CH1,CH2,CH3,CH4,ETR

It would make the input less vulnerable to glitches.

See the ''Input Filter & Edge detector'' block in front the timer channels in the timer block diagram.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
aerospacengineer
Associate II
Posted on February 01, 2014 at 02:51

I did find that register you mention in the D00031020 manual (as well as the specific bits titled CKD), but when I went to look in the general purpose timer block diagram, I did not see it listed anywhere in that diagram.  Hence it was difficult to actually know what it is that it does.  The description was equally criptic in that it states:

''This bit-field indicates the division ratio between the timer clock (CK_INT) frequency and

sampling clock used by the digital filters (ETR, TIx)''. 

I now realize that I should not have given up (though at this point I had gone through four layers of code and datasheet to try and get and I admit that I got lazy).  With the reference that Clive gave, and seeing that on the block diagram it is listed as ETRP and not ETR, I think that I now understand a bit better.

So correct me if I am wrong, but here is how I understand it.  The TIM_ClockDivision is a prescalar that effects the single clock source that is coming into all the channels of that particular timer that has been selected.  It is a 2 bit timer prescaler.  Then each channel of the TIMx output has a prescaler that can be applied to it which is a 16bit prescaler.  This means that you can get essentially 18bits for prescaler. 

Thanks guys to pointing me to the 5th level of he...lp that I needed to find the information.  You guys have always been very helpful.

Adam

Posted on February 01, 2014 at 02:57

I'd think of it as a sampling clock, rather than a prescaler.

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