No video

Introduction to RTOS Part 9 - Hardware Interrupts | Digi-Key Electronics

  Рет қаралды 67,659

DigiKey

DigiKey

Күн бұрын

Пікірлер: 28
@abhijanwasti7991
@abhijanwasti7991 3 жыл бұрын
I'm just started working with ESP32 at my new work and I cannot tell you how much this series has helped me! Thank you so much for making this available!
@ShawnHymel
@ShawnHymel 3 жыл бұрын
Glad it helped!
@electronichaircut8801
@electronichaircut8801 3 жыл бұрын
Which work do you do?
@mohamedhassanin6054
@mohamedhassanin6054 3 жыл бұрын
​0:29 external interrupts ​1:40 what happens when an interrupt is fired 2:37 demo 8:45 binary semaphore 12:06 Task notifications 12:28 Challenge
@ksawery6568
@ksawery6568 3 жыл бұрын
Thank you for another great tutorial, however, I found the explanation of critical sections confusing and needed to do more research. I feel like the subjects of ISR critical sections, mutexes and spinlocks should be separated here. In my understanding, ISR critical sections are used to disable all interrupts for a very short period of time, to prevent race conditions between tasks and ISRs. Even though we may be in an ISR in one core, a task running on another core could still access the same variable; so we should protect it further with a mutex or spinlock. Mutexes and spinlocks can be used interchangeably, however, spinlocks are used here by default to prevent wasted CPU cycles. As opposed to spinlocks, mutexes put tasks to sleep, and that uses many CPU cycles. This isn't recommended if we access variables often and for short periods of time, as is the case in ISRs, therefore spinlocks are the obvious choice in ISR critical sections. Please correct me if I'm wrong.
@shadowtuber1589
@shadowtuber1589 2 жыл бұрын
Actually, spin locks are the opposite! The spin through cycles which uses more cpu cycles, while a mutex will block and therefore not use cpu. The reson why we use spin locks is because the "cost" of a spinlock is lower if we are not waiting too long, which should be the case with an IRS critical section. If however we may need to wait a while for the resource, then spinlocks, or "busy waiting" are wasteful and a mutex is preferred
@MrKoval-nm9ky
@MrKoval-nm9ky 3 жыл бұрын
I like this series, sometimes my code works but there is a better way to implement the same
@blisca
@blisca 2 жыл бұрын
Hi,thank you for your effort to face it from the point of view of beginners, as i am. Question:about at 10:20 you perform an ADC conversion inside an ISR,in contrast with the rule of keeping every ISR very short. Was it done just for easyness of explanation?Thanks.
@MingOnUTube
@MingOnUTube Жыл бұрын
About the semaphore and the overrun flag in the challenge answer: Looks like the state is either (semaphoreTake TRUE + overrun = 0) OR (FALSE + 1), -> with (TRUE + 1) and (FALSE + 0) being unreachable. So, is the whole point of the overrun flag a signaling mechanism so that the error message "Error: Buffer overrun. Samples have been dropped." can be printed out? Suppose if we don't care about error message, -> buf_overrun is not needed in the ISR condition check "if ((idx < BUF_LEN) && (buf_overrun == 0))" -> if we use "if (idx >= BUF_LEN && xSemaphoreTakeFromISR(sem_done_reading, &task_woken) == pdTRUE)" to guard the whole buffer full section, -> so idx is not reset to 0 -> "if (idx < BUF_LEN)" always fails until semaphoreTake is successful Did I understand it correctly?
@KaiseruSoze
@KaiseruSoze 3 жыл бұрын
Nice challenge problem. Image the look on their faces when they find out the template for a ring buffer isn't in the STL.
@ShawnHymel
@ShawnHymel 3 жыл бұрын
Hehe...yup, this was a challenging one :) I figured that at this point, I’ve talked about almost all of the “tools” in FreeRTOS to make something like a multithreaded sample-and-process program. The ring or double buffer parts are missing, but I figured that there are enough examples out there on how to use/make them (and they’re not really RTOS related, anyway) :)
@sigusr
@sigusr 3 жыл бұрын
Is there any reason not to use xQueueSendToBackFromISR(..) instead of a custom double buffer?
@ShawnHymel
@ShawnHymel 3 жыл бұрын
@@sigusr For this particular example, you can probably get away with using a queue, as data is being produced and consumed relatively slowly. However, queues are slow compared to direct memory read/writes, as they have extra overhead to be thread-safe. The point of the exercise is to create an RTOS application where you need to work with data being captured from a sensor at a rapid pace (and therefore would not be able to use a queue). If you're curious, this person found that queues can be written to or read from at about 3 us per access on the ESP32: techtutorialsx.com/2017/09/16/esp32-arduino-freertos-queues-performance-test/
@zaidansari9069
@zaidansari9069 Жыл бұрын
thanks shawn
@gacherumburu9958
@gacherumburu9958 3 жыл бұрын
Thanks for the info..👍
@Dodek_Mardana
@Dodek_Mardana 11 ай бұрын
Thank you for the knowledge shared, but I have an issue. I've tried several codes, but none of them seem to work. I don't understand how to use it on STM32F4. I'm using a hardware timer from TIM1, but it's not functioning. Can someone help me with how to code on STM32 using Arduino IDE?
@mimo2202
@mimo2202 2 жыл бұрын
I got error with the solution simple: Average: 124Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception). any hint?
@SmokinLoken
@SmokinLoken 8 ай бұрын
I'm getting an error when I try to run this on my ESP32-S2-WROOM. The error I get is "abort() was called at PC 0x40027db7 on core 0" and then the ESP32 reboots and it just keeps repeating this. This makes me believe there is some sort of overflow happening (maybe with the timer_divider?). When I comment out the timerAttachInterrupt() line of code, I don't get the error. Anybody have anything they'd recommend I try?
@MuhammadDaudkhanTV100
@MuhammadDaudkhanTV100 3 жыл бұрын
Great
@abhinavabhi4525
@abhinavabhi4525 3 жыл бұрын
In esp32 which core will execute ISR functions? Is it possible to shift the ISR to a particular Core
@ShawnHymel
@ShawnHymel 3 жыл бұрын
The core in which the ISR was assigned (attached) will be the core that executes the ISR. It is not possible to move the ISR once attached to a core. This section gives more information about ISR: docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/intr_alloc.html#internal-peripheral-interrupts
@abhinavabhi4525
@abhinavabhi4525 3 жыл бұрын
@@ShawnHymel Thanks
@fernandoi8958
@fernandoi8958 2 жыл бұрын
Jesus Christ this was too fast to understand it all lol
@user-tc3rh5qp3y
@user-tc3rh5qp3y 2 жыл бұрын
see you again
@louiscelenza8017
@louiscelenza8017 2 жыл бұрын
This should be titled Timer Interrupts not Hardware Interrupts.
@eddw123
@eddw123 Жыл бұрын
I hate to be a slow listener 🤣, my old C++ professor was talking faster than this guy…C++ is an easy code but talking x2 speed , they try to give the illusions that is hard to learn it🤣.. so talking and explaining fast won’t make look smarter
@seferideveloper6933
@seferideveloper6933 Жыл бұрын
Absolutely!
@rajpatil7494
@rajpatil7494 3 ай бұрын
I suspect his prescalar got wrongly programmed :)
Top Fifteen Mistakes People Make When Designing Prototype PCBs
12:26
Cosplay Light and Sound
Рет қаралды 145 М.
My Cheetos🍕PIZZA #cooking #shorts
00:43
BANKII
Рет қаралды 26 МЛН
а ты любишь париться?
00:41
KATYA KLON LIFE
Рет қаралды 2,9 МЛН
Hardware interrupts
27:36
Ben Eater
Рет қаралды 592 М.
Cracking Enigma in 2021 - Computerphile
21:20
Computerphile
Рет қаралды 2,5 МЛН
Arduino UNO R4 Lesson13 - Hardware Interrupts | Debouncing a Button
25:11
Education is Life
Рет қаралды 1,7 М.
The "Do Anything" Chip: FPGA
15:28
Dave's Garage
Рет қаралды 169 М.
Apollo Core Rope Memory (Apollo Guidance Computer Part 30)
49:03
CuriousMarc
Рет қаралды 532 М.
I2C and SPI on a PCB Explained!
15:34
Altium Academy
Рет қаралды 144 М.
#328 ESP32 Secrets: Interrupts, and Deep-Sleep under the Hood
18:57
Andreas Spiess
Рет қаралды 175 М.