Amazon Video

Electronics Innovation new logo launch & Giveaway announcement.

“Electronics Innovation” is an electronics engineering area developed and also run by a passionate electronic devices engineer named M V Subrahmanyam. We share information, write-ups, tasks, and also circuits in various electronic devices fields such as Embedded, Internet of Things, Wireless Communication Protocols, Low Power Electronics, Analog, Digital, Audio, etc thus helping our readers with their tasks and work.

Amazon Video

Electronics Innovation new logo launch & Giveaway announcement.

“Electronics Innovation” is an electronics engineering community built and run by a passionate electronics engineer named M V Subrahmanyam. We share news, articles, projects, and circuits in various electronics fields such as Embedded, Internet of Things, Wireless Communication Protocols, Low Power Electronics, Analog, Digital, Audio, etc thus helping our readers with their projects and work.

Amazon Video

Introduction to RTOS Part 12 – Multicore Systems | Digi-Key Electronics

Running jobs in an RTOS on a multicore system can appear intimidating at. When writing programs that use even more than one core, many cpus have special architectures that you must keep in mind. We analyze the FreeRTOS port for the ESP32 (referred to as ESP-IDF) and just how to synchronize tasks on both cores.

The option to the challenge can be located right here: https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-12-multicore-systems/369936f5671d4207a2c954c0637e7d50

Code for this video clip collection (consisting of demos, services, and difficulties) can be discovered below: https://github.com/ShawnHymel/introduction-to-rtos

Configuring a multicore system can be divided right into 2 standards: crooked multiprocessing (AMP) and also symmetric multiprocessing (SMP). AMP needs a main core running an os to arrange jobs in other (second) cores. In SMP, the OS works on all cores, and also the scheduler is cost-free to draw jobs from a common listing.

ESP-IDF is the port of FreeRTOS for the ESP32, and also it sustains SMP. The ESP32 is a dual-core system (although, single-core variants exist). We look at exactly how the ESP32 design is set up and exactly how each core can access memory, resources, and also disturbs.

In ESP-IDF, we have the choice of pinning jobs to a core (to make sure that only that core may run a certain job) or setting a job to “no fondness” (to make sure that the job can run in either core). Using “no fondness” is easier to execute and also enhances CPU usage and also tons balancing without much initiative. It becomes hard to establish when specific jobs will certainly run, which makes forecasting target dates tougher. Because of this, lots of embedded developers like to pin tasks to cores, as it permits a higher degree of determinism.

We show exactly how to run tasks on either core in the ESP32 as well as established them to “no affinity.” Kernel things (e.g. semaphores, mutexes, and lines) work throughout cores with no modification, as the ESP32’s cores share memory.

Item Links:
https://www.digikey.com/en/products/detail/adafruit-industries-llc/3405/7244967

Related Videos:
Intro to RTOS Part 1 – What is a Real-Time Operating System (RTOS)? – https://youtu.be/F321087yYy4​

Intro to RTOS Part 2 – Getting Started with FreeRTOS – https://youtu.be/JIr7Xm_riRs​

Intro to RTOS Part 3 – Task Scheduling – https://youtu.be/95yUbClyf3E​

Introduction to RTOS Part 4 – Memory Management – https://youtu.be/Qske3yZRW5I​

Introduction to RTOS Part 5 – Queue – https://youtu.be/pHJ3lxOoWeI​

Introduction to RTOS Part 6 – Mutex – https://youtu.be/I55auRpbiTs​

Intro to RTOS Part 7 – https://youtu.be/5JcMtbA9QEE​

Intro to RTOS Part 8 – https://youtu.be/b1f1Iex0Tso

Introduction to RTOS Part 9 – https://youtu.be/qsflCf6ahXU

Introduction to RTOS Part 10 – https://youtu.be/hRsWi4HIENc

Introduction to RTOS Part 11 – https://youtu.be/C2xKhxROmhA

Introduction to RTOS Part 12 – https://youtu.be/LPSHUcH5aQc

Related Project Links:
https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-11-priority-inversion/abf4b8f7cd4a4c70bece35678d178321

Associated Articles:
https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-12-multicore-systems/369936f5671d4207a2c954c0637e7d50

Discover more:
Maker.io – https://www.digikey.com/en/maker

