Creating Tasks in STM32 FreeRTOS

Creating Tasks in STM32 FreeRTOS

1. Introduction to the xTaskCreate Task Creation Function typedef long BaseType_t; BaseType_t xTaskCreate( TaskFunction_t pvTaskCode, const char * const pcName, configSTACK_DEPTH_TYPE usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask ); Function: Creates a new task and adds it to the list of tasks that are ready to run. Each task requires RAM to store its state … Read more

A Hands-On Guide to Mastering Zephyr: Pitfalls and Avoidance Strategies in Embedded Development

A Hands-On Guide to Mastering Zephyr: Pitfalls and Avoidance Strategies in Embedded Development

Today, let’s talk about the love-hate relationship I have with the Zephyr real-time operating system. I remember when I first encountered Zephyr; it was quite overwhelming! The documentation was confusing, and the environment setup was always failing. But now, I can confidently tell you: this thing is really great! Why Choose Zephyr? In simple terms, … Read more

Guide to Dynamic Memory Usage in FreeRTOS: Choosing Between malloc and pvPortMalloc

Guide to Dynamic Memory Usage in FreeRTOS: Choosing Between malloc and pvPortMalloc

In embedded development, you might write something like this: uint8_t* buf = malloc(1024); // Allocate 1KB of memory It seems convenient, but in a multitasking system like FreeRTOS, there are some details regarding memory management that need attention. Differences Between malloc Heap and FreeRTOS Heap Feature malloc / free pvPortMalloc / vPortFree Heap Source C … Read more

Sharing an Application Running ROS on Microcontrollers (RTOS)

Sharing an Application Running ROS on Microcontrollers (RTOS)

Follow+Star Public Account Number, don’t miss out on exciting content Author | strongerHuang WeChat Public Account | Embedded ColumnThe application of robots is becoming increasingly widespread. The well-known ZhiHuiJun has directly started a business in robotics, which indicates that in the next decade, robotics will definitely be a hot industry.Currently, many robots on the market … Read more

Summary of Learning Experiences with STM32!

Summary of Learning Experiences with STM32!

1. Introduction If you can use the 8051 and write in C, then there is no need to deliberately learn STM32. What we need to consider is, what can I quickly achieve with STM32? Why use STM32 instead of 8051? Is it because the 51’s frequency is too low to meet computational demands? Is it … Read more

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

Understanding the Three Major Task Scheduling Mechanisms in Microcontrollers: Preemptive, Round-Robin, and Coroutines

Understanding the Three Major Task Scheduling Mechanisms in Microcontrollers: Preemptive, Round-Robin, and Coroutines

Here, I will explain these three concepts from a simple and microcontroller engineer’s perspective, ensuring you understand them at a glance. 🚀 1. Preemptive Scheduler Core: Tasks can be “forcefully interrupted”, and the CPU’s control can be taken away by higher priority tasks at any time. ✔ Features Uses interrupts + priority to control task … Read more

Unveiling Zephyr: How This Unassuming System Powers IoT Devices

Unveiling Zephyr: How This Unassuming System Powers IoT Devices

Honestly, you might not believe it, but I recently worked on a small project to create a smart temperature controller, and I almost fell into a pit when choosing the operating system. With such limited resources, running Linux? Don’t joke, there’s simply not enough memory. Later, an experienced engineer patted me on the shoulder and … Read more

Common Interview Questions for Embedded Engineers with 5 Years of Experience

Click the blue text above: IoT Guesthouse to follow us Today, I will guide you through the process of a first-round interview for embedded engineers and the common questions asked. 1First, introduce yourself It is important to highlight your project experience during the self-introduction. This part is crucial as many subsequent questions will be based … Read more