How to Choose Communication Methods Between RTOS Tasks in Embedded Systems

How to Choose Communication Methods Between RTOS Tasks in Embedded Systems

Introduction In practical embedded project development, have you ever encountered the dilemma of needing multiple tasks to work together but not knowing whether to use global variables, message queues, or semaphores? An improper choice may lead to slow system response, data contention, or even deadlocks. This article will systematically outline the inter-task communication mechanisms in … Read more

Comparison of FreeRTOS Semaphores (Part Five)

Comparison of FreeRTOS Semaphores (Part Five)

Message queues/semaphores/mutexes can be further compared. The following APIs seem well-organized(in fact, their underlying implementations come from the same source~) QueueHandle_t xQueue = xQueueCreate(10, sizeof(int)); // Create a queuexQueueSend(xQueue, &data, portMAX_DELAY); // Send dataxQueueReceive(xQueue, &receivedData, portMAX_DELAY); // Receive data SemaphoreHandle_t xSemaphore = xSemaphoreCreateBinary(); // Create a binary semaphore xSemaphoreGive(xSemaphore); // Release the semaphore xSemaphoreTake(xSemaphore, portMAX_DELAY); … Read more

Inter-Process Communication (IPC) in C++

Inter-Process Communication (IPC) in C++

In C++, Inter-Process Communication (IPC) is a mechanism that allows multiple independent processes to exchange data and coordinate operations. Below are detailed descriptions of three common IPC methods: 1. Pipes Pipes are a half-duplex communication method where data can only flow in one direction, and they are divided into anonymous pipes and named pipes. Anonymous … Read more

FreeRTOS Core API Overview

FreeRTOS Core API Overview

FreeRTOS – Core API Overview • Task management is the foundation for building concurrent programs. • Queues, semaphores, and mutexes: are solutions for inter-task communication and synchronization issues. • Event groups and task notifications: provide solutions for handling more complex synchronization scenarios. • Software timers: address the need for low-overhead handling of numerous timed events. … Read more

Analysis of FreeRTOS Queues

Analysis of FreeRTOS Queues

1. Introduction to Queues A queue is a mechanism for data exchange between tasks, tasks and interrupts, and interrupts and tasks. Based on queues, FreeRTOS implements various functionalities such as queue sets and semaphores. All communication and synchronization mechanisms in FreeRTOS are based on queues. Queues have the following characteristics: 1.1. Data Storage Queues can … Read more

Six Common Data Structures in Embedded Programming

Six Common Data Structures in Embedded Programming

Today, embedded systems are increasingly applied in various fields such as smart homes, smart healthcare, industrial automation, and intelligent transportation. In the development of embedded systems, data structures are an essential knowledge point. This article will introduce several common data structures in embedded programming, including arrays, stacks, queues, heaps, hash tables, and linked lists. 1. … Read more

An In-Depth Explanation and Practical Applications of FreeRTOS Queues

An In-Depth Explanation and Practical Applications of FreeRTOS Queues

An In-Depth Explanation and Practical Applications of FreeRTOS Queues What is a Queue? Imagine you are in line to buy ice cream. The first person is at the front of the line, and the first person to finish buying ice cream will leave the queue, followed by the second person, and so on. If you … Read more

Introduction to FreeRTOS: Detailed Explanation and Practical Applications of Queues

Introduction to FreeRTOS: Detailed Explanation and Practical Applications of Queues

After publishing “Introduction to FreeRTOS – Queues (1)”, some students reported that they found it difficult to understand. This article builds upon the foundation laid in “Introduction to FreeRTOS – Queues (1)” and provides further explanations and insights into the concept of queues in FreeRTOS, incorporating some personal interpretations and views. Detailed Explanation and Practical … Read more

Inter-Process Communication in C: Pipes and Message Queues

Inter-Process Communication in C: Pipes and Message Queues

Inter-Process Communication in C: Pipes and Message Queues In operating systems, a process is the basic unit of resource allocation, and inter-process communication (IPC) refers to the mechanisms that allow different processes to exchange data and information. The C language provides several ways to implement IPC, with the two most commonly used methods being pipes … Read more

Using Message Queues in Embedded Development with MCU

Using Message Queues in Embedded Development with MCU

In this era of information explosion, learning has never been more important. Last time, we explored task management in FreeRTOS, and today, we will delve into the mysteries of message queues in FreeRTOS, adding valuable knowledge to your repository.Have you ever been confused about message queues in FreeRTOS but struggled to find answers? Don’t worry, … Read more