Digi-Key’s Blog– TheCircuit https://www.digikey.com/en/blog

Connect with Digi-Key on Facebook https://www.facebook.com/digikey.electronics/

As well as follow us on Twitter https://twitter.com/digikey

Amazon Video

Introduction to RTOS Part 12 – Multicore Systems | Digi-Key Electronics

Running tasks in an RTOS on a multicore system can seem daunting at first. Many processors have unique architectures that you must keep in mind when writing programs that use more than one core. We examine the FreeRTOS port for the ESP32 (known as ESP-IDF) and how to synchronize tasks on both cores.

The solution to the challenge can be found here: https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-12-multicore-systems/369936f5671d4207a2c954c0637e7d50

Code for this video series (including demonstrations, challenges, and solutions) can be found here: https://github.com/ShawnHymel/introduction-to-rtos

Programming a multicore system can be separated into two paradigms: asymmetric multiprocessing (AMP) and symmetric multiprocessing (SMP). AMP requires a primary core running an operating system to schedule tasks in other (secondary) cores. In SMP, the OS runs on all cores, and the scheduler is free to pull tasks from a shared list.

ESP-IDF is the port of FreeRTOS for the ESP32, and it supports SMP. The ESP32 is a dual-core system (although, single-core variants exist). We look at how the ESP32 architecture is configured and how each core can access memory, resources, and interrupts.

In ESP-IDF, we have the option of pinning tasks to a core (so that only that core may run a particular task) or setting a task to “no affinity” (so that the task can run in either core). Using “no affinity” is easier to implement and optimizes CPU utilization and load balancing without much effort. However, it becomes difficult to determine when certain tasks will run, which makes predicting deadlines tougher. As a result, many embedded developers prefer to pin tasks to cores, as it allows for a higher level of determinism.

We show how to run tasks on either core in the ESP32 as well as set them to “no affinity.” Kernel objects (e.g. queues, mutexes, and semaphores) work across cores without any modification, as the ESP32’s cores share memory.

Product Links:
https://www.digikey.com/en/products/detail/adafruit-industries-llc/3405/7244967

Related Videos:
Introduction to RTOS Part 1 – What is a Real-Time Operating System (RTOS)? – https://youtu.be/F321087yYy4​

Introduction to RTOS Part 2 – Getting Started with FreeRTOS – https://youtu.be/JIr7Xm_riRs​

Introduction to RTOS Part 3 – Task Scheduling – https://youtu.be/95yUbClyf3E​

Introduction to RTOS Part 4 – Memory Management – https://youtu.be/Qske3yZRW5I​

Introduction to RTOS Part 5 – Queue – https://youtu.be/pHJ3lxOoWeI​

Introduction to RTOS Part 6 – Mutex – https://youtu.be/I55auRpbiTs​

Introduction to RTOS Part 7 – https://youtu.be/5JcMtbA9QEE​

Introduction to RTOS Part 8 – https://youtu.be/b1f1Iex0Tso

Introduction to RTOS Part 9 – https://youtu.be/qsflCf6ahXU

Introduction to RTOS Part 10 – https://youtu.be/hRsWi4HIENc

Introduction to RTOS Part 11 – https://youtu.be/C2xKhxROmhA

Introduction to RTOS Part 12 – https://youtu.be/LPSHUcH5aQc

Related Project Links:
https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-11-priority-inversion/abf4b8f7cd4a4c70bece35678d178321

Related Articles:
https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-12-multicore-systems/369936f5671d4207a2c954c0637e7d50

Learn more:
Maker.io – https://www.digikey.com/en/maker

Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog

Connect with Digi-Key on Facebook https://www.facebook.com/digikey.electronics/

And follow us on Twitter https://twitter.com/digikey

Amazon Video

Introduction to RTOS Part 10 – Deadlock and Starvation | Digi-Key Electronics

Starvation and deadlock are two common bugs that can occur in concurrent programming. Starvation happens when one one or more threads do not get a chance to run or do not get access to a shared resource because other (often higher priority) threads are hogging the CPU or resource.

The code for the Dining Philosophers challenge can be found here: https://github.com/ShawnHymel/introduction-to-rtos/blob/main/10-deadlock/esp32-freertos-10-challenge-dining-philosophers/esp32-freertos-10-challenge-dining-philosophers.ino

