HAL #10: HowTo Timer with Interrupt

  Рет қаралды 49,684

Web learning

Web learning

Күн бұрын

Пікірлер: 70
@trungnguyen-xuan7942
@trungnguyen-xuan7942 4 жыл бұрын
This guy is a life saviour! I really appreciate the work you put into your educational videos.
@malgailany
@malgailany 5 жыл бұрын
Since this video is about learning. A proper prescaler setting should be (32000-1) and (1000-1). Reason; prescaler =0 will pass the clk without division prescaler =1 divide the clk by 2 prescaler =2 divide the clk by 3 ......... prescaler =(n-1) divide the clk by n Thanks.
@Weblearning1
@Weblearning1 5 жыл бұрын
Of course you are correct and thanks for sharing it with everyone.
@Stimmenhotel
@Stimmenhotel 3 жыл бұрын
@@Weblearning1 Don't know much about video editing on yt. But maybe you can ad this as on-screen note to the video? I have read this elsewhere too. But anyway thanks for your videos!
@Grze9898
@Grze9898 3 жыл бұрын
Great tutorial. I spent hours to figure out why my interrupt is not executed. Watching this video I found TIM was not initialized.Thank you WeB Learning!
@Weblearning1
@Weblearning1 3 жыл бұрын
You're welcome!
@nicholasng8291
@nicholasng8291 2 жыл бұрын
Same here ! was doing HAL_TIM_Base_Start(); end up realizing it should be HAL_TIM_Base_Start_IT(); after watching this video
@ryanfleming2448
@ryanfleming2448 4 жыл бұрын
This example triggered my interrupt only once. I had to also enable the automatic "auto-reload preload" setting as well. Solid tutorial, keep it up!
@Weblearning1
@Weblearning1 4 жыл бұрын
Glad it helped
@jelmervd2l
@jelmervd2l 4 жыл бұрын
Thank you so much for commenting this, i had the exact same problem!
@sokrates2099
@sokrates2099 4 жыл бұрын
I from Turkey. Thanks for your lecture. Socrates bless you.
@Weblearning1
@Weblearning1 4 жыл бұрын
Thanks.
@andrelarsen7317
@andrelarsen7317 4 жыл бұрын
Exactly what I was searching for now, Thank you!
@Weblearning1
@Weblearning1 4 жыл бұрын
You are welcome!
@ameliabuns4058
@ameliabuns4058 4 жыл бұрын
god I was searching every corner for an interrupt toggle or something! thanks xD but also thanks for making these! BUT I wish you explained every decision and thing too. this'd make it a lot more user friendly. telling people WHAT to do might get them be able to copy what you're doing but EXPLAINING what you're doing is a lot nicer. bascially a case of "give a man a fish bla bla" say for example instead of saying "set clock source to internal" explain each setting and option.
@Weblearning1
@Weblearning1 4 жыл бұрын
This is only the basic. There is SO MUCH you can do with the Timer and there are so many other video I want to make ( not enough time ) so I start with the basic and when I will get to it I will show more features.
@arielcarmeli1696
@arielcarmeli1696 3 жыл бұрын
Thanks !!!!!!!!!!!!
@abdelaleem4026
@abdelaleem4026 4 жыл бұрын
Great video! Very simple and clear-cut!
@TheKrambambuli
@TheKrambambuli 5 жыл бұрын
Thanks for making those videos!
@chandruarul7941
@chandruarul7941 5 жыл бұрын
Nice sir....Thanks for updating
@lonny_breaux
@lonny_breaux Жыл бұрын
thanks a lot of
@GrimReaper-bv4tg
@GrimReaper-bv4tg 4 ай бұрын
How do we know the LED was flashing on your board?👀
@王耀辉-t1r
@王耀辉-t1r 2 жыл бұрын
Very helpful video!!!!! Also, I have a question:why my compiler is arm-none-eabi-gcc and yours is different...
@Weblearning1
@Weblearning1 2 жыл бұрын
I used to use Keil. Now I only use CubeIDE.
@talashganvir4144
@talashganvir4144 6 ай бұрын
Could you please share the function name for the static library?
@Stimmenhotel
@Stimmenhotel 3 жыл бұрын
Also a more general comment. Since you have done timers already ... A friend of mine told me he was using a timer and the dma capability of a µc to measure the RPM of a motor. Sadly he wasn't able to tell me more about it, since he hasn't used the HAL (or maybe a complete other µc). I understand the idea of DMA, but I don't get behind the ability to measure the RPM with it. I made a code that uses a EXTI to get triggered and check the timer for the counter and potential overflow (had a counter in the overflow-callback). Using this with a normal external button it was quite blocking, since the button introduced much noise since it wasn't debounced. Do you have any idea? Edit: He said the DMA saved something (i believe it was the counter of the timer) and later he used this to calc the mean. I would also ask him for more details ... But he is still sleeping ... Thanks for your videos! Stay save!
@Weblearning1
@Weblearning1 3 жыл бұрын
The RPM sends a square wave. The higher the frequency, the higher is the RMP. So you can use the PWM from the RPM feed into the TIM. Then use the DMA to read ever 1sec the counter of the TIM and reset the TIM again. What ever you read, that's is your RPM ( depends on the signal and timing ). Search google for: stm32 measure rpm
@sabzimatic
@sabzimatic 2 жыл бұрын
if interrupt is started again while the current interrupt is going on what will happen in that case? will the code abandon current interrupt and process the new one? or will the new interrupt be put in queue?
@ronaldhofman1726
@ronaldhofman1726 5 жыл бұрын
Nice and well explained tutorial, i really like the STm32CUBEMXIDE which i use, can you make a video on the debugging capabilities ?, i just started to learm STM32 and the new cube mx ide is the IDE of my choice because everything is on package., thanx for this video on explaining timer with interupt.
@Weblearning1
@Weblearning1 5 жыл бұрын
Thanks for the idea. I will add it to the list...
@quyenoan5463
@quyenoan5463 Жыл бұрын
Hi sir, could you please suggest me how to use interrupt to reset value of encoder with user button when rotate it back to the starting point. Thank you so much
@yashkanani4858
@yashkanani4858 10 ай бұрын
why prescaler is set to 32000? should it n't be 32-1?
@PauloSantos-cv1bi
@PauloSantos-cv1bi 5 жыл бұрын
Great videos! thank you!
@Weblearning1
@Weblearning1 5 жыл бұрын
Thanks.
@nickm2517
@nickm2517 5 жыл бұрын
Awesome tutorial. How does using a timer for an interrupt differ from using a GPIO interrupt? Thanks!
@Weblearning1
@Weblearning1 5 жыл бұрын
GPIO is a physical interaction with your system, so something will happen only if you press a button. A timer will make an interrupt (or an event ) every time the counter will runout of the set value you have programmed.
@nickm2517
@nickm2517 5 жыл бұрын
@@Weblearning1 Thanks, very helpful!
@yassin5568
@yassin5568 4 жыл бұрын
Hello, thank you for you effort can you please tell me, how can i change timer period while running application STM32F4 ? thank you
@Weblearning1
@Weblearning1 4 жыл бұрын
Just change the registers while ruining your code.
@erenturk7294
@erenturk7294 3 жыл бұрын
How did you adjust the time to toggle
@Weblearning1
@Weblearning1 3 жыл бұрын
I had explained this in: kzbin.info/www/bejne/j4GtnZuPopqHbrs
@williamtaisonsarassa4761
@williamtaisonsarassa4761 5 жыл бұрын
Please, I would like to see classes on ADC, ADC + DMA
@Weblearning1
@Weblearning1 5 жыл бұрын
There is one on ADC, did you see it? I still have more videos to do, it takes time...
@williamtaisonsarassa4761
@williamtaisonsarassa4761 5 жыл бұрын
I did not find the video
@Weblearning1
@Weblearning1 5 жыл бұрын
It's not market clearly, but you will find it here: kzbin.info/www/bejne/i6vZeoubh6iNrZI
@bensvetlov7274
@bensvetlov7274 2 жыл бұрын
Has anyone ran into an issue where their timer clock frequency does not change, no matter what you change the APB bus to (using CubeMX clock configuration)? I am using a STM32H745I-DISCO board and have made sure I have included all aspects of every video I have watched on timer interrupts. Everything is working properly but no matter how I change the clock configuration, it is still the same (the values change but the LED still blinks way too fast: 240MHz even if I have the APB bus at 64MHz). Thanks in advance, I have spent a few days on and off trying to figure it out
@erenturk7294
@erenturk7294 3 жыл бұрын
Why dont u use mbed studio
@Weblearning1
@Weblearning1 3 жыл бұрын
Mbed is a way to right code in high level just like Arduino IDE that you can also use the STM32. But, you cannot debug it and the coder is much bigger. I do use sometimes MBED or Arduino, it all depends on what I want to do and how fast I want to do it. NEVER for a product. May be you can considerer subscribing to the channel?
@m.dasvirgenss
@m.dasvirgenss 5 жыл бұрын
why don't put interrupt routine on IRQHandler directly instead to "create" HAL_TIM_PeriodElapsedCallback's function??
@Weblearning1
@Weblearning1 4 жыл бұрын
I need to start explaining things slowly. There are so many things that can be done, so I take it one step at a time.
@DB--lv6tt
@DB--lv6tt 4 жыл бұрын
Thanks, helped so much. But I got a question to the interrupt handler: void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) dose not contain die Timernumber! How can I implement different interruptroutiens for ex. Timer 2 und Timer 6?? Greetings from Germany, A.
@Weblearning1
@Weblearning1 4 жыл бұрын
Its hard to tell without know more. Look in google for HAL_TIM_PeriodElapsedCallback, there are many answers on the ST community.
@DB--lv6tt
@DB--lv6tt 4 жыл бұрын
No, not hard. I've found what I was missing: void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { if(htim->Instance == TIM3){ // Do ISR for timer 3 } if(htim->Instance == TIM6){ // Do ISR for timer 6 } } The ISR in your video will be called by overflow from every timer. Thanx for answering, greetings, A
@subramaniantr2091
@subramaniantr2091 4 жыл бұрын
This will work but then the beginners will not know anything even after implementing. I suggest you use HAL functions and not cube MX. At least the function calls can be explained better and which register is set etc can be explained.
@Weblearning1
@Weblearning1 4 жыл бұрын
You are right, but some want to get it going with min. reading and searching and the CubeMX is the best way to do that.
@subramaniantr2091
@subramaniantr2091 4 жыл бұрын
@@Weblearning1 I agree. But if you could do one with the default HAL, that comes when you create a project with openSTM bench, I somehow feel is the best way to satisfy both the groups. Because I see that these CUBE HALs are quite unreadable linking to functions after functions. The default HALs directly show what registers they're programming at the same time they provide the same exact functions that we want to implement using structures. I have had my own share of tough times with no knowledge about how to go about learning. Not that I've mastered anything. But this is a time where I have learnt how to learn before which I was searching in darkness. A designer who does not know or re inventing the HALs by reading it will always be handicapped and CUBE MX supports this. It's like teaching the student 1155665 instead of do-do-sol-sol-la-la-sol in piano.He will play twinkle twinkle, but not know it. Sorry for the long comment. I just wanted to request you in short to put up tutorials with default HAL in case you have time.
@Weblearning1
@Weblearning1 4 жыл бұрын
Thanks for this. It's hard to make everyone happy when making such videos. Most of the viewers need this basic approach. You just need to look at how many are using Arduino language. Coming back to how you are doing things, I suggest that you will have a look at LL lib that is also part of the CubeMX. You will see that it's much more closer and simple to what you want. When I will finish with the HAL ( one day ) I might start with LL examples.
@fabiorodriguez8258
@fabiorodriguez8258 4 жыл бұрын
how can i change the period y need a variable period , please help
@Weblearning1
@Weblearning1 4 жыл бұрын
See again the video min. 0:40 where I explain how the calculation is done.
@faiezfatnassi818
@faiezfatnassi818 4 жыл бұрын
So in this example the LED blnks every 2 seconds right? koz after 1 second toggle will set it to on then after next second it sets it to off? Or i understand the whole thing wrong ?
@Weblearning1
@Weblearning1 4 жыл бұрын
The trigger is how you call it. So, blink every 1 sec ( i.e. 1Hz ), will cause the LED to change state every 1 sec.
@luizazeredo5197
@luizazeredo5197 4 жыл бұрын
Como se faz um calculo para a interrupção acontecer a 100uS ? Gostei do seu metodo de demostração de aula .
@Weblearning1
@Weblearning1 4 жыл бұрын
Please view the comments on the video below.
@ardaklc7617
@ardaklc7617 4 жыл бұрын
Thanks
@Weblearning1
@Weblearning1 4 жыл бұрын
Welcome
@joeyDrivez
@joeyDrivez 2 жыл бұрын
So how can I add a pushbutton so that once pressed and released the led toggles? how can I achieve that??
@Weblearning1
@Weblearning1 2 жыл бұрын
You can use this video, and turn on the LED when you press the button: kzbin.info/www/bejne/i6XOpK2ZoMqWjJo
@joeyDrivez
@joeyDrivez 2 жыл бұрын
@@Weblearning1 I meant using a timer as well, so that once the button is released the LED flashes on and off using timers.
@Weblearning1
@Weblearning1 2 жыл бұрын
In the interrupt of the button, you start the timer.
@sabzimatic
@sabzimatic 2 жыл бұрын
Please share link to your timer video that you mention at this instance.. kzbin.info/www/bejne/j4GtnZuPopqHbrs thank you
HAL #11: HowTo use the DAC
3:09
Web learning
Рет қаралды 16 М.
Tutorial on STM32 External Interrupts and callback funktions
24:31
Apple peeling hack @scottsreality
00:37
_vector_
Рет қаралды 125 МЛН
Magic or …? 😱 reveal video on profile 🫢
00:14
Andrey Grechka
Рет қаралды 81 МЛН
小丑和白天使的比试。#天使 #小丑 #超人不会飞
00:51
超人不会飞
Рет қаралды 44 МЛН
How to create delay in nano/micro seconds using timers in stm32
7:41
ControllersTech
Рет қаралды 46 М.
HAL #8: HowTo - Timer PWM
7:48
Web learning
Рет қаралды 67 М.
HAL: #6 How to - USART with DMA
6:00
Web learning
Рет қаралды 42 М.
62. STM32CubeIDE Timer Interrupt with STM32F103C8T6
7:18
MicroPeta by Nizar Mohideen
Рет қаралды 21 М.
How to Use Arduino Interrupts The Easy Way
33:28
Rachel De Barros
Рет қаралды 84 М.
Stm32 Intro To timers
24:34
Eddie Amaya
Рет қаралды 53 М.
Apple peeling hack @scottsreality
00:37
_vector_
Рет қаралды 125 МЛН