Tutorial on STM32 External Interrupts and callback funktions
HTML-код
- Опубликовано: 18 сен 2023
- In this tutorial, we're going to learn about external interrupts and callback functions on the Nucleo -G491 board. We'll cover the basics of how interrupts and callbacks work, and how to use them in your code.
This tutorial is perfect for beginners who want to learn about external interrupts and callbacks on the STM32G491 board. If you're ready to start programming on the STM32G491 board, then this tutorial is for you! Наука
Good point about keeping the code small in the callback function and showing how to do it.
Excellent Video.
Thanks You
/PR TechTalk
it is a very informative video---thanks
Glad it was helpful!
Thanks for the video , would have loved to hear your thoughts on issues to do with debouncing on this type of implementation
Hey, thanks for the comment! I'll definitely keep your suggestion in mind and make a video specifically discussing debouncing issues. Stay tuned for that!
PR TechTalk
Subscribed 👍
Welcome as Subscriber. :-)
Plz do an application with trust zone enable for stm32h5
Hi and thanks for your suggestion, TrustZone is a good suggestion so hit the subscribe button and the bell to get notified when/if I release a video on this topic.
/PR TechTalk
suscribed
Greate, Welcome
/PR TechTalk
Hi how much is the time between interrupt(falling or rising edge) and function and how we can decrease this time ?
(Doing the function immediately after interrupt without any delay)
Hi, one way to measure the time taken is to count MCU cycles, take a note on the current counter on int and then when the callback have started , then you have your time. To minimize time then one way is to maximize clock frequency. Don't forget to hit the Subscribe button :-)
/PR TechTalk
Hi Peter, many thanks for your video tutorials, I learned a lot from them! I tried to write a similar Main.c source code but accidentally added the Callback routine to the "User code begin 2" section. That way the code didn't work. I noticed my fault and moved the Callback routine to "User code begin 4". Do you have any idea why the "4" section is more proper than the "2" section? Both sections are directly in Main() and not within sub-routines. And I assume a Callback routine is called only in case of an interrupt. So I don't see why the position of the Callback routines are important. Thank you!
Hi Peter, I'm sorry, I just noticed that I'm wrong, the "User code begin 4" section is outside of Main(). I don't know what's behind this logic but I can accept it. I'm sorry for bothering you!
Hi Krisztian, greate that you found your bug on your own :-) Placing of code do have some impact.
I normally place all callbackfunctions in Section 4 and al other rutines in Section 0. But then you also need to declare prototypes for these. You can also put your code in separate .c & .h files and just include them in your main file.
Many thanks, Peter!
Nu cube ide plz
On bare metal
Thanks for your input, stay tuned it might come in the future.
Thanks but what is the role of function callback
That is up to you to decide what you want to happen. Interrupt and callback is a way to organize your software, and their are several other methods that you can use or combine. Main Loop is One, RTOS is another. all have their pros and cons. /PR TechTalk
You place the code in the wrong zone ....!
Hi Daniel; Ouups I found the error. 21:14 - 22:56. i did indeed put some code outside the "Begin" and "End" statement.
if i would go to CubeMX and make any changes all this code would be gone.
So thanks Daniel for having these Hawk Eyes. And if their are any other errors just let me know.
/Pr TechTalk