The solution to the challenge in the video can be found here: https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-10-deadlock-and-starvation/872c6a057901432e84594d79fcb2cc5d

Code for this video series (including demonstrations, challenges, and solutions) can be found here: https://github.com/ShawnHymel/introduction-to-rtos

We can avoid starvation by ensuring that higher-priority tasks yield the processor periodically to allow lower-priority tasks a chance to run. Additionally, the higher-priority tasks should make sure to release any shared resources they might have to allow lower-priority tasks access to them.

We can also implement a technique called “aging” in a high priority task or in the scheduler itself. Aging gradually increases the priority of any task that has been in the blocked state for some period of time. Eventually, the task will reach the same priority level as the high priority tasks that are hogging the CPU/resource, and the previously low-priority task will get a chance to run. After performing its required actions, the low-priority task will have its priority downgraded to its original level to start the aging process again.

In the video, we provide the classic “Dining Philosophers” as an analogy to demonstrate starvation and deadlock. Deadlock occurs when all tasks are waiting on each other for a lock (e.g. mutex or semaphore) and no task is able to continue execution. Deadlock can result in system-wide failure and should be avoided at all costs.

We also give two possible solutions to the Dining Philosophers problem, including assigning a hierarchy to the locks as well as using a mutex to control access to the locks.

Product Links:
https://www.digikey.com/en/products/detail/adafruit-industries-llc/3405/7244967

Related Videos:
Introduction to RTOS Part 1 – What is a Real-Time Operating System (RTOS)? – https://youtu.be/F321087yYy4​

Introduction to RTOS Part 2 – Getting Started with FreeRTOS – https://youtu.be/JIr7Xm_riRs​

Introduction to RTOS Part 3 – Task Scheduling – https://youtu.be/95yUbClyf3E​

Introduction to RTOS Part 4 – Memory Management – https://youtu.be/Qske3yZRW5I​

Introduction to RTOS Part 5 – Queue – https://youtu.be/pHJ3lxOoWeI​

Introduction to RTOS Part 6 – Mutex – https://youtu.be/I55auRpbiTs​

Introduction to RTOS Part 7 – https://youtu.be/5JcMtbA9QEE​

Introduction to RTOS Part 8 – https://youtu.be/b1f1Iex0Tso

Introduction to RTOS Part 9 – https://youtu.be/qsflCf6ahXU

Introduction to RTOS Part 10 – https://youtu.be/hRsWi4HIENc

Related Project Links:
https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-10-deadlock-and-starvation/872c6a057901432e84594d79fcb2cc5d

Related Articles:
https://www.digikey.com/en/maker/videos/shawn-hymel/getting-started-with-stm32-and-nucleo-part-3-how-to-run-multiple-threads-with-cmsis-rtos-interface

Learn more:
Maker.io – https://www.digikey.com/en/maker

Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog

Connect with Digi-Key on Facebook https://www.facebook.com/digikey.electronics/

And follow us on Twitter https://twitter.com/digikey

Amazon Video

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

Equipment disrupts are necessary in several embedded systems. They permit us to reply to outside occasions (such as a button being pressed) or internal events (such as a timer ending) in an asynchronous fashion, which suggests that the cpu can stop whatever it was doing to run an interrupt solution routine (ISR).

The option to the difficulty in the video clip can be located here: https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-9-hardware-interrupts/3ae7a68462584e1eb408e1638002e9ed

Code for this video clip collection (including demos, challenges, and remedies) can be located below: https://github.com/ShawnHymel/introduction-to-rtos

In a lot of RTOSes, such as FreeRTOS, equipment disrupts happen at a higher priority than all other tasks. This indicates, unless particularly handicapped, equipment disturbs will halt the implementation of any type of currently running job. The CPU will certainly be forced to handle the interrupt before returning to the task.

A few suggestions when collaborating with interrupts:
ISRs should never obstruct, which suggests you should just use FreeRTOS kernel function calls that end in “FromISR”.
You should maintain ISRs as short as feasible to avoid postponing jobs much longer than required.
Any kind of international variables that get upgraded in an ISR must be declared with the “volatile” qualifier.

As opposed to do handling inside an ISR, you can “defer processing” by collecting information right into a buffer and letting a task do the processinging. In the video, we look at just how to complete deferred handling making use of semaphores (note that you can also make use of queues as well as task notifications).

