STM32 General Purpose Timer: Understanding Input Capture IC Mode -1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey welcome back to the course and I hope you are enjoying this course and in this lecture onwards let's understand the input capture block of the timer and we are going to understand the input capture with an example believe me this is the easiest way to understand this okay otherwise if I keep explaining the theory you will get confused now the exercise is actually a frequency measurement application and here we we are going to measure the time period of a signal using a timer and that signal is a continuous square wave and that is actually applied to the timer okay so actually this works something like this we have a timer right timer and we are going to give input signal to this timer and the source for this signal is we can take from LSE that is the low crystal oscillator low frequency oscillator which is present in your board okay we actually connect LSE to the timer and then we can measure what exactly is the time period of that low frequency crystal oscillator and if we know the time period it is very easy to calculate the frequency isn't it so I will demonstrate this application with LSE and later you can also use HSI as an input signal to the timer and then you can measure the frequency and we actually know the frequencies of these clock signals isn't it so HSI is 16 megahertz and LSE is 32 point seven six eight kilo Hertz right so remember that these are not timer clock frequencies so they don't drive timer okay those are external signals okay connected to the timer in order to measure the time periods of those signals great now let's see how we can do this so now let me take you to the reference manual and let's go to the basic timers and here in the basic timer if you just browse through this okay so this is a block diagram of the basic timer you already know most of the most of the components of this block diagram and if you just observe this diagram you will find that there are no inputs to the timer isn't it so that also means that the timer lacks input capture pins so input capture pins or channel are actually used to feed external signals to the timer okay and this time on lacks input channels okay it also lacks output channels so that's why it's called as a basic timer so we cannot use basic timer for this purpose and we have to take a look into some other timers now let's go to the general purpose timers now in the general purpose timers we have timer - - time Fi and time are nine - time at 14 so you are free to use whatever timer you like so I would go for let's say timer - okay and if I just browse this document and here it is you can see that the block diagram is little complex in the general purpose timer compared to the basic timer okay but remember that general purpose timer also includes basic timer so when you see a complex block diagram in your reference manual so don't get intimidated because most of the time are you how to concentrate on only those information which you really want okay because the block diagram it's a generic block diagram for the general purpose timer and since it is having lots of feature it looks little complex so don't get intimidated and just concentrate on those things which you really want that's it okay so now here we don't care about all these details so first let's identify the basic time base unit in this general purpose timer and it is very easy to identify here it is this is actually the basic time-based generation unit right so you are you already know this prescaler counter and auto reloaded register right and now you just see at the left hand side and you can find that this timer has got four input channels so so if you ask me what exactly is a channel the channel is nothing but inputs to the timer later you have to assign a pin of the microcontroller to these channels okay so that's what we did in the case of UART also isn't it so you art has TX and rx lines okay you actually did an alternate function configuration in order to assign two pins to those purpose isn't it one is for the RX purpose and one one is for the TX box isn't it so just like that you take just some pins of the microcontroller and our GPIO of the microcontroller and do the alternate functionality configuration as the timer channels okay so that will see while we do the programming so this timer has got four input channels and you can see that those are actually connected to the input filter okay as well as edge detector blocks okay so that means the input channels are pre-processed like for the debouncing etc and after that you will see a capture and compare register for each channel okay so that is one capture and compare register for every channel and that is just a register okay a register means of place holder for some value that we'll explore later and this timer also gives you four output compare channels or four output channels so regarding the output channels we need not to worry because we have separate discussion for that okay so in this case these things will not come into feature okay for our discussion it is not relevant and so we you can read it as capture register okay so when you are dealing with output compare you read this register as compare register okay so compare is for output block capture is for input block and let me now take you to my PPT and show you the simplified block diagram alright so this is a simplified block diagram so I remove all the clutter is what we saw in the previous block diagram and this is the timer with input captured block so if you just take a look here this is actually the input capture block which is just attached to the basic time base generation unit use which you saw in the previous lectures isn't it so this is extra that's it okay and here you apply your external signal to these channels and you can later measure the frequency or time period of these applied signal so how to calculate the time period what is the mechanism involved we will explore in the next lecture all right so I hope you understood this and if you have any doubts it will get cleared as you make a progress all right so I'll see in the next lecture
Info
Channel: Fastbit Embedded Brain Academy
Views: 31,903
Rating: undefined out of 5
Keywords: STM32 discovery, STM32, STM32F4xx, STM32F4, STM, ARM CORTEX M3, ARM CORTEX, ARTM CORTEX M0, ARM MICROCONTROLLER, MICROCONTROLLER COURSE, MICROCONTROLLER TUTORIAL, embedded programming, stm32 timers, TIMERS, pulse width modulation, PWM, stm32 pwm programming, stm32 timer tutorial, openstm32 system work bench, openstm32, embedded course, arm low power modes, embedded c tutorial, embedded c programming, timer input capture, timer output compare
Id: 4qjRQL6MVRo
Channel Id: undefined
Length: 8min 3sec (483 seconds)
Published: Sat Oct 13 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.