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!
@ShawnHymel3 жыл бұрын
Glad it helped!
@electronichaircut88013 жыл бұрын
Which work do you do?
@mohamedhassanin60543 жыл бұрын
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
@ksawery65683 жыл бұрын
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.
@shadowtuber15892 жыл бұрын
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-nm9ky3 жыл бұрын
I like this series, sometimes my code works but there is a better way to implement the same
@blisca2 жыл бұрын
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 Жыл бұрын
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?
@KaiseruSoze3 жыл бұрын
Nice challenge problem. Image the look on their faces when they find out the template for a ring buffer isn't in the STL.
@ShawnHymel3 жыл бұрын
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) :)
@sigusr3 жыл бұрын
Is there any reason not to use xQueueSendToBackFromISR(..) instead of a custom double buffer?
@ShawnHymel3 жыл бұрын
@@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 Жыл бұрын
thanks shawn
@gacherumburu99583 жыл бұрын
Thanks for the info..👍
@Dodek_Mardana11 ай бұрын
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?
@mimo22022 жыл бұрын
I got error with the solution simple: Average: 124Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception). any hint?
@SmokinLoken8 ай бұрын
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?
@MuhammadDaudkhanTV1003 жыл бұрын
Great
@abhinavabhi45253 жыл бұрын
In esp32 which core will execute ISR functions? Is it possible to shift the ISR to a particular Core
@ShawnHymel3 жыл бұрын
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
@abhinavabhi45253 жыл бұрын
@@ShawnHymel Thanks
@fernandoi89582 жыл бұрын
Jesus Christ this was too fast to understand it all lol
@user-tc3rh5qp3y2 жыл бұрын
see you again
@louiscelenza80172 жыл бұрын
This should be titled Timer Interrupts not Hardware Interrupts.
@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