When an ISR is done, it can set a lock (e.g. “give” a semaphore), which will certainly unblock a job. This task can then make use of any type of data accumulated by the ISR (e.g. a new ADC value, a buffer full of information from the serial port, etc.). With this method, you can maintain ISRs brief while depending on a task to perform any type of essential handling.

Item Links:.
https://www.digikey.com/en/products/d…​.

Related Videos:.
Introduction to RTOS Part 1 – What is a Real-Time Operating System (RTOS)? – https://youtu.be/F321087yYy4​.

Introduction to RTOS Part 2 – Getting Started with FreeRTOS – https://youtu.be/JIr7Xm_riRs​.

Introduction to RTOS Part 3 – Task Scheduling – https://youtu.be/95yUbClyf3E​.

Introduction to RTOS Part 4 – Memory Management – https://youtu.be/Qske3yZRW5I​.

Intro to RTOS Part 5 – Queue – https://youtu.be/pHJ3lxOoWeI​.

Intro to RTOS Part 6 – Mutex – https://youtu.be/I55auRpbiTs​.

Intro to RTOS Part 7 – https://youtu.be/5JcMtbA9QEE​.

Introduction to RTOS Part 8 – https://youtu.be/b1f1Iex0Tso.

Introduction to RTOS Part 9 – https://youtu.be/qsflCf6ahXU.

Related Project Links:.
https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-9-hardware-interrupts/3ae7a68462584e1eb408e1638002e9ed.

Related Articles:.
https://www.digikey.com/en/maker/videos/shawn-hymel/getting-started-with-stm32-and-nucleo-part-3-how-to-run-multiple-threads-with-cmsis-rtos-interface.

Discover more:.
Maker.io – https://www.digikey.com/en/maker.

Digi-Key’s Blog– TheCircuit https://www.digikey.com/en/blog.

Connect with Digi-Key on Facebook https://www.facebook.com/digikey.electronics/.

And also follow us on Twitter https://twitter.com/digikey.

Amazon Video

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

Hardware interrupts are important in many embedded systems. They allow us to respond to external events (such as a button being pressed) or internal events (such as a timer expiring) in an asynchronous manner, which means that the processor can stop whatever it was doing to run an interrupt service routine (ISR).

The solution to the challenge in the video can be found here: https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-9-hardware-interrupts/3ae7a68462584e1eb408e1638002e9ed

Code for this video series (including demonstrations, challenges, and solutions) can be found here: https://github.com/ShawnHymel/introduction-to-rtos

In most RTOSes, such as FreeRTOS, hardware interrupts occur at a higher priority than all other tasks. This means, unless specifically disabled, hardware interrupts will halt the execution of any currently running task. The CPU will be forced to handle the interrupt before returning to the task.

A few tips when working with interrupts:
ISRs should never block, which means you should only use FreeRTOS kernel function calls that end in “FromISR”
You should keep ISRs as short as possible to avoid delaying tasks longer than necessary
Any global variables that get updated in an ISR should be declared with the “volatile” qualifier

Rather than perform processing inside an ISR, you can “defer processing” by collecting data into a buffer and letting a task do the processinging. In the video, we look at how to accomplish deferred processing using semaphores (note that you can also use queues and task notifications).

When an ISR is done, it can set a lock (e.g. “give” a semaphore), which will unblock a task. This task can then use any data collected by the ISR (e.g. a new ADC value, a buffer filled with data from the serial port, etc.). With this method, you can keep ISRs short while relying on a task to perform any necessary processing.

Product Links:
https://www.digikey.com/en/products/d…​

Related Videos:
Introduction to RTOS Part 1 – What is a Real-Time Operating System (RTOS)? – https://youtu.be/F321087yYy4​

Introduction to RTOS Part 2 – Getting Started with FreeRTOS – https://youtu.be/JIr7Xm_riRs​

Introduction to RTOS Part 3 – Task Scheduling – https://youtu.be/95yUbClyf3E​

Introduction to RTOS Part 4 – Memory Management – https://youtu.be/Qske3yZRW5I​

Introduction to RTOS Part 5 – Queue – https://youtu.be/pHJ3lxOoWeI​

Introduction to RTOS Part 6 – Mutex – https://youtu.be/I55auRpbiTs​

Introduction to RTOS Part 7 – https://youtu.be/5JcMtbA9QEE​

Introduction to RTOS Part 8 – https://youtu.be/b1f1Iex0Tso

Introduction to RTOS Part 9 – https://youtu.be/qsflCf6ahXU

Related Project Links:
https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-9-hardware-interrupts/3ae7a68462584e1eb408e1638002e9ed

Related Articles:
https://www.digikey.com/en/maker/videos/shawn-hymel/getting-started-with-stm32-and-nucleo-part-3-how-to-run-multiple-threads-with-cmsis-rtos-interface

Learn more:
Maker.io – https://www.digikey.com/en/maker

Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog

Connect with Digi-Key on Facebook https://www.facebook.com/digikey.electronics/

And follow us on Twitter https://twitter.com/digikey

Amazon Video

Introduction to RTOS Part 7 – Semaphore | Digi-Key Electronics

A semaphore is a signaling device made use of to synchronise 2 or more strings. Similar to a mutex, it can be used to shield shared sources. In this video, we reveal you how to make use of semaphores with FreeRTOS on an ESP32 to pass information in between tasks.

The beginning code for the challenge can be found below: https://github.com/ShawnHymel/introduction-to-rtos/blob/main/07-semaphore/esp32-freertos-07-challenge-counting-semaphore/esp32-freertos-07-challenge-counting-semaphore.ino

The remedy to the obstacle in the video can be located here: https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-7-freertos-semaphore-example/51aa8660524c4daba38cba7c2f5baba7

Code for this video clip collection (consisting of obstacles, remedies, and demos) can be located right here: https://github.com/ShawnHymel/introduction-to-rtos

If some resource is not offered for usage, a semaphore is comparable to a mutex in that it is a locking mechanism used to tell jobs to wait. However, semaphores are a lot more than an easy lock: they can count to even more than 1 and also can therefore allow several threads to enter an important area of code.

In technique, nonetheless, we often do not wish to allow several strings adjust shared data, as well as we would still need to safeguard that data (or shared resource) with something like a mutex. We utilize semaphores as a signaling mechanism to inform various other threads when it is secure to access a resource or read brand-new data.

A barrier or linked checklist can be written to by a variety of “manufacturer” strings. Each time among these producer threads adds data to this resource, it increments a semaphore, which is just a counting variable that can be accessed atomically. When a “consumer” thread wants to check out data from the source, it decrements the semaphore matter. If the semaphore is 0, that indicates no new data is available, so consumer strings must wait (e.g. go into the blocked state).

Semaphores function in a similar way to mutex, however are typically used in various situations. We supply examples of these usage instances in the video along with problem a difficulty to make use of semaphores by yourself.

Item Links:
https://www.digikey.com/en/products/detail/adafruit-industries-llc/3405/7244967

Relevant Videos:
Introduction to RTOS Part 1 – What is a Real-Time Operating System (RTOS)? – https://youtu.be/F321087yYy4

Introduction to RTOS Part 2 – Getting Started with FreeRTOS – https://youtu.be/JIr7Xm_riRs

Introduction to RTOS Part 3 – Task Scheduling – https://youtu.be/95yUbClyf3E

Intro to RTOS Part 4 – Memory Management – https://youtu.be/Qske3yZRW5I

Introduction to RTOS Part 5 – Queue – https://youtu.be/pHJ3lxOoWeI

Intro to RTOS Part 6 – Mutex – https://youtu.be/I55auRpbiTs

Intro to RTOS Part 7 – https://youtu.be/5JcMtbA9QEE

Related Project Links:
https://www.digikey.com/en/maker/projects/introduction-to-rtos-solution-to-part-7-freertos-semaphore-example/51aa8660524c4daba38cba7c2f5baba7

Related Articles:
https://www.digikey.com/en/maker/videos/shawn-hymel/getting-started-with-stm32-and-nucleo-part-3-how-to-run-multiple-threads-with-cmsis-rtos-interface

Find out more:
Maker.io – https://www.digikey.com/en/maker

Digi-Key’s Blog– TheCircuit https://www.digikey.com/en/blog

Get in touch with Digi-Key on Facebook https://www.facebook.com/digikey.electronics/

As well as follow us on Twitter https://twitter.com/digikey