<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>hangcui1201 &#8211; Welcome to Hang&#039;s Website!</title>
	<atom:link href="https://hangpersonal.com/author/hangcui1201/feed/" rel="self" type="application/rss+xml" />
	<link>https://hangpersonal.com</link>
	<description>Embedded Systems</description>
	<lastBuildDate>Thu, 23 Jul 2026 20:18:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>

<image>
	<url>https://hangpersonal.com/wp-content/uploads/2024/10/cropped-HC-32x32.jpg</url>
	<title>hangcui1201 &#8211; Welcome to Hang&#039;s Website!</title>
	<link>https://hangpersonal.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">252449636</site>	<item>
		<title>STM32 FreeRTOS: Task Notifications</title>
		<link>https://hangpersonal.com/2026/07/22/stm32-freertos-task-notification/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Wed, 22 Jul 2026 23:55:35 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=7813</guid>

					<description><![CDATA[STM32 Microcontroller and FreeRTOS Development Back to top of the page]]></description>
										<content:encoded><![CDATA[
<a href="https://hangpersonal.com/embedded-system/stm32-mcu/freertos-tutorials/" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
STM32 Microcontroller and FreeRTOS Development
</a>
<br><br>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


            <div  class="spbtbl-wrapper spbtbl-blockmode" >
                                <table class="spbtbl-style spbtbl-color-blue" title="FreeRTOS: Task Notification"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left">Task Notification API Function</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">Description</th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >xTaskNotify()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Sends a notification to a task and updates its notification value using the specified action</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >xTaskNotifyFromISR()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Sends a task notification safely from an ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >xTaskNotifyGive()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Increments a task's notification value and unblocks it if waiting</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >vTaskNotifyGiveFromISR()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Increments a task’s notification value from an ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >xTaskNotifyAndQuery()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Sends a notification and returns the task’s previous notification value</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >xTaskNotifyAndQueryFromISR()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Performs notify-and-query safely from an ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >ulTaskNotifyTake()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Waits for a notification count, then clears or decrements it</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >xTaskNotifyWait()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Waits for a notification and optionally clears selected notification bits</td>                            </tr>
                                            </tbody>
                </table>
                            </div>




<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7813</post-id>	</item>
		<item>
		<title>FreeRTOS vs. Zephyr RTOS</title>
		<link>https://hangpersonal.com/2026/07/20/freertos-vs-zephyr/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Mon, 20 Jul 2026 16:40:47 +0000</pubDate>
				<category><![CDATA[Embedded System]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=7585</guid>

					<description><![CDATA[FreeRTOS is a lightweight, production-proven real-time kernel maintained by AWS under the MIT license. Built for resource-constrained microcontrollers, it delivers deterministic task scheduling, queues, semaphores, mutexes, and memory management with minimal flash and RAM usage. Its modular, vendor-neutral design integrates easily with custom toolchains, hardware platforms, and abstraction layers, making it a strong choice for...]]></description>
										<content:encoded><![CDATA[
<div class="article-text" style="margin-top:30px; margin-bottom:50px;">

<p>
<b>FreeRTOS</b> is a lightweight, production-proven real-time kernel maintained by AWS under the MIT license. Built for resource-constrained microcontrollers, it delivers deterministic task scheduling, queues, semaphores, mutexes, and memory management with minimal flash and RAM usage. Its modular, vendor-neutral design integrates easily with custom toolchains, hardware platforms, and abstraction layers, making it a strong choice for fast, predictable, low-level embedded systems.
</p>

<p>
<b>Zephyr</b> is a modern, full-featured RTOS hosted by the Linux Foundation under the Apache 2.0 license. Inspired by Linux, it combines standardized drivers, Devicetree and Kconfig configuration, built-in networking and wireless stacks, and security features such as MPU-based isolation. Its vendor-neutral, platform-oriented architecture enables developers to build secure, scalable IoT applications that can be ported across a wide range of hardware.
</p>


</div>


            <div  class="spbtbl-wrapper spbtbl-blockmode spbtbl-fullwidth" >
                                <table class="spbtbl-style spbtbl-color-blue" title="FreeRTOS vs Zephyr RTOS"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left">Feature / Concept</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">FreeRTOS</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">Zephyr RTOS</th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >License &amp; Sponsor</td>                                    <td style="font-size:18px !important;" itemprop="description" >Amazon Web Services (AWS) / MIT</td>                                    <td style="font-size:18px !important;" itemprop="description" >Linux Foundation / Apache 2.0</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Core Philosophy</td>                                    <td style="font-size:18px !important;" itemprop="description" >Minimalist kernel &amp; task scheduler</td>                                    <td style="font-size:18px !important;" itemprop="description" >Full-featured platform ecosystem</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Execution Primitives</td>                                    <td style="font-size:18px !important;" itemprop="description" >Tasks</td>                                    <td style="font-size:18px !important;" itemprop="description" >Threads, work queues, system work queue</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >System Options</td>                                    <td style="font-size:18px !important;" itemprop="description" >C Header file (FreeRTOSConfig.h)</td>                                    <td style="font-size:18px !important;" itemprop="description" >Kconfig (prj.conf)</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Hardware Description</td>                                    <td style="font-size:18px !important;" itemprop="description" >Vendor initialization code &amp; manual board support</td>                                    <td style="font-size:18px !important;" itemprop="description" >Devicetree (.dts), overlays, and bindings</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Abstraction Layer</td>                                    <td style="font-size:18px !important;" itemprop="description" >Vendor HALs (e.g., STM32 HAL, ESP-IDF)</td>                                    <td style="font-size:18px !important;" itemprop="description" >Universal, vendor-neutral driver APIs</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >App Portability</td>                                    <td style="font-size:18px !important;" itemprop="description" >Vendor/chip-specific projects</td>                                    <td style="font-size:18px !important;" itemprop="description" >Highly portable across boards and silicon vendors</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Networking &amp; Connectivity</td>                                    <td style="font-size:18px !important;" itemprop="description" >Manual integration (or AWS IoT / FreeRTOS-Plus-TCP)</td>                                    <td style="font-size:18px !important;" itemprop="description" >Built-in IPv4/IPv6, Ethernet, Wi-Fi, BLE, Mesh</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >System Services</td>                                    <td style="font-size:18px !important;" itemprop="description" >Custom logging, optional third-party components</td>                                    <td style="font-size:18px !important;" itemprop="description" >Built-in Logging subsystem, Shell CLI, USB, POSIX</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Memory Isolation</td>                                    <td style="font-size:18px !important;" itemprop="description" >Flat memory space (optional FreeRTOS-MPU)</td>                                    <td style="font-size:18px !important;" itemprop="description" >Native User/Kernel mode isolation &amp; MPU support</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Build System &amp; Tools</td>                                    <td style="font-size:18px !important;" itemprop="description" >Vendor IDEs (Keil, STM32CubeIDE), Make, CMake</td>                                    <td style="font-size:18px !important;" itemprop="description" >west meta-tool, CMake, and Zephyr SDK</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Flash / RAM Footprint</td>                                    <td style="font-size:18px !important;" itemprop="description" >Tiny (~5–10 KB Flash base)</td>                                    <td style="font-size:18px !important;" itemprop="description" >Scalable (~15–50+ KB Flash depending on modules)</td>                            </tr>
                                            </tbody>
                </table>
                            </div>




<div class="article-text" style="margin-top:30px; margin-bottom:30px;">

<p>
<b>FreeRTOS (Scheduler)</b>: FreeRTOS provides core RTOS primitives, tasks, semaphores, queues, and software timers. It leaves driver implementation, networking, and hardware configuration up to you or your target MCU&#8217;s vendor HAL.
</p>

<p>
<b>Zephyr (Platform)</b>: Zephyr takes a batteries-included approach. It includes unified driver models, a shell interface, power management, filesystems, and security modules built directly into the tree.
</p>

</div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Configuration &amp; Developer Workflow
</b>

<p>
<b>FreeRTOS</b>: Configuration is managed through a single FreeRTOSConfig.h file. You can easily integrate it into almost any vendor IDE (Keil, IAR, STM32CubeIDE) or custom Makefile/CMake environment.
</p>

<p>
<b>Zephyr</b>: Mimics the Linux kernel build process. Hardware is described using <span class="highlight">Devicetree (.dts)</span>, while software components are toggled using <span class="highlight">Kconfig (prj.conf)</span>. The meta-tool west manages repositories and builds, offering high cross-platform portability at the cost of a steeper initial learning curve.
</p>

</div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Memory Protection &amp; Performance
</b>

<p>
<b>FreeRTOS</b>: Has lower context-switching and interrupt overhead because of its lean execution model. Tasks generally execute in a single shared memory space.
</p>

<p>
<b>Zephyr</b>: Emphasizes safety and isolation. On supported hardware, it separates kernel mode from user mode and enforces hardware stack protection and memory partitions using the Memory Protection Unit (MPU).
</p>

</div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
FreeRTOS API vs. Zephyr API
</b>

</div>


            <div  class="spbtbl-wrapper spbtbl-blockmode spbtbl-fullwidth" >
                                <table class="spbtbl-style spbtbl-color-blue" title="FreeRTOS API vs. Zephyr API"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left">Concept</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">FreeRTOS API</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">Zephyr RTOS API</th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Thread Creation</td>                                    <td style="font-size:18px !important;" itemprop="description" >xTaskCreate()</td>                                    <td style="font-size:18px !important;" itemprop="description" >k_thread_create()</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Thread Delay</td>                                    <td style="font-size:18px !important;" itemprop="description" >vTaskDelay()</td>                                    <td style="font-size:18px !important;" itemprop="description" >k_sleep()<br>k_msleep()</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Binary Semaphore</td>                                    <td style="font-size:18px !important;" itemprop="description" >xSemaphoreCreateBinary()<br>xSemaphoreTake()</td>                                    <td style="font-size:18px !important;" itemprop="description" >K_SEM_DEFINE(..., 0, 1)<br>k_sem_take()</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Mutex</td>                                    <td style="font-size:18px !important;" itemprop="description" >xSemaphoreCreateMutex()<br>xSemaphoreTake()</td>                                    <td style="font-size:18px !important;" itemprop="description" >K_MUTEX_DEFINE(...)<br>k_mutex_lock()</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Event Group</td>                                    <td style="font-size:18px !important;" itemprop="description" >xEventGroupCreate()</td>                                    <td style="font-size:18px !important;" itemprop="description" >k_event_init()</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Message Queue</td>                                    <td style="font-size:18px !important;" itemprop="description" >xQueueCreate()<br>xQueueSend()</td>                                    <td style="font-size:18px !important;" itemprop="description" >k_msgq_init()<br>k_msgq_put()</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Direct Notification</td>                                    <td style="font-size:18px !important;" itemprop="description" >Task Notification<br>xTaskNotify()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Semaphore<br>k_event, or k_poll_signal</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Timers</td>                                    <td style="font-size:18px !important;" itemprop="description" >Software Timer<br>xTimerCreate()</td>                                    <td style="font-size:18px !important;" itemprop="description" >Kernel Timer<br>k_timer_init()</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Background Exec</td>                                    <td style="font-size:18px !important;" itemprop="description" >Daemon / Timer Task</td>                                    <td style="font-size:18px !important;" itemprop="description" >System Work Queue k_work_submit()</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >Interrupt APIs</td>                                    <td style="font-size:18px !important;" itemprop="description" >Separate ...FromISR() APIs</td>                                    <td style="font-size:18px !important;" itemprop="description" >Unified APIs (e.g., k_sem_give() works in ISR)</td>                            </tr>
                                            </tbody>
                </table>
                            </div>




<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7585</post-id>	</item>
		<item>
		<title>STM32 FreeRTOS: Event Groups</title>
		<link>https://hangpersonal.com/2026/07/17/stm32-freertos-event-group/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Sat, 18 Jul 2026 04:47:38 +0000</pubDate>
				<category><![CDATA[Embedded System]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=7579</guid>

					<description><![CDATA[STM32 Microcontroller and FreeRTOS Development Event Groups Event groups allow a task to wait in the blocked state for a combination of one of more events to occur. Event groups unblock all the tasks that were waiting for the same event, or combination of events, when the event occurs. Event groups reduce RAM usage by...]]></description>
										<content:encoded><![CDATA[
<a href="https://hangpersonal.com/embedded-system/stm32-mcu/freertos-tutorials/" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
STM32 Microcontroller and FreeRTOS Development
</a>
<br><br>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


            <div  class="spbtbl-wrapper spbtbl-blockmode spbtbl-fullwidth" >
                                <table class="spbtbl-style spbtbl-color-blue" title="FreeRTOS: Event Group"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left">Event Group API Function</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">Description</th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_create" style="font-size: 20px;color: blue">xEventGroupCreate()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Create an event group using dynamic memory allocation</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_create_static" style="font-size: 20px;color: blue">xEventGroupCreateStatic()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Create an event group using user-provided static memory</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_clear_bits" style="font-size: 20px;color: blue">xEventGroupClearBits()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Clear specified event bits from an event group</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_clear_bits_from_isr" style="font-size: 20px;color: blue">xEventGroupClearBitsFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Request specified event bits to be cleared from an ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_set_bits" style="font-size: 20px;color: blue">xEventGroupSetBits()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Set specified event bits in an event group</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_set_bits_from_isr" style="font-size: 20px;color: blue">xEventGroupSetBitsFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Request specified event bits to be set from an ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_get_bits" style="font-size: 20px;color: blue">xEventGroupGetBits()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Return the current event-bit value of an event group</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_get_bits_from_isr" style="font-size: 20px;color: blue">xEventGroupGetBitsFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Return the current event-bit value from an ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_wait_bits" style="font-size: 20px;color: blue">xEventGroupWaitBits()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Block a task until specified event bits are set or a timeout occurs</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#event_group_sync" style="font-size: 20px;color: blue">xEventGroupSync()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Sets event bits and waits for all specified bits</td>                            </tr>
                                            </tbody>
                </table>
                            </div>




<div class="article-text" style="margin-top:20px; margin-bottom:30px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Event Groups
</b>

<p>
Event groups allow a task to wait in the blocked state for a combination of one of more events to occur. Event groups unblock all the tasks that were waiting for the same event, or combination of events, when the event occurs. Event groups reduce RAM usage by allowing us to replace multiple binary semaphores with a single event group.

<ul>
<li> Synchronizing tasks
</li>
<li>Broadcasting events to multiple tasks
</li>
</ul>

</p>

</div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Event Bits
</b>

<p>
When <span class="highlight">configUSE_16_BIT_TICKS</span> is set to 0, <span class="highlight">TickType_t</span> is a 32-bit data type, so <span class="highlight">EventBits_t</span> is also a 32-bit data type. A variable of type <span class="highlight">EventBits_t</span> can store 24 event bits, while the upper 8 bits are reserved for internal use. Event bit 0 is stored in bit 0 of the variable, event bit 1 is stored in bit 1, and so on. For STM32 devices, an event group can therefore contain up to 24 usable event bits.
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img fetchpriority="high" decoding="async" width="1024" height="195" src="https://hangpersonal.com/wp-content/uploads/2026/07/event_group-1024x195.png" alt="" class="wp-image-7750" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/event_group-1024x195.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/event_group-300x57.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/event_group-768x146.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/event_group-1536x292.png 1536w, https://hangpersonal.com/wp-content/uploads/2026/07/event_group-2048x389.png 2048w, https://hangpersonal.com/wp-content/uploads/2026/07/event_group-850x161.png 850w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:40px; margin-bottom:30px;">

<p>
</p><ul>

<li>
An event group is a set of event flags
</li>

<li>An event flag is a boolean value (1 or 0) used to indicate whether an event has occurred or not
</li>

<li>An event flag is stored in a single bit and the state of all event flags can be stored in a single variable
</li>

</ul>
<p></p>

</div>



<div class="article-text" style="margin-top:60px; margin-bottom:30px;">

<b id="event_group_create" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupCreate()
</b>

<p>
<span class="highlight">xEventGroupCreate()</span> dynamically allocates the required memory and creates a new event group. It returns an <span class="highlight">EventGroupHandle_t</span> for use with other event-group functions, or NULL if memory allocation fails. This function is available only when <span class="highlight">configSUPPORT_DYNAMIC_ALLOCATION</span> is enabled. When the event group is no longer needed, call <span class="highlight">vEventGroupDelete()</span> to free the allocated memory.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>EventGroupHandle_t xEventGroupCreate(void)

// ---------------------- Example ----------------------

EventGroupHandle_t xEventGroupHandler;
xEventGroupHandler = xEventGroupCreate();</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">EventGroupHandle_t </span><span style="color: #FFE66D">xEventGroupCreate</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">void</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">EventGroupHandle_t xEventGroupHandler;</span></span>
<span class="line"><span style="color: #D5CED9">xEventGroupHandler </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xEventGroupCreate</span><span style="color: #D5CED9">();</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="event_group_create_static" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupCreateStatic()
</b>

<p>
<span class="highlight">xEventGroupCreateStatic()</span> creates an event group using memory supplied by the application rather than allocating memory from the FreeRTOS heap. The application must provide a <span class="highlight">StaticEventGroup_t</span> variable that remains valid for the entire lifetime of the event group. This function is useful in systems that require deterministic memory usage or do not permit dynamic allocation, and it is available only when <span class="highlight">configSUPPORT_STATIC_ALLOCATION</span> is enabled.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>EventGroupHandle_t xEventGroupCreateStatic(StaticEventGroup_t *pxEventGroupBuffer)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">EventGroupHandle_t </span><span style="color: #FFE66D">xEventGroupCreateStatic</span><span style="color: #D5CED9">(StaticEventGroup_t </span><span style="color: #EE5D43">*</span><span style="color: #00E8C6">pxEventGroupBuffer</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="event_group_clear_bits" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupClearBits()
</b>

<p>
<span class="highlight">xEventGroupClearBits()</span> clears one or more specified bits in an event group from task context. The bits are selected using a bit mask: each bit set to 1 in the mask is cleared, while all other bits remain unchanged. The function returns the event-group value before the bits were cleared, allowing the task to inspect the previous event state. It must not be called from an interrupt service routine.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>EventBits_t xEventGroupClearBits(EventGroupHandle_t xEventGroup, 
                                 const EventBits_t uxBitsToClear)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">EventBits_t </span><span style="color: #FFE66D">xEventGroupClearBits</span><span style="color: #D5CED9">(EventGroupHandle_t </span><span style="color: #00E8C6">xEventGroup</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                                 </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> EventBits_t </span><span style="color: #00E8C6">uxBitsToClear</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="event_group_clear_bits_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupClearBitsFromISR()
</b>

<p>
<span class="highlight">xEventGroupClearBitsFromISR()</span> requests that one or more specified event bits be cleared from interrupt context. Because clearing event bits may unblock multiple waiting tasks, the operation is deferred to the FreeRTOS timer daemon task rather than performed directly within the ISR. The function returns <span class="highlight">pdPASS</span> if the request is successfully posted to the timer command queue, or <span class="highlight">pdFAIL</span> if the queue is full.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xEventGroupClearBitsFromISR(EventGroupHandle_t xEventGroup, 
                                       const EventBits_t uxBitsToSet)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xEventGroupClearBitsFromISR</span><span style="color: #D5CED9">(EventGroupHandle_t </span><span style="color: #00E8C6">xEventGroup</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                                       </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> EventBits_t </span><span style="color: #00E8C6">uxBitsToSet</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="event_group_set_bits" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupSetBits()
</b>

<p>
<span class="highlight">xEventGroupSetBits()</span> sets one or more specified bits in an event group from task context. Tasks waiting for those bits are then evaluated and may be moved from the Blocked state to the Ready state. Multiple bits can be set simultaneously by combining them with the bitwise OR operator. The function returns the event-group value after the bits have been set and any automatically cleared bits have been processed.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>EventBits_t xEventGroupSetBits(EventGroupHandle_t xEventGroup, 
                               const EventBits_t uxBitsToSet)

// ---------------------- Example ---------------------- 

#define EVENTBIT_0	 (1 &lt;&lt; 0)
#define EVENTBIT_1	 (1 &lt;&lt; 1)
#define EVENTBIT_2	 (1 &lt;&lt; 2)
#define EVENTBIT_ALL (EVENTBIT_0 | EVENTBIT_1 | EVENTBIT_2)
                              
xEventGroupSetBits(xEventGroupHandler, EVENTBIT_1);
xEventGroupSetBits(xEventGroupHandler, EVENTBIT_2);                               </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">EventBits_t </span><span style="color: #FFE66D">xEventGroupSetBits</span><span style="color: #D5CED9">(EventGroupHandle_t </span><span style="color: #00E8C6">xEventGroup</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                               </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> EventBits_t </span><span style="color: #00E8C6">uxBitsToSet</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ---------------------- </span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">EVENTBIT_0</span><span style="color: #D5CED9">	 (</span><span style="color: #F39C12">1</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">&lt;&lt;</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">0</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">EVENTBIT_1</span><span style="color: #D5CED9">	 (</span><span style="color: #F39C12">1</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">&lt;&lt;</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">1</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">EVENTBIT_2</span><span style="color: #D5CED9">	 (</span><span style="color: #F39C12">1</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">&lt;&lt;</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">2</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">EVENTBIT_ALL</span><span style="color: #D5CED9"> (EVENTBIT_0 </span><span style="color: #EE5D43">|</span><span style="color: #D5CED9"> EVENTBIT_1 </span><span style="color: #EE5D43">|</span><span style="color: #D5CED9"> EVENTBIT_2)</span></span>
<span class="line"><span style="color: #D5CED9">                              </span></span>
<span class="line"><span style="color: #FFE66D">xEventGroupSetBits</span><span style="color: #D5CED9">(xEventGroupHandler, EVENTBIT_1);</span></span>
<span class="line"><span style="color: #FFE66D">xEventGroupSetBits</span><span style="color: #D5CED9">(xEventGroupHandler, EVENTBIT_2);                               </span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="event_group_set_bits_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupSetBitsFromISR()
</b>

<p>
<span class="highlight">xEventGroupSetBitsFromISR()</span> requests that one or more event bits be set from an interrupt service routine. Because setting event bits may unblock multiple tasks and is not a constant-time operation, the request is deferred to the FreeRTOS timer daemon task. The <span class="highlight">xHigherPriorityTaskWoken</span> parameter indicates whether processing the request may make a higher-priority task ready to run. The function returns <span class="highlight">pdPASS</span> if the request is successfully posted to the timer command queue, or <span class="highlight">pdFAIL</span> if the queue is full.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xEventGroupSetBitsFromISR(EventGroupHandle_t xEventGroup, 
                                     const EventBits_t uxBitsToSet, 
                                     BaseType_t * pxHigherPriorityTaskWoken)
                                     
// ---------------------- Example ----------------------

BaseType_t YieldRequired = pdFALSE;
BaseType_t xHigherPriorityTaskWoken;

YieldRequired = xEventGroupSetBitsFromISR(xEventGroupHandler,
    											                EVENTBIT_0,
												                  &amp;xHigherPriorityTaskWoken);	
												                  
if(YieldRequired != pdFAIL) {
    portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}                                      </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xEventGroupSetBitsFromISR</span><span style="color: #D5CED9">(EventGroupHandle_t </span><span style="color: #00E8C6">xEventGroup</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                                     </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> EventBits_t </span><span style="color: #00E8C6">uxBitsToSet</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                                     BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                                     </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">BaseType_t YieldRequired </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> pdFALSE;</span></span>
<span class="line"><span style="color: #D5CED9">BaseType_t xHigherPriorityTaskWoken;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">YieldRequired </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xEventGroupSetBitsFromISR</span><span style="color: #D5CED9">(xEventGroupHandler,</span></span>
<span class="line"><span style="color: #D5CED9">    											                EVENTBIT_0,</span></span>
<span class="line"><span style="color: #D5CED9">												                  </span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">xHigherPriorityTaskWoken</span><span style="color: #D5CED9">);	</span></span>
<span class="line"><span style="color: #D5CED9">												                  </span></span>
<span class="line"><span style="color: #C74DED">if</span><span style="color: #D5CED9">(YieldRequired </span><span style="color: #EE5D43">!=</span><span style="color: #D5CED9"> pdFAIL) {</span></span>
<span class="line"><span style="color: #D5CED9">    </span><span style="color: #FFE66D">portYIELD_FROM_ISR</span><span style="color: #D5CED9">(xHigherPriorityTaskWoken);</span></span>
<span class="line"><span style="color: #D5CED9">}                                      </span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="event_group_get_bits" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupGetBits()
</b>

<p>
<span class="highlight">xEventGroupGetBits()</span> reads and returns the current value of an event group from task context without modifying any bits. The returned <span class="highlight">EventBits_t</span> value can be tested with bit masks to determine which events are currently set. Because another task or interrupt may change the event group immediately afterward, the returned value should be treated as a snapshot of its state at the time of the call.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>EventBits_t xEventGroupGetBits(EventGroupHandle_t xEventGroup)

// ---------------------- Example ----------------------

EventBits_t newValue;
newValue = xEventGroupGetBits(xEventGroupHandler);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">EventBits_t </span><span style="color: #FFE66D">xEventGroupGetBits</span><span style="color: #D5CED9">(EventGroupHandle_t </span><span style="color: #00E8C6">xEventGroup</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">EventBits_t newValue;</span></span>
<span class="line"><span style="color: #D5CED9">newValue </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xEventGroupGetBits</span><span style="color: #D5CED9">(xEventGroupHandler);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="event_group_get_bits_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupGetBitsFromISR()
</b>

<p>
<span class="highlight">xEventGroupGetBitsFromISR()</span> reads and returns the current value of an event group from interrupt context without modifying any bits. It provides an ISR-safe way to check which event conditions are currently set. Like <span class="highlight">xEventGroupGetBits()</span>, the returned value is only a snapshot of the event group at the time of the call and may change immediately afterward.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>EventBits_t xEventGroupGetBitsFromISR(EventGroupHandle_t xEventGroup)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">EventBits_t </span><span style="color: #FFE66D">xEventGroupGetBitsFromISR</span><span style="color: #D5CED9">(EventGroupHandle_t </span><span style="color: #00E8C6">xEventGroup</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="event_group_wait_bits" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupWaitBits()
</b>

<p>
<span class="highlight">xEventGroupWaitBits()</span> allows a task to wait for one or more specified event bits. The task can be configured to unblock when either any requested bit is set or all requested bits are set. It can also automatically clear the matched bits before returning and wait indefinitely or for a specified timeout. The function returns the event-group value that caused the task to unblock, or the value present when the timeout expired.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>EventBits_t xEventGroupWaitBits(EventGroupHandle_t xEventGroup,
                                const EventBits_t uxBitsToWaitFor,
                                const BaseType_t xClearOnExit,
                                const BaseType_t xWaitForAllBits,
                                const TickType_t xTicksToWait)
                                
// ---------------------- Example ----------------------

EventBits_t EventValue;

// This code blocks the current FreeRTOS task until all event bits
// specified by EVENTBIT_ALL are set
EventValue = xEventGroupWaitBits((EventGroupHandle_t) xEventGroupHandler,
						     				         (EventBits_t		    ) EVENTBIT_ALL,
										             (BaseType_t		    ) pdTRUE,
										             (BaseType_t		    ) pdTRUE,
								                 (TickType_t		    ) portMAX_DELAY);   

// This call blocks the current task until any bit defined in EVENTBIT_ALL becomes set, 
// then clears the matched event bits and stores the previous event-group value in EventValue
EventValue = xEventGroupWaitBits((EventGroupHandle_t) xEventGroupHandler, // Event group to monitor
						     				         (EventBits_t		    ) EVENTBIT_ALL,       // Bit mask to wait for
										             (BaseType_t		    ) pdTRUE,             // Clear matched bits before returning
										             (BaseType_t		    ) pdFALSE,            // Wait for ANY bit, not all bits
								                 (TickType_t		    ) portMAX_DELAY);     // Wait indefinitely     								                                              </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">EventBits_t </span><span style="color: #FFE66D">xEventGroupWaitBits</span><span style="color: #D5CED9">(EventGroupHandle_t </span><span style="color: #00E8C6">xEventGroup</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> EventBits_t </span><span style="color: #00E8C6">uxBitsToWaitFor</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> BaseType_t </span><span style="color: #00E8C6">xClearOnExit</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> BaseType_t </span><span style="color: #00E8C6">xWaitForAllBits</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                                </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">EventBits_t EventValue;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// This code blocks the current FreeRTOS task until all event bits</span></span>
<span class="line"><span style="color: #A0A1A7CC">// specified by EVENTBIT_ALL are set</span></span>
<span class="line"><span style="color: #D5CED9">EventValue </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xEventGroupWaitBits</span><span style="color: #D5CED9">((EventGroupHandle_t) </span><span style="color: #00E8C6">xEventGroupHandler</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">						     				         (EventBits_t		    ) </span><span style="color: #00E8C6">EVENTBIT_ALL</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">										             (BaseType_t		    ) </span><span style="color: #00E8C6">pdTRUE</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">										             (BaseType_t		    ) </span><span style="color: #00E8C6">pdTRUE</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">								                 (TickType_t		    ) </span><span style="color: #00E8C6">portMAX_DELAY</span><span style="color: #D5CED9">);   </span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// This call blocks the current task until any bit defined in EVENTBIT_ALL becomes set, </span></span>
<span class="line"><span style="color: #A0A1A7CC">// then clears the matched event bits and stores the previous event-group value in EventValue</span></span>
<span class="line"><span style="color: #D5CED9">EventValue </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xEventGroupWaitBits</span><span style="color: #D5CED9">((EventGroupHandle_t) </span><span style="color: #00E8C6">xEventGroupHandler</span><span style="color: #D5CED9">,</span><span style="color: #A0A1A7CC"> // Event group to monitor</span></span>
<span class="line"><span style="color: #D5CED9">						     				         (EventBits_t		    ) </span><span style="color: #00E8C6">EVENTBIT_ALL</span><span style="color: #D5CED9">,</span><span style="color: #A0A1A7CC">       // Bit mask to wait for</span></span>
<span class="line"><span style="color: #D5CED9">										             (BaseType_t		    ) </span><span style="color: #00E8C6">pdTRUE</span><span style="color: #D5CED9">,</span><span style="color: #A0A1A7CC">             // Clear matched bits before returning</span></span>
<span class="line"><span style="color: #D5CED9">										             (BaseType_t		    ) </span><span style="color: #00E8C6">pdFALSE</span><span style="color: #D5CED9">,</span><span style="color: #A0A1A7CC">            // Wait for ANY bit, not all bits</span></span>
<span class="line"><span style="color: #D5CED9">								                 (TickType_t		    ) </span><span style="color: #00E8C6">portMAX_DELAY</span><span style="color: #D5CED9">);</span><span style="color: #A0A1A7CC">     // Wait indefinitely     								                                              </span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="event_group_sync" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xEventGroupSync()
</b>

<p>
<span class="highlight">xEventGroupSync()</span> synchronizes multiple tasks at a common execution point. It atomically sets the event bits specified by <span class="highlight">uxBitsToSet</span>, then blocks the calling task until all bits in <span class="highlight">uxBitsToWaitFor</span> are set or the timeout expires. The function returns the event-group value that caused the task to unblock, allowing the task to determine whether synchronization was completed successfully.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>EventBits_t xEventGroupSync(EventGroupHandle_t xEventGroup, 
                            const EventBits_t uxBitsToSet, 
                            const EventBits_t uxBitsToWaitFor, 
                            TickType_t xTicksToWait)
                            
// ---------------------- Example ----------------------

#define TASK1_BIT (1UL &lt;&lt; 0UL)
#define TASK2_BIT (1UL &lt;&lt; 1UL)
#define TASK3_BIT (1UL &lt;&lt; 2UL)

EventGroupHandle_t xEventGroup;
EventBits_t uxAllSyncBits = (TASK1_BIT | TASK2_BIT | TASK3_BIT);

xEventGroup = xEventGroupCreate();

void vTask1Task(void *pvParameters) {
	EventBits_t uxReturn;
	while(1) {
		uxReturn = xEventGroupSync(xEventGroup, TASK1_BIT, uxAllSyncBits, portMAX_DELAY);
		if( uxAllSyncBits == (uxReturn &amp; uxAllSyncBits) ) {
			// Do something
		}
	}
}

void vTask2Task(void *pvParameters) {
	EventBits_t uxReturn;
	while(1) {
		uxReturn = xEventGroupSync(xEventGroup, TASK2_BIT, uxAllSyncBits, portMAX_DELAY);
		if( uxAllSyncBits == (uxReturn &amp; uxAllSyncBits) ) {
			// Do something
		}
	}
}

void vTask3Task(void *pvParameters) {
	EventBits_t uxReturn;
	while(1) {
		uxReturn = xEventGroupSync(xEventGroup, TASK3_BIT, uxAllSyncBits, portMAX_DELAY);
		if( uxAllSyncBits == (uxReturn &amp; uxAllSyncBits) ) {
			// Do something
			printf("All tasks set \r\n");
			vTaskDelay(_200ms);
		}
	}
}                            </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">EventBits_t </span><span style="color: #FFE66D">xEventGroupSync</span><span style="color: #D5CED9">(EventGroupHandle_t </span><span style="color: #00E8C6">xEventGroup</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                            </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> EventBits_t </span><span style="color: #00E8C6">uxBitsToSet</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                            </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> EventBits_t </span><span style="color: #00E8C6">uxBitsToWaitFor</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                            TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                            </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">TASK1_BIT</span><span style="color: #D5CED9"> (</span><span style="color: #F39C12">1</span><span style="color: #C74DED">UL</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">&lt;&lt;</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">0</span><span style="color: #C74DED">UL</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">TASK2_BIT</span><span style="color: #D5CED9"> (</span><span style="color: #F39C12">1</span><span style="color: #C74DED">UL</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">&lt;&lt;</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">1</span><span style="color: #C74DED">UL</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">TASK3_BIT</span><span style="color: #D5CED9"> (</span><span style="color: #F39C12">1</span><span style="color: #C74DED">UL</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">&lt;&lt;</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">2</span><span style="color: #C74DED">UL</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">EventGroupHandle_t xEventGroup;</span></span>
<span class="line"><span style="color: #D5CED9">EventBits_t uxAllSyncBits </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> (TASK1_BIT </span><span style="color: #EE5D43">|</span><span style="color: #D5CED9"> TASK2_BIT </span><span style="color: #EE5D43">|</span><span style="color: #D5CED9"> TASK3_BIT);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">xEventGroup </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xEventGroupCreate</span><span style="color: #D5CED9">();</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">vTask1Task</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #00E8C6">pvParameters</span><span style="color: #D5CED9">) {</span></span>
<span class="line"><span style="color: #D5CED9">	EventBits_t uxReturn;</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">while</span><span style="color: #D5CED9">(</span><span style="color: #F39C12">1</span><span style="color: #D5CED9">) {</span></span>
<span class="line"><span style="color: #D5CED9">		uxReturn </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xEventGroupSync</span><span style="color: #D5CED9">(xEventGroup, TASK1_BIT, uxAllSyncBits, portMAX_DELAY);</span></span>
<span class="line"><span style="color: #D5CED9">		</span><span style="color: #C74DED">if</span><span style="color: #D5CED9">( uxAllSyncBits </span><span style="color: #EE5D43">==</span><span style="color: #D5CED9"> (uxReturn </span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9"> uxAllSyncBits) ) {</span></span>
<span class="line"><span style="color: #D5CED9">			</span><span style="color: #A0A1A7CC">// Do something</span></span>
<span class="line"><span style="color: #D5CED9">		}</span></span>
<span class="line"><span style="color: #D5CED9">	}</span></span>
<span class="line"><span style="color: #D5CED9">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">vTask2Task</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #00E8C6">pvParameters</span><span style="color: #D5CED9">) {</span></span>
<span class="line"><span style="color: #D5CED9">	EventBits_t uxReturn;</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">while</span><span style="color: #D5CED9">(</span><span style="color: #F39C12">1</span><span style="color: #D5CED9">) {</span></span>
<span class="line cbp-see-more-line "><span style="color: #D5CED9">		uxReturn </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xEventGroupSync</span><span style="color: #D5CED9">(xEventGroup, TASK2_BIT, uxAllSyncBits, portMAX_DELAY);</span></span>
<span class="line"><span style="color: #D5CED9">		</span><span style="color: #C74DED">if</span><span style="color: #D5CED9">( uxAllSyncBits </span><span style="color: #EE5D43">==</span><span style="color: #D5CED9"> (uxReturn </span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9"> uxAllSyncBits) ) {</span></span>
<span class="line"><span style="color: #D5CED9">			</span><span style="color: #A0A1A7CC">// Do something</span></span>
<span class="line"><span style="color: #D5CED9">		}</span></span>
<span class="line"><span style="color: #D5CED9">	}</span></span>
<span class="line"><span style="color: #D5CED9">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">vTask3Task</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #00E8C6">pvParameters</span><span style="color: #D5CED9">) {</span></span>
<span class="line"><span style="color: #D5CED9">	EventBits_t uxReturn;</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">while</span><span style="color: #D5CED9">(</span><span style="color: #F39C12">1</span><span style="color: #D5CED9">) {</span></span>
<span class="line"><span style="color: #D5CED9">		uxReturn </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xEventGroupSync</span><span style="color: #D5CED9">(xEventGroup, TASK3_BIT, uxAllSyncBits, portMAX_DELAY);</span></span>
<span class="line"><span style="color: #D5CED9">		</span><span style="color: #C74DED">if</span><span style="color: #D5CED9">( uxAllSyncBits </span><span style="color: #EE5D43">==</span><span style="color: #D5CED9"> (uxReturn </span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9"> uxAllSyncBits) ) {</span></span>
<span class="line"><span style="color: #D5CED9">			</span><span style="color: #A0A1A7CC">// Do something</span></span>
<span class="line"><span style="color: #D5CED9">			</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;All tasks set </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">			</span><span style="color: #FFE66D">vTaskDelay</span><span style="color: #D5CED9">(_200ms);</span></span>
<span class="line"><span style="color: #D5CED9">		}</span></span>
<span class="line"><span style="color: #D5CED9">	}</span></span>
<span class="line"><span style="color: #D5CED9">}                            </span></span></code></pre></div>



<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7579</post-id>	</item>
		<item>
		<title>STM32 FreeRTOS: Software Timers</title>
		<link>https://hangpersonal.com/2026/07/14/stm32-freertos-software-timer/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Tue, 14 Jul 2026 16:45:36 +0000</pubDate>
				<category><![CDATA[Embedded System]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=7488</guid>

					<description><![CDATA[STM32 Microcontroller and FreeRTOS Development One-shot timer: once started, it will execute its callback function once only. It can be restarted manually, but will not restart itself Auto-reload timer: once started, it will re-start itself each time it expires, resulting in periodic execution of its callback function xTimerCreate() Creates a FreeRTOS software timer using dynamically...]]></description>
										<content:encoded><![CDATA[
<a href="https://hangpersonal.com/embedded-system/stm32-mcu/freertos-tutorials/" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
STM32 Microcontroller and FreeRTOS Development
</a>
<br><br>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


            <div  class="spbtbl-wrapper spbtbl-blockmode spbtbl-fullwidth" >
                                <table class="spbtbl-style spbtbl-color-blue" title="FreeRTOS: Software Timer"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left">Software Timer API Function</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">Description</th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#timer_create" style="font-size: 20px;color: blue">xTimerCreate()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a software timer using dynamic memory</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#timer_create_static" style="font-size: 20px;color: blue">xTimerCreateStatic()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a software timer using user-provided memory</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#timer_start" style="font-size: 20px;color: blue">xTimerStart()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Starts or restarts a timer from a task</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#timer_start_from_isr" style="font-size: 20px;color: blue">xTimerStartFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Starts or restarts a timer from an ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#timer_stop" style="font-size: 20px;color: blue">xTimerStop()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Stops a running timer from a task</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#timer_stop_from_isr" style="font-size: 20px;color: blue">xTimerStopFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Stops a running timer from an ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#timer_reset" style="font-size: 20px;color: blue">xTimerReset()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Resets a timer and restarts its period from zero</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#timer_reset_from_isr" style="font-size: 20px;color: blue">xTimerResetFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Resets a timer from an ISR</td>                            </tr>
                                            </tbody>
                </table>
                            </div>




<div class="article-text" style="margin-top:30px; margin-bottom:30px;">

<p>
<b>One-shot timer</b>: once started, it will execute its callback function once only. It can be restarted manually, but will not restart itself
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" width="1024" height="889" src="https://hangpersonal.com/wp-content/uploads/2026/07/one-shot-timer-1024x889.png" alt="" class="wp-image-7564" style="width:650px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/one-shot-timer-1024x889.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/one-shot-timer-300x260.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/one-shot-timer-768x666.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/one-shot-timer-850x738.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/one-shot-timer.png 1142w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<p>
<b>Auto-reload timer</b>: once started, it will re-start itself each time it expires, resulting in periodic execution of its callback function
</p>

</div>



<figure class="wp-block-image size-large is-resized"><img decoding="async" width="1024" height="686" src="https://hangpersonal.com/wp-content/uploads/2026/07/auto-reload-timer-1024x686.png" alt="" class="wp-image-7568" style="width:900px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/auto-reload-timer-1024x686.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/auto-reload-timer-300x201.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/auto-reload-timer-768x515.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/auto-reload-timer-850x570.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/auto-reload-timer.png 1532w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<div class="article-text" style="margin-top:50px; margin-bottom:40px;">
</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>#define configUSE_TIMERS              1 
#define configTIMER_TASK_PRIORITY     (configMAX_PRIORITIES-1) 
#define configTIMER_QUEUE_LENGTH      5
#define configTIMER_TASK_STACK_DEPTH  (configMINIMAL_STACK_SIZE*2)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">configUSE_TIMERS</span><span style="color: #D5CED9">              </span><span style="color: #F39C12">1</span><span style="color: #D5CED9"> </span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">configTIMER_TASK_PRIORITY</span><span style="color: #D5CED9">     (configMAX_PRIORITIES</span><span style="color: #EE5D43">-</span><span style="color: #F39C12">1</span><span style="color: #D5CED9">) </span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">configTIMER_QUEUE_LENGTH</span><span style="color: #D5CED9">      </span><span style="color: #F39C12">5</span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">configTIMER_TASK_STACK_DEPTH</span><span style="color: #D5CED9">  (configMINIMAL_STACK_SIZE</span><span style="color: #EE5D43">*</span><span style="color: #F39C12">2</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="timer_create" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xTimerCreate()
</b>

<p>
Creates a FreeRTOS software timer using dynamically allocated memory from the FreeRTOS heap. It defines the timer name, period, one-shot or auto-reload mode, timer ID, and callback function. The newly created timer remains dormant until it is started.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>TimerHandle_t xTimerCreate(const char * const pcTimerName,
                           TickType_t xTimerPeriodInTicks,
                           UBaseType_t uxAutoReload,
                           void * pvTimerID,
                           TimerCallbackFunction_t pxCallbackFunction)
                           
// ---------------------- Example ----------------------

TimerHandle_t OneShotTimer_Handle;
TimerHandle_t AutoReloadTimer_Handle;

void OneShotTimerCallback(TimerHandle_t xTimer);    
void AutoReloadTimerCallback(TimerHandle_t xTimer); 

OneShotTimer_Handle = xTimerCreate("OneShotTimer",
			                     	       mainONE_SHOT_TIMER_PERIOD,
								                   pdFALSE,
								                   0,
								                   OneShotTimerCallback);
								                   
AutoReloadTimer_Handle = xTimerCreate("AutoReloadTimer",
									                    mainAUTO_RELOAD_TIMER_PERIOD,
									                    pdTRUE,
									                    0,
									                    AutoReloadTimerCallback);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">TimerHandle_t </span><span style="color: #FFE66D">xTimerCreate</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">char</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pcTimerName</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                           TickType_t </span><span style="color: #00E8C6">xTimerPeriodInTicks</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                           UBaseType_t </span><span style="color: #00E8C6">uxAutoReload</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                           </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvTimerID</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                           TimerCallbackFunction_t </span><span style="color: #00E8C6">pxCallbackFunction</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                           </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">TimerHandle_t OneShotTimer_Handle;</span></span>
<span class="line"><span style="color: #D5CED9">TimerHandle_t AutoReloadTimer_Handle;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">OneShotTimerCallback</span><span style="color: #D5CED9">(TimerHandle_t </span><span style="color: #00E8C6">xTimer</span><span style="color: #D5CED9">);    </span></span>
<span class="line"><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">AutoReloadTimerCallback</span><span style="color: #D5CED9">(TimerHandle_t </span><span style="color: #00E8C6">xTimer</span><span style="color: #D5CED9">); </span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">OneShotTimer_Handle </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xTimerCreate</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;OneShotTimer&quot;</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">			                     	       mainONE_SHOT_TIMER_PERIOD,</span></span>
<span class="line"><span style="color: #D5CED9">								                   pdFALSE,</span></span>
<span class="line"><span style="color: #D5CED9">								                   </span><span style="color: #F39C12">0</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">								                   OneShotTimerCallback);</span></span>
<span class="line"><span style="color: #D5CED9">								                   </span></span>
<span class="line"><span style="color: #D5CED9">AutoReloadTimer_Handle </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xTimerCreate</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;AutoReloadTimer&quot;</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">									                    mainAUTO_RELOAD_TIMER_PERIOD,</span></span>
<span class="line"><span style="color: #D5CED9">									                    pdTRUE,</span></span>
<span class="line"><span style="color: #D5CED9">									                    </span><span style="color: #F39C12">0</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">									                    AutoReloadTimerCallback);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="timer_create_static" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xTimerCreateStatic()
</b>

<p>
Creates a software timer using a StaticTimer_t memory buffer supplied by the application. Unlike xTimerCreate(), it does not allocate memory from the FreeRTOS heap, making memory usage predictable and suitable for systems that avoid dynamic allocation.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>TimerHandle_t xTimerCreateStatic(const char * const pcTimerName,
                                 TickType_t xTimerPeriodInTicks,
                                 UBaseType_t uxAutoReload,
                                 void * pvTimerID,
                                 TimerCallbackFunction_t pxCallbackFunction,
                                 StaticTimer_t * pxTimerBuffer)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">TimerHandle_t </span><span style="color: #FFE66D">xTimerCreateStatic</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">char</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pcTimerName</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 TickType_t </span><span style="color: #00E8C6">xTimerPeriodInTicks</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 UBaseType_t </span><span style="color: #00E8C6">uxAutoReload</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvTimerID</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 TimerCallbackFunction_t </span><span style="color: #00E8C6">pxCallbackFunction</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 StaticTimer_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxTimerBuffer</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="timer_start" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xTimerStart()
</b>

<p>
Starts a previously created software timer from normal task context. After the specified timer period expires, the timer&#8217;s callback function executes. For an auto-reload timer, this repeats periodically; for a one-shot timer, it occurs only once.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xTimerStart(TimerHandle_t xTimer, 
                       TickType_t xTicksToWait)
                       
// ---------------------- Example ----------------------

TimerHandle_t OneShotTimer_Handle;
TimerHandle_t AutoReloadTimer_Handle;

xTimerStart(OneShotTimer_Handle, 0);
xTimerStart(AutoReloadTimer_Handle, 0);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xTimerStart</span><span style="color: #D5CED9">(TimerHandle_t </span><span style="color: #00E8C6">xTimer</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                       TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                       </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">TimerHandle_t OneShotTimer_Handle;</span></span>
<span class="line"><span style="color: #D5CED9">TimerHandle_t AutoReloadTimer_Handle;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #FFE66D">xTimerStart</span><span style="color: #D5CED9">(OneShotTimer_Handle, </span><span style="color: #F39C12">0</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #FFE66D">xTimerStart</span><span style="color: #D5CED9">(AutoReloadTimer_Handle, </span><span style="color: #F39C12">0</span><span style="color: #D5CED9">);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="timer_start_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xTimerStartFromISR()
</b>

<p>
Starts or restarts a software timer from an interrupt service routine. It sends a start command to the timer command queue and uses pxHigherPriorityTaskWoken to indicate whether a context switch should occur when the ISR exits.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xTimerStartFromISR(TimerHandle_t xTimer,
                              BaseType_t * pxHigherPriorityTaskWoken)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xTimerStartFromISR</span><span style="color: #D5CED9">(TimerHandle_t </span><span style="color: #00E8C6">xTimer</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                              BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="timer_stop" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xTimerStop()
</b>

<p>
Stops an active software timer from normal task context. Once stopped, the timer will not expire or execute its callback function, but the timer object remains valid and can be started again later.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xTimerStop(TimerHandle_t xTimer, 
                      TickType_t xTicksToWait)

// ---------------------- Example ----------------------

TimerHandle_t AutoReloadTimer_Handle;
xTimerStop(AutoReloadTimer_Handle, 0);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xTimerStop</span><span style="color: #D5CED9">(TimerHandle_t </span><span style="color: #00E8C6">xTimer</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                      TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">TimerHandle_t AutoReloadTimer_Handle;</span></span>
<span class="line"><span style="color: #FFE66D">xTimerStop</span><span style="color: #D5CED9">(AutoReloadTimer_Handle, </span><span style="color: #F39C12">0</span><span style="color: #D5CED9">);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="timer_stop_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xTimerStopFromISR()
</b>

<p>
Stops an active software timer from an interrupt service routine. It is the interrupt-safe version of xTimerStop() and can request a context switch through the pxHigherPriorityTaskWoken parameter.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xTimerStopFromISR(TimerHandle_t xTimer,
                             BaseType_t * pxHigherPriorityTaskWoken)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xTimerStopFromISR</span><span style="color: #D5CED9">(TimerHandle_t </span><span style="color: #00E8C6">xTimer</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                             BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="timer_reset" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xTimerReset()
</b>

<p>
Resets a timer&#8217;s expiration time from normal task context. If the timer is active, it restarts the full timer period from the moment the reset is requested; if it is dormant, the reset operation also starts it.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xTimerReset(TimerHandle_t xTimer, 
                       TickType_t xTicksToWait)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xTimerReset</span><span style="color: #D5CED9">(TimerHandle_t </span><span style="color: #00E8C6">xTimer</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                       TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="timer_reset_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xTimerResetFromISR()
</b>

<p>
Resets or starts a software timer from an interrupt service routine. It recalculates the expiration time from the moment it is called and uses pxHigherPriorityTaskWoken to indicate whether an ISR-level context switch is required.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xTimerResetFromISR(TimerHandle_t xTimer,
                              BaseType_t * pxHigherPriorityTaskWoken)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xTimerResetFromISR</span><span style="color: #D5CED9">(TimerHandle_t </span><span style="color: #00E8C6">xTimer</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                              BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7488</post-id>	</item>
		<item>
		<title>TI C2000: External Memory Interface (EMIF)</title>
		<link>https://hangpersonal.com/2026/07/01/c2000-emif/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Thu, 02 Jul 2026 03:42:01 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=7387</guid>

					<description><![CDATA[TI C2000 Real-Time Microcontroller: Control, Sensing, and Communication External Memory Interface (EMIF) Interfacing to SDRAM Interfacing to Asynchronous Memory EMIF Performance External Memory Interface (EMIF) This EMIF memory controller is compliant with the JESD21-C SDR SDRAM memories utilizing a 32-bit/16-bit data bus. The purpose of this EMIF is to provide a means for the CPU...]]></description>
										<content:encoded><![CDATA[
<a href="https://hangpersonal.com/embedded-system/ti-mcu/c2000-tutorials/" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
TI C2000 Real-Time Microcontroller: Control, Sensing, and Communication
</a>

<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>



<ul style="margin-top:30px; margin-bottom:30px;">

<li style="margin-bottom:16px;">
<a href="#c28x_emif" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
External Memory Interface (EMIF)
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28x_emif_sdram" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
Interfacing to SDRAM
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28x_emif_async_memory" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
Interfacing to Asynchronous Memory
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28x_emif_performance" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
EMIF Performance
</a>
</li> 


</ul>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="c28_emif" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
External Memory Interface (EMIF)
</b>

<p>
This EMIF memory controller is compliant with the JESD21-C SDR SDRAM memories utilizing a 32-bit/16-bit data bus. The purpose of this EMIF is to provide a means for the CPU to connect to a variety of external devices including:

<ul>
<li> Single data rate (SDR) SDRAM
</li>
<li> Asynchronous devices including NOR Flash and SRAM
</li>
</ul>

A common use for the EMIF is to interface with both a flash device and an SDRAM device simultaneously.
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="772" src="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif-1024x772.png" alt="" class="wp-image-7396" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif-1024x772.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif-768x579.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif.png 1440w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="823" src="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_signal-1024x823.png" alt="" class="wp-image-7399" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_signal-1024x823.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_signal-300x241.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_signal-768x617.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_signal-850x683.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_signal.png 1239w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="772" src="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_config-1024x772.png" alt="" class="wp-image-7402" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_config-1024x772.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_config-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_config-768x579.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_config-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_config.png 1440w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="c28x_emif_sdram" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Interfacing to SDRAM
</b>

<p>
The EMIF supports a glueless interface to SDRAM devices with the following characteristics:
<ul>
<li> Pre-charge bit is A[10]
</li>
<li> The number of column address bits is 8, 9, 10, or 11
</li>
<li> The number of row address bits is 13, 14, 15, or 16
</li>
<li> The number of internal banks is 1, 2, or 4
</li>
</ul>
</p>

</div>



<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="603" src="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_512kpng-1024x603.png" alt="" class="wp-image-7448" style="width:600px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_512kpng-1024x603.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_512kpng-300x177.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_512kpng-768x452.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_512kpng-850x501.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_512kpng.png 1380w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">EMIF to 512K × 16 × 2 bank SDRAM<br></figcaption></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:30px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="604" src="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_2m-1024x604.png" alt="" class="wp-image-7449" style="width:600px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_2m-1024x604.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_2m-300x177.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_2m-768x453.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_2m-850x502.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_sdram_2m.png 1381w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">EMIF to 2M × 16 × 4 bank SDRAM</figcaption></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:30px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="331" src="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_16bit_address_pin-1024x331.png" alt="" class="wp-image-7453" style="width:900px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_16bit_address_pin-1024x331.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_16bit_address_pin-300x97.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_16bit_address_pin-768x248.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_16bit_address_pin-1536x496.png 1536w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_16bit_address_pin-850x274.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_16bit_address_pin.png 1828w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">16-bit EMIF Address Pin Connections</figcaption></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:30px;">

<b id="c28x_emif_async_memory" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Interfacing to Asynchronous Memory
</b>

<p>
The EMIF easily interfaces to a variety of asynchronous devices including NOR Flash and SRAM. It can be operated in two major modes
</p><ul>
<li> Normal Mode
</li>
<li> Select Strobe Mode
</li>
</ul>
<p></p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="387" src="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_async_memory-1024x387.png" alt="" class="wp-image-7456" style="width:600px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_async_memory-1024x387.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_async_memory-300x113.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_async_memory-768x290.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_async_memory-850x321.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_async_memory.png 1441w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:55px; margin-bottom:30px;">

<b id="c28x_emif_performance" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
EMIF Performance
</b>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="769" src="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_performance-1024x769.png" alt="" class="wp-image-7404" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_performance-1024x769.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_performance-300x225.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_performance-768x577.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_performance-850x638.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_performance.png 1440w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:30px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="878" src="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_configuration_interface-1024x878.png" alt="" class="wp-image-7462" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_configuration_interface-1024x878.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_configuration_interface-300x257.png 300w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_configuration_interface-768x659.png 768w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_configuration_interface-850x729.png 850w, https://hangpersonal.com/wp-content/uploads/2026/07/c28_emif_configuration_interface.png 1364w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption">Example of Configuration Interface</figcaption></figure>
</div>


<div class="article-text" style="margin-top:60px; margin-bottom:40px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Reference
</b>

<p>
[1] <a href="https://www.ti.com/video/series/c2000-f2837xd-microcontroller-one-day-workshop-series.html" style="color: blue;">
TMS320F2837xD Microcontroller Workshop</a>
</p>

</div>



<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7387</post-id>	</item>
		<item>
		<title>STM32 FreeRTOS: Semaphores and Mutexes</title>
		<link>https://hangpersonal.com/2026/06/28/stm32-freertos-semaphore-mutex/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Mon, 29 Jun 2026 05:17:29 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=7308</guid>

					<description><![CDATA[STM32 Microcontroller and FreeRTOS Development (1) The task calls xSemaphoreTake() to acquire the semaphore. Since the semaphore is unavailable, Task is placed into the Blocked state until the semaphore becomes available. (2) An interrupt occurs, and the interrupt service routine (ISR) calls xSemaphoreGiveFromISR() to give the semaphore. As a result, the semaphore becomes available. (3)...]]></description>
										<content:encoded><![CDATA[
<a href="https://hangpersonal.com/embedded-system/stm32-mcu/freertos-tutorials/" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
STM32 Microcontroller and FreeRTOS Development
</a>
<br><br>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


            <div  class="spbtbl-wrapper spbtbl-blockmode spbtbl-fullwidth" >
                                <table class="spbtbl-style spbtbl-color-blue" title="FreeRTOS: Semaphore and Mutex"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left">Semaphore &amp; Mutex API Function</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">Description</th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_create_binary" style="font-size: 20px;color: blue">xSemaphoreCreateBinary()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a dynamically allocated binary semaphore</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_create_binary_static" style="font-size: 20px;color: blue">xSemaphoreCreateBinaryStatic()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a binary semaphore using user-provided memory</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_create_counting" style="font-size: 20px;color: blue">xSemaphoreCreateCounting()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a counting semaphore with an initial and maximum count</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_create_counting_static" style="font-size: 20px;color: blue">xSemaphoreCreateCountingStatic()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a counting semaphore using user-provided memory</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_create_mutex" style="font-size: 20px;color: blue">xSemaphoreCreateMutex()</a>
</td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a dynamically allocated mutex with priority inheritance</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_create_mutex_static" style="font-size: 20px;color: blue">xSemaphoreCreateMutexStatic()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a mutex using user-provided memory</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_give" style="font-size: 20px;color: blue">xSemaphoreGive()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Releases a semaphore from a task</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_give_from_isr" style="font-size: 20px;color: blue">xSemaphoreGiveFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Releases a semaphore from an interrupt handler</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_take" style="font-size: 20px;color: blue">xSemaphoreTake()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Waits for and obtains a semaphore from a task</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_take_from_isr" style="font-size: 20px;color: blue">xSemaphoreTakeFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Obtains a semaphore from an interrupt handler without blocking</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_create_mutex_recursive" style="font-size: 20px;color: blue">xSemaphoreCreateRecursiveMutex()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a mutex that the owner can lock multiple times</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_create_mutex_recursive_static" style="font-size: 20px;color: blue">xSemaphoreCreateRecursiveMutexStatic()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Creates a static recursive mutex using user-provided memory</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_take_recursive" style="font-size: 20px;color: blue">xSemaphoreTakeRecursive()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Locks a recursive mutex; the owner may lock it multiple times</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#semaph_give_recursive" style="font-size: 20px;color: blue">xSemaphoreGiveRecursive()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Unlocks a recursive mutex; call once for each successful take</td>                            </tr>
                                            </tbody>
                </table>
                            </div>




<div class="article-text" style="margin-top:30px; margin-bottom:30px;">

<p>
(1) The task calls xSemaphoreTake() to acquire the semaphore. Since the semaphore is unavailable, Task is placed into the Blocked state until the semaphore becomes available.
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="955" height="233" src="https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_1.png" alt="" class="wp-image-7532" style="width:500px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_1.png 955w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_1-300x73.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_1-768x187.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_1-850x207.png 850w" sizes="auto, (max-width: 955px) 100vw, 955px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<p>
(2) An interrupt occurs, and the interrupt service routine (ISR) calls xSemaphoreGiveFromISR() to give the semaphore. As a result, the semaphore becomes available.
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="141" src="https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_2-1024x141.png" alt="" class="wp-image-7536" style="width:900px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_2-1024x141.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_2-300x41.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_2-768x106.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_2-1536x212.png 1536w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_2-2048x282.png 2048w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_2-850x117.png 850w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<p>
(3) Because the semaphore is now available, Task successfully acquires it using xSemaphoreTake(). The task transitions from the Blocked state to the Running (or Ready, depending on the scheduler) state and begins executing the associated processing.
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="141" src="https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_3-1024x141.png" alt="" class="wp-image-7538" style="width:900px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_3-1024x141.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_3-300x41.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_3-768x106.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_3-1536x212.png 1536w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_3-2048x282.png 2048w, https://hangpersonal.com/wp-content/uploads/2026/06/binary_semph_3-850x117.png 850w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<p>
(4) Since a task function typically runs in an infinite loop, after completing the required processing it calls xSemaphoreTake() again to wait for the semaphore. Because the semaphore became unavailable after Step 3, the task enters the Blocked state once again, just as it did in Step 1. It remains blocked until another interrupt occurs and the interrupt service routine (ISR) calls xSemaphoreGiveFromISR() to give the semaphore.
</p>

</div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_create_binary" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreCreateBinary()
</b>

<p>
Creates a binary semaphore using memory dynamically allocated from the FreeRTOS heap. A binary semaphore has only two states: available and unavailable, internally represented by a count of 1 or 0. The semaphore is created in the unavailable/empty state, so xSemaphoreGive() must normally be called before the first successful xSemaphoreTake(). It is commonly used for task-to-task or interrupt-to-task synchronization. The function returns a semaphore handle on success or NULL if memory allocation fails.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>SemaphoreHandle_t xSemaphoreCreateBinary(void)

// ---------------------- Example ----------------------

SemaphoreHandle_t xBinarySemaphore;
xBinarySemaphore = xSemaphoreCreateBinary();
xSemaphoreGive(xBinarySemaphore);

xSemaphoreTake(xBinarySemaphore, portMAX_DELAY);
xSemaphoreGive(xBinarySemaphore);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">SemaphoreHandle_t </span><span style="color: #FFE66D">xSemaphoreCreateBinary</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">void</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">SemaphoreHandle_t xBinarySemaphore;</span></span>
<span class="line"><span style="color: #D5CED9">xBinarySemaphore </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xSemaphoreCreateBinary</span><span style="color: #D5CED9">();</span></span>
<span class="line"><span style="color: #FFE66D">xSemaphoreGive</span><span style="color: #D5CED9">(xBinarySemaphore);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #FFE66D">xSemaphoreTake</span><span style="color: #D5CED9">(xBinarySemaphore, portMAX_DELAY);</span></span>
<span class="line"><span style="color: #FFE66D">xSemaphoreGive</span><span style="color: #D5CED9">(xBinarySemaphore);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_create_binary_static" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreCreateBinaryStatic()
</b>

<p>
Creates a binary semaphore without using the FreeRTOS heap. The application provides a StaticSemaphore_t object that stores the semaphore’s internal control information. This buffer must remain valid for the entire lifetime of the semaphore, so it should normally be global or declared with static. Like the dynamically created version, the semaphore starts empty and must be given before it can be taken. Static creation is useful in safety-critical or memory-constrained systems where dynamic allocation is undesirable.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>SemaphoreHandle_t xSemaphoreCreateBinaryStatic(StaticSemaphore_t *pxSemaphoreBuffer)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">SemaphoreHandle_t </span><span style="color: #FFE66D">xSemaphoreCreateBinaryStatic</span><span style="color: #D5CED9">(StaticSemaphore_t </span><span style="color: #EE5D43">*</span><span style="color: #00E8C6">pxSemaphoreBuffer</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_create_counting" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreCreateCounting()
</b>

<p>
Creates a dynamically allocated counting semaphore. uxMaxCount specifies the largest value the semaphore count can reach, while uxInitialCount specifies its starting value and must not exceed the maximum. Every successful xSemaphoreGive() increases the count, and every successful xSemaphoreTake() decreases it. Counting semaphores are commonly used either to count pending events or to manage a pool of identical resources. The function returns a valid handle on success or NULL if allocation fails.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>SemaphoreHandle_t xSemaphoreCreateCounting(UBaseType_t uxMaxCount, 
                                           UBaseType_t uxInitialCount)
                                           
// ---------------------- Example ----------------------

SemaphoreHandle_t xCountSemaphore; 
xCountSemaphore = xSemaphoreCreateCounting(255, 0);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">SemaphoreHandle_t </span><span style="color: #FFE66D">xSemaphoreCreateCounting</span><span style="color: #D5CED9">(UBaseType_t </span><span style="color: #00E8C6">uxMaxCount</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                                           UBaseType_t </span><span style="color: #00E8C6">uxInitialCount</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                                           </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">SemaphoreHandle_t xCountSemaphore; </span></span>
<span class="line"><span style="color: #D5CED9">xCountSemaphore </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xSemaphoreCreateCounting</span><span style="color: #D5CED9">(</span><span style="color: #F39C12">255</span><span style="color: #D5CED9">, </span><span style="color: #F39C12">0</span><span style="color: #D5CED9">);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_create_counting_static" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreCreateCountingStatic()
</b>

<p>
Creates a counting semaphore using memory supplied by the application. It behaves like xSemaphoreCreateCounting(), but no FreeRTOS heap allocation is performed. The caller provides a persistent StaticSemaphore_t buffer that stores the semaphore’s control structure. The initial count must be less than or equal to the maximum count. This version is useful when all RTOS objects must have deterministic, statically allocated memory.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>SemaphoreHandle_t xSemaphoreCreateCountingStatic(UBaseType_t uxMaxCount, 
                                                 UBaseType_t uxInitialCount, 
                                                 StaticSemaphore_t * pxSemaphoreBuffer)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">SemaphoreHandle_t </span><span style="color: #FFE66D">xSemaphoreCreateCountingStatic</span><span style="color: #D5CED9">(UBaseType_t </span><span style="color: #00E8C6">uxMaxCount</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                                                 UBaseType_t </span><span style="color: #00E8C6">uxInitialCount</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                                                 StaticSemaphore_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxSemaphoreBuffer</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_create_mutex" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreCreateMutex()
</b>

<p>
Creates a dynamically allocated mutex for protecting a shared resource, such as a UART, SPI peripheral, file system, or shared data structure. Unlike a newly created binary semaphore, a newly created mutex starts in the available state and can immediately be taken. A mutex records which task owns it and provides priority inheritance to reduce priority-inversion problems. The task that successfully takes the mutex must be the task that gives it back. Mutexes must not be used from interrupt service routines.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>SemaphoreHandle_t xSemaphoreCreateMutex(void)

// ---------------------- Example ----------------------

SemaphoreHandle_t xMutexSemaphore;
xMutexSemaphore = xSemaphoreCreateMutex();</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">SemaphoreHandle_t </span><span style="color: #FFE66D">xSemaphoreCreateMutex</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">void</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">SemaphoreHandle_t xMutexSemaphore;</span></span>
<span class="line"><span style="color: #D5CED9">xMutexSemaphore </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xSemaphoreCreateMutex</span><span style="color: #D5CED9">();</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_create_mutex_static" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreCreateMutexStatic()
</b>

<p>
Creates a mutex using a user-provided StaticSemaphore_t buffer instead of dynamically allocating memory. It provides the same ownership tracking, mutual-exclusion behavior, and priority inheritance as xSemaphoreCreateMutex(). The buffer must remain allocated for as long as the mutex exists. The mutex is initially available, so no initial xSemaphoreGive() is required. This function is suitable for applications that prohibit heap allocation after startup.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>SemaphoreHandle_t xSemaphoreCreateMutexStatic(StaticSemaphore_t *pxMutexBuffer)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">SemaphoreHandle_t </span><span style="color: #FFE66D">xSemaphoreCreateMutexStatic</span><span style="color: #D5CED9">(StaticSemaphore_t </span><span style="color: #EE5D43">*</span><span style="color: #00E8C6">pxMutexBuffer</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_give" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreGive()
</b>

<p>
Releases a semaphore from task context. For a binary semaphore, it changes the state from unavailable to available. For a counting semaphore, it increases the current count by one, provided the maximum count has not already been reached. For a mutex, it releases ownership so another waiting task can acquire the protected resource. The function returns pdTRUE when successful and pdFALSE when the semaphore is already full or cannot be released. It must not be called from an interrupt; use xSemaphoreGiveFromISR() instead.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xSemaphoreGive(xSemaphore)

// ---------------------- Example ----------------------

xSemaphoreGive(xBinarySemaphore);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xSemaphoreGive</span><span style="color: #D5CED9">(xSemaphore)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #FFE66D">xSemaphoreGive</span><span style="color: #D5CED9">(xBinarySemaphore);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_give_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreGiveFromISR()
</b>

<p>
Releases a binary or counting semaphore from an interrupt service routine. If giving the semaphore unblocks a task whose priority is higher than that of the currently running task, *pxHigherPriorityTaskWoken is set to pdTRUE. The ISR should then request a context switch with the port-specific macro, commonly portYIELD_FROM_ISR(). The variable should normally be initialized to pdFALSE before the call. This function cannot be used with mutexes because mutex ownership and priority inheritance require task context.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xSemaphoreGiveFromISR(SemaphoreHandle_t xSemaphore,
                                 BaseType_t * pxHigherPriorityTaskWoken)
                                 
// ---------------------- Example ----------------------

SemaphoreHandle_t xBinarySemaphore;
xBinarySemaphore = xSemaphoreCreateBinary();

BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xSemaphoreGiveFromISR(BinarySemaphore, &amp;xHigherPriorityTaskWoken);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xSemaphoreGiveFromISR</span><span style="color: #D5CED9">(SemaphoreHandle_t </span><span style="color: #00E8C6">xSemaphore</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                                 </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">SemaphoreHandle_t xBinarySemaphore;</span></span>
<span class="line"><span style="color: #D5CED9">xBinarySemaphore </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xSemaphoreCreateBinary</span><span style="color: #D5CED9">();</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">BaseType_t xHigherPriorityTaskWoken </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> pdFALSE;</span></span>
<span class="line"><span style="color: #FFE66D">xSemaphoreGiveFromISR</span><span style="color: #D5CED9">(BinarySemaphore, </span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">xHigherPriorityTaskWoken</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #FFE66D">portYIELD_FROM_ISR</span><span style="color: #D5CED9">(xHigherPriorityTaskWoken);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_take" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreTake()
</b>

<p>
Attempts to obtain a binary semaphore, counting semaphore, or standard mutex from task context. If the object is available, the operation succeeds immediately and its count is decreased. If it is unavailable, the calling task can enter the Blocked state for up to xTicksToWait ticks. A value of 0 performs a nonblocking check, while portMAX_DELAY can be used for an indefinite wait when the relevant FreeRTOS configuration permits it. The function returns pdTRUE when the semaphore is obtained and pdFALSE if the waiting time expires.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xSemaphoreTake(SemaphoreHandle_t xSemaphore,
                          TickType_t xBlockTime)

// ---------------------- Example ----------------------

xSemaphoreTake(xBinarySemaphore, portMAX_DELAY);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xSemaphoreTake</span><span style="color: #D5CED9">(SemaphoreHandle_t </span><span style="color: #00E8C6">xSemaphore</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                          TickType_t </span><span style="color: #00E8C6">xBlockTime</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #FFE66D">xSemaphoreTake</span><span style="color: #D5CED9">(xBinarySemaphore, portMAX_DELAY);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_take_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreTakeFromISR()
</b>

<p>
Attempts to obtain a binary or counting semaphore from an interrupt service routine. It cannot wait or block, so it succeeds only if the semaphore count is already greater than zero. A successful operation decreases the semaphore count and returns pdTRUE; otherwise, it returns pdFALSE. It must not be used with mutexes or recursive mutexes. In most interrupt-to-task synchronization designs, the ISR gives the semaphore and the task takes it, so this function is used less frequently than xSemaphoreGiveFromISR().
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xSemaphoreTakeFromISR(SemaphoreHandle_t xSemaphore,
                                 BaseType_t * pxHigherPriorityTaskWoken)                         </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xSemaphoreTakeFromISR</span><span style="color: #D5CED9">(SemaphoreHandle_t </span><span style="color: #00E8C6">xSemaphore</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)                         </span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_create_mutex_recursive" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreCreateRecursiveMutex()
</b>

<p>
Creates a dynamically allocated recursive mutex. A recursive mutex allows its owning task to take the same mutex multiple times without blocking itself. FreeRTOS maintains an internal recursion count that records how many times the owner has successfully taken it. The task must give the mutex exactly the same number of times before another task can acquire it. Recursive mutexes are useful when a protected function calls another function that needs the same lock. They must be used with xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive(), not the standard take and give functions.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>SemaphoreHandle_t xSemaphoreCreateRecursiveMutex(void)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">SemaphoreHandle_t </span><span style="color: #FFE66D">xSemaphoreCreateRecursiveMutex</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">void</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_create_mutex_recursive_static" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreCreateRecursiveMutexStatic()
</b>

<p>
Creates a recursive mutex using application-provided static memory. Its behavior is identical to the dynamically created recursive mutex, including ownership tracking, priority inheritance, and recursive nesting count. The supplied StaticSemaphore_t buffer must remain valid throughout the mutex’s lifetime. This function avoids heap allocation while still allowing the same task to lock a resource repeatedly. Recursive mutex support must be enabled in FreeRTOSConfig.h.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>SemaphoreHandle_t xSemaphoreCreateRecursiveMutexStatic(StaticSemaphore_t *pxMutexBuffer)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">SemaphoreHandle_t </span><span style="color: #FFE66D">xSemaphoreCreateRecursiveMutexStatic</span><span style="color: #D5CED9">(StaticSemaphore_t </span><span style="color: #EE5D43">*</span><span style="color: #00E8C6">pxMutexBuffer</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_take_recursive" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreTakeRecursive()
</b>

<p>
Obtains a mutex created specifically as a recursive mutex. The first successful call assigns ownership to the calling task. Additional calls from the same task succeed immediately and increase the recursive nesting count. Calls from other tasks block for up to xTicksToWait while the mutex remains owned. The function returns pdTRUE when the mutex is obtained and pdFALSE if the waiting time expires. It must not be used with a standard mutex created by xSemaphoreCreateMutex().
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>#define xSemaphoreTakeRecursive(xMutex, xBlockTime)
  xQueueTakeMutexRecursive(xMutex, xBlockTime)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xSemaphoreTakeRecursive</span><span style="color: #D5CED9">(</span><span style="color: #00E8C6">xMutex</span><span style="color: #D5CED9">, </span><span style="color: #00E8C6">xBlockTime</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">  </span><span style="color: #FFE66D">xQueueTakeMutexRecursive</span><span style="color: #D5CED9">(xMutex, xBlockTime)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="semaph_give_recursive" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xSemaphoreGiveRecursive()
</b>

<p>
Releases one level of ownership of a recursive mutex. Each call decreases the mutex’s recursive nesting count by one. The mutex becomes available to other tasks only when the count reaches zero. Therefore, every successful call to xSemaphoreTakeRecursive() must eventually have a matching call to xSemaphoreGiveRecursive(). Only the task that owns the recursive mutex may give it, and the function must not be called from an ISR.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>#define xSemaphoreGiveRecursive(xMutex)
  xQueueGiveMutexRecursive(xMutex)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xSemaphoreGiveRecursive</span><span style="color: #D5CED9">(</span><span style="color: #00E8C6">xMutex</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">  </span><span style="color: #FFE66D">xQueueGiveMutexRecursive</span><span style="color: #D5CED9">(xMutex)</span></span></code></pre></div>



<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7308</post-id>	</item>
		<item>
		<title>STM32 FreeRTOS: Queues and Queue Sets</title>
		<link>https://hangpersonal.com/2026/06/28/stm32-freertos-queue/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Sun, 28 Jun 2026 21:43:00 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=7194</guid>

					<description><![CDATA[STM32 Microcontroller and FreeRTOS Development Queue Send &#038; Receive Queue Definition xQueueCreate() xQueueCreate() creates a queue using dynamically allocated memory from the FreeRTOS heap. It specifies the maximum number of items the queue can hold and the size of each item. The function returns a valid queue handle when creation succeeds or NULL if there...]]></description>
										<content:encoded><![CDATA[
<a href="https://hangpersonal.com/embedded-system/stm32-mcu/freertos-tutorials/" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
STM32 Microcontroller and FreeRTOS Development
</a>
<br><br>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


            <div  class="spbtbl-wrapper spbtbl-blockmode" >
                                <table class="spbtbl-style spbtbl-color-blue" title="FreeRTOS: Queue API Function"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left">Queue API Function</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">Description</th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_create" style="font-size: 20px;color: blue">xQueueCreate()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Create a dynamic queue</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_create_static" style="font-size: 20px;color: blue">xQueueCreateStatic()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Create a static queue</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_send" style="font-size: 20px;color: blue">xQueueSend()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Add an item to the back of a queue</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_send_back" style="font-size: 20px;color: blue">xQueueSendToBack()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Add an item to the back of a queue</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_send_front" style="font-size: 20px;color: blue">xQueueSendToFront()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Add an item to the front of a queue</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_overwrite" style="font-size: 20px;color: blue">xQueueOverwrite()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Add an item to a queue, overwriting the old one if full.</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_send_from_isr" style="font-size: 20px;color: blue">xQueueSendFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Add an item to the back of a queue from ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_send_back_from_isr" style="font-size: 20px;color: blue">xQueueSendToBackFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Add an item to the back of a queue from ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_send_front_from_isr" style="font-size: 20px;color: blue">xQueueSendToFrontFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Add an item to the front of a queue from ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_overwrite_from_isr" style="font-size: 20px;color: blue">xQueueOverwriteFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Add an item from an ISR, overwriting the old one if full.</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_receive" style="font-size: 20px;color: blue">xQueueReceive()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Receive and remove an item from a queue</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_peek" style="font-size: 20px;color: blue">xQueuePeek()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Receive an item from a queue without removing it</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_receive_from_isr" style="font-size: 20px;color: blue">xQueueReceiveFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Receive and remove an item from a queue from ISR</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_peek_from_isr" style="font-size: 20px;color: blue">xQueuePeekFromISR()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Receive an item from a queue from ISR without removing it </td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_space_available" style="font-size: 20px;color: blue">uxQueueSpacesAvailable()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Return the number of free spaces in a queue</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_msg_waiting" style="font-size: 20px;color: blue">uxQueueMessagesWaiting()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Return the number of items stored in a queue</td>                            </tr>
                                            </tbody>
                </table>
                            </div>



            <div  class="spbtbl-wrapper spbtbl-blockmode" >
                                <table class="spbtbl-style spbtbl-color-blue" title="FreeRTOS: Queue Set API Function"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left">Queue Set API Function</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">Description</th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_create_set" style="font-size: 20px;color: blue">xQueueCreateSet()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Create a queue set for monitoring multiple queues or semaphores</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_add_set" style="font-size: 20px;color: blue">xQueueAddToSet()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Add a queue or semaphore to an existing queue set</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#queue_select_set" style="font-size: 20px;color: blue">xQueueSelectFromSet()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Wait for and return the queue-set member that becomes ready</td>                            </tr>
                                            </tbody>
                </table>
                            </div>




<div class="article-text" style="margin-top:20px; margin-bottom:30px;">

<b id="queue_create" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:30px;">
Queue Send &#038; Receive
</b>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="165" src="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_1-1024x165.png" alt="" class="wp-image-7359" style="width:750px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_1-1024x165.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_1-300x48.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_1-768x124.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_1-850x137.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_1.png 1059w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:50px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="166" src="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_2-1024x166.png" alt="" class="wp-image-7360" style="width:750px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_2-1024x166.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_2-300x49.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_2-768x124.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_2-850x138.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_2.png 1056w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:0px;">
Queue Definition
</b>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>typedef struct QueueDefinition 
{
	int8_t *pcHead;					
	int8_t *pcWriteTo;	

	union
	{
		QueuePointers_t xQueue;		
		SemaphoreData_t xSemaphore;
	} u;

	List_t xTasksWaitingToSend;		
	List_t xTasksWaitingToReceive;	

	volatile UBaseType_t uxMessagesWaiting;
	UBaseType_t uxLength;			
	UBaseType_t uxItemSize;			

	volatile int8_t cRxLock;		
	volatile int8_t cTxLock;	

	#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) &amp;&amp; \
	     ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
		uint8_t ucStaticallyAllocated;
	#endif

	#if ( configUSE_QUEUE_SETS == 1 )
		struct QueueDefinition *pxQueueSetContainer;
	#endif

	#if ( configUSE_TRACE_FACILITY == 1 )
		UBaseType_t uxQueueNumber;
		uint8_t ucQueueType;
	#endif

} xQUEUE;

typedef xQUEUE Queue_t;</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #C74DED">typedef</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> QueueDefinition </span></span>
<span class="line"><span style="color: #D5CED9">{</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">int8_t</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9">pcHead;					</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">int8_t</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9">pcWriteTo;	</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">union</span></span>
<span class="line"><span style="color: #D5CED9">	{</span></span>
<span class="line"><span style="color: #D5CED9">		QueuePointers_t xQueue;		</span></span>
<span class="line"><span style="color: #D5CED9">		SemaphoreData_t xSemaphore;</span></span>
<span class="line"><span style="color: #D5CED9">	} u;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">	List_t xTasksWaitingToSend;		</span></span>
<span class="line"><span style="color: #D5CED9">	List_t xTasksWaitingToReceive;	</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">volatile</span><span style="color: #D5CED9"> UBaseType_t uxMessagesWaiting;</span></span>
<span class="line"><span style="color: #D5CED9">	UBaseType_t uxLength;			</span></span>
<span class="line"><span style="color: #D5CED9">	UBaseType_t uxItemSize;			</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">volatile</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">int8_t</span><span style="color: #D5CED9"> cRxLock;		</span></span>
<span class="line cbp-see-more-line "><span style="color: #D5CED9">	</span><span style="color: #C74DED">volatile</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">int8_t</span><span style="color: #D5CED9"> cTxLock;	</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">#if</span><span style="color: #D5CED9">( ( </span><span style="color: #FFE66D">configSUPPORT_STATIC_ALLOCATION</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">==</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">1</span><span style="color: #D5CED9"> ) </span><span style="color: #EE5D43">&amp;&amp;</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">\</span></span>
<span class="line"><span style="color: #D5CED9">	     ( </span><span style="color: #FFE66D">configSUPPORT_DYNAMIC_ALLOCATION</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">==</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">1</span><span style="color: #D5CED9"> ) )</span></span>
<span class="line"><span style="color: #D5CED9">		</span><span style="color: #C74DED">uint8_t</span><span style="color: #D5CED9"> ucStaticallyAllocated;</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">#endif</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">#if</span><span style="color: #D5CED9"> ( </span><span style="color: #FFE66D">configUSE_QUEUE_SETS</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">==</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">1</span><span style="color: #D5CED9"> )</span></span>
<span class="line"><span style="color: #D5CED9">		</span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> QueueDefinition </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9">pxQueueSetContainer;</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">#endif</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">#if</span><span style="color: #D5CED9"> ( </span><span style="color: #FFE66D">configUSE_TRACE_FACILITY</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">==</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">1</span><span style="color: #D5CED9"> )</span></span>
<span class="line"><span style="color: #D5CED9">		UBaseType_t uxQueueNumber;</span></span>
<span class="line"><span style="color: #D5CED9">		</span><span style="color: #C74DED">uint8_t</span><span style="color: #D5CED9"> ucQueueType;</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">#endif</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">} xQUEUE;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">typedef</span><span style="color: #D5CED9"> xQUEUE Queue_t;</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:50px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="792" height="1024" src="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_example-1-792x1024.png" alt="" class="wp-image-7384" style="width:600px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_example-1-792x1024.png 792w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_example-1-232x300.png 232w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_example-1-768x993.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_example-1-300x388.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_example-1-850x1099.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_queue_example-1.png 1066w" sizes="auto, (max-width: 792px) 100vw, 792px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_create" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueCreate()
</b>

<p>
xQueueCreate() creates a queue using dynamically allocated memory from the FreeRTOS heap. It specifies the maximum number of items the queue can hold and the size of each item. The function returns a valid queue handle when creation succeeds or NULL if there is insufficient heap memory.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>QueueHandle_t xQueueCreate(UBaseType_t uxQueueLength,
                           UBaseType_t uxItemSize)

// ---------------------- Example ----------------------
                           
#define MESSAGE_Q_NUM  5
QueueHandle_t msgQueue;
msgQueue = xQueueCreate(MESSAGE_Q_NUM, sizeof(uint32_t));                           </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">QueueHandle_t </span><span style="color: #FFE66D">xQueueCreate</span><span style="color: #D5CED9">(UBaseType_t </span><span style="color: #00E8C6">uxQueueLength</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                           UBaseType_t </span><span style="color: #00E8C6">uxItemSize</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"><span style="color: #D5CED9">                           </span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">MESSAGE_Q_NUM</span><span style="color: #D5CED9">  </span><span style="color: #F39C12">5</span></span>
<span class="line"><span style="color: #D5CED9">QueueHandle_t msgQueue;</span></span>
<span class="line"><span style="color: #D5CED9">msgQueue </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xQueueCreate</span><span style="color: #D5CED9">(MESSAGE_Q_NUM, </span><span style="color: #EE5D43">sizeof</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">uint32_t</span><span style="color: #D5CED9">));                           </span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_create_static" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueCreateStatic()
</b>

<p>
xQueueCreateStatic() creates a queue using memory supplied by the application rather than memory allocated from the FreeRTOS heap. The application provides a storage buffer for the queue items and a StaticQueue_t structure for the queue control data. The function returns a queue handle when creation succeeds or NULL if the parameters are invalid.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>QueueHandle_t xQueueCreateStatic(UBaseType_t uxQueueLength,
                                 UBaseType_t uxItemSize,
                                 uint8_t * pucQueueStorage,
                                 StaticQueue_t * pxQueueBuffer)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">QueueHandle_t </span><span style="color: #FFE66D">xQueueCreateStatic</span><span style="color: #D5CED9">(UBaseType_t </span><span style="color: #00E8C6">uxQueueLength</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 UBaseType_t </span><span style="color: #00E8C6">uxItemSize</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 </span><span style="color: #C74DED">uint8_t</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pucQueueStorage</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                 StaticQueue_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxQueueBuffer</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_send" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueSend()
</b>

<p>
xQueueSend() sends an item to the back of a FreeRTOS queue. The item is copied into the queue, and the calling task can optionally wait for available space if the queue is full. The function returns pdPASS when the item is successfully added or errQUEUE_FULL if the operation fails.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueSend(QueueHandle_t xQueue,
                      const void * pvItemToQueue,
                      TickType_t xTicksToWait)
                      
// ---------------------- Example ----------------------

const TickType_t wait_time = pdMS_TO_TICKS(200);
BaseType_t qStatus = xQueueSend(msgQueue, &amp;valToSend, wait_time);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueSend</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                      </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvItemToQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                      TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                      </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">const</span><span style="color: #D5CED9"> TickType_t wait_time </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">pdMS_TO_TICKS</span><span style="color: #D5CED9">(</span><span style="color: #F39C12">200</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">BaseType_t qStatus </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xQueueSend</span><span style="color: #D5CED9">(msgQueue, </span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">valToSend</span><span style="color: #D5CED9">, wait_time);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_send_back" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueSendToBack()
</b>

<p>
xQueueSendToBack() copies an item to the back of a FreeRTOS queue. If the queue is full, the calling task can wait for a specified number of ticks until space becomes available. The function returns pdPASS on success or errQUEUE_FULL if the item cannot be added.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueSendToBack(QueueHandle_t xQueue,
                            const void* pvItemToQueue,
                            TickType_t xTicksToWait)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueSendToBack</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                            </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">void</span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvItemToQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                            TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_send_front" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueSendToFront()
</b>

<p>
xQueueSendToFront() copies an item to the front of a FreeRTOS queue, allowing it to be received before existing items. If the queue is full, the calling task can wait for a specified number of ticks until space becomes available. It returns pdPASS on success or errQUEUE_FULL if the item cannot be added.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueSendToToFront(QueueHandle_t xQueue,
                               const void *pvItemToQueue,
                               TickType_t xTicksToWait)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueSendToToFront</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                               </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #00E8C6">pvItemToQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                               TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_overwrite" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueOverwrite()
</b>

<p>
xQueueOverwrite() copies an item into a queue even when the queue is already full, replacing the existing item. It is intended for queues with a length of one, such as those storing the latest sensor value or system state. The function returns pdPASS and must not be called from an interrupt service routine.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueOverwrite(QueueHandle_t xQueue,
                           const void * pvItemToQueue)
                           
// ---------------------- Example ----------------------

#define KEYMSG_Q_NUM  1
QueueHandle_t keyQueue;
keyQueue = xQueueCreate(KEYMSG_Q_NUM, sizeof(uint8_t));

uint8_t keyState = HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0);
BaseType_t qStatus = xQueueOverwrite(keyQueue, &amp;keyState);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueOverwrite</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                           </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvItemToQueue</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                           </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">KEYMSG_Q_NUM</span><span style="color: #D5CED9">  </span><span style="color: #F39C12">1</span></span>
<span class="line"><span style="color: #D5CED9">QueueHandle_t keyQueue;</span></span>
<span class="line"><span style="color: #D5CED9">keyQueue </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xQueueCreate</span><span style="color: #D5CED9">(KEYMSG_Q_NUM, </span><span style="color: #EE5D43">sizeof</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">uint8_t</span><span style="color: #D5CED9">));</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">uint8_t</span><span style="color: #D5CED9"> keyState </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">HAL_GPIO_ReadPin</span><span style="color: #D5CED9">(GPIOA, GPIO_PIN_0);</span></span>
<span class="line"><span style="color: #D5CED9">BaseType_t qStatus </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xQueueOverwrite</span><span style="color: #D5CED9">(keyQueue, </span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">keyState</span><span style="color: #D5CED9">);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_send_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueSendFromISR()
</b>

<p>
xQueueSendFromISR() copies an item to the back of a FreeRTOS queue from within an interrupt service routine. It does not block if the queue is full, and the pxHigherPriorityTaskWoken parameter indicates whether sending the item unblocked a higher-priority task that may require a context switch. It returns pdPASS on success or errQUEUE_FULL if the item cannot be added.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueSendFromISR(QueueHandle_t xQueue,
                             const void * pvItemToQueue,
                             BaseType_t * pxHigherPriorityTaskWoken)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueSendFromISR</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                             </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvItemToQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                             BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_send_back_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueSendToBackFromISR()
</b>

<p>
xQueueSendToBackFromISR() copies an item to the back of a FreeRTOS queue from within an interrupt service routine. It never blocks if the queue is full, and pxHigherPriorityTaskWoken indicates whether a higher-priority task was unblocked and a context switch may be required. The function returns pdPASS on success or errQUEUE_FULL if the item cannot be added.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueSendToBackFromISR(QueueHandle_t xQueue,
                                   const void * pvItemToQueue,
                                   BaseType_t * pxHigherPriorityTaskWoken)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueSendToBackFromISR</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                   </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvItemToQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                   BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_send_front_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueSendToFrontFromISR()
</b>

<p>
xQueueSendToFrontFromISR() copies an item to the front of a FreeRTOS queue from within an interrupt service routine, allowing it to be received before existing items. It does not block if the queue is full, and pxHigherPriorityTaskWoken indicates whether a higher-priority task was unblocked and a context switch may be required. The function returns pdPASS on success or errQUEUE_FULL if the item cannot be added.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueSendToFrontFromISR(QueueHandle_t xQueue,
                                    const void * pvItemToQueue,
                                    BaseType_t * pxHigherPriorityTaskWoken)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueSendToFrontFromISR</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                    </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvItemToQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                    BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_overwrite_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueOverwriteFromISR()
</b>

<p>
xQueueOverwriteFromISR() writes an item to a queue from within an interrupt service routine, replacing the existing item if the queue is already full. It is intended for queues with a length of one and never blocks. The pxHigherPriorityTaskWoken parameter indicates whether a higher-priority task was unblocked and a context switch may be required.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueOverwriteFromISR(QueueHandle_t xQueue,
                                  const void * pvItemToQueue,
                                  BaseType_t * pxHigherPriorityTaskWoken)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueOverwriteFromISR</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                  </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvItemToQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                  BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxHigherPriorityTaskWoken</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_receive" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueReceive()
</b>

<p>
xQueueReceive() removes an item from the front of a FreeRTOS queue and copies it into a user-provided buffer. If the queue is empty, the calling task can wait for a specified number of ticks until an item becomes available. The function returns pdPASS on success or errQUEUE_EMPTY if no item is received.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueReceive(QueueHandle_t xQueue,
                         void * pvBuffer,
                         TickType_t xTicksToWait)
                         
// ---------------------- Example ----------------------

BaseType_t qStatus = xQueueReceive(msgQueue, &amp;valToReceive, 0);              </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueReceive</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                         </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvBuffer</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                         TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span>
<span class="line"><span style="color: #D5CED9">                         </span></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">BaseType_t qStatus </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xQueueReceive</span><span style="color: #D5CED9">(msgQueue, </span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">valToReceive</span><span style="color: #D5CED9">, </span><span style="color: #F39C12">0</span><span style="color: #D5CED9">);              </span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_peek" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueuePeek()
</b>

<p>
xQueuePeek() copies an item from the front of a FreeRTOS queue without removing it, allowing the same item to be read again later. If the queue is empty, the calling task can wait for a specified number of ticks until an item becomes available. The function returns pdPASS on success or errQUEUE_EMPTY if no item is available.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueuePeek(QueueHandle_t xQueue,
                      void * pvBuffer,
                      TickType_t xTicksToWait)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueuePeek</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                      </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvBuffer</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                      TickType_t </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_receive_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueReceiveFromISR()
</b>

<p>
xQueueReceiveFromISR() removes an item from the front of a FreeRTOS queue and copies it into a user-provided buffer from within an interrupt service routine. It never blocks if the queue is empty, and pxHigherPriorityTaskWoken indicates whether receiving the item unblocked a higher-priority task that may require a context switch. The function returns pdPASS on success or pdFAIL if the queue is empty.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueReceiveFromISR(QueueHandle_t xQueue,
                                void* pvBuffer,
                                BaseType_t * pxTaskWoken)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueReceiveFromISR</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                </span><span style="color: #C74DED">void</span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvBuffer</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                                BaseType_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pxTaskWoken</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_peek_from_isr" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueuePeekFromISR()
</b>

<p>
xQueuePeekFromISR() copies an item from the front of a FreeRTOS queue into a user-provided buffer from within an interrupt service routine without removing it from the queue. It never blocks if the queue is empty and returns pdPASS when an item is successfully read or pdFAIL if no item is available.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueuePeekFromISR(QueueHandle_t xQueue,
                             void * pvBuffer)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueuePeekFromISR</span><span style="color: #D5CED9">(QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                             </span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">pvBuffer</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_space_available" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
uxQueueSpacesAvailable()
</b>

<p>
uxQueueSpacesAvailable() returns the number of free spaces currently available in a FreeRTOS queue.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>UBaseType_t uxQueueSpacesAvailable(const QueueHandle_t xQueue)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">UBaseType_t </span><span style="color: #FFE66D">uxQueueSpacesAvailable</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_msg_waiting" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
uxQueueMessagesWaiting()
</b>

<p>
uxQueueMessagesWaiting() returns the number of items currently stored in a FreeRTOS queue.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>UBaseType_t uxQueueMessagesWaiting(const QueueHandle_t xQueue)</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">UBaseType_t </span><span style="color: #FFE66D">uxQueueMessagesWaiting</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> QueueHandle_t </span><span style="color: #00E8C6">xQueue</span><span style="color: #D5CED9">)</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_create_set" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueCreateSet()
</b>

<p>
xQueueCreateSet() creates a queue set that can contain multiple queues and semaphores, allowing a task to block until any member becomes ready. The length of set should be large enough to hold the total number of items that all member queues and semaphores may contain.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>QueueSetHandle_t xQueueCreateSet(const UBaseType_t uxEventQueueLength)

// ---------------------- Example ----------------------

QueueSetHandle_t xQueueSet = NULL;
QueueHandle_t xQueue1 = NULL, xQueue2 = NULL;
xQueue1 = xQueueCreate(1, sizeof(char*));
xQueue2 = xQueueCreate(1, sizeof(char*));
xQueueSet = xQueueCreateSet(1*2);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">QueueSetHandle_t </span><span style="color: #FFE66D">xQueueCreateSet</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> UBaseType_t </span><span style="color: #00E8C6">uxEventQueueLength</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">QueueSetHandle_t xQueueSet </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">NULL</span><span style="color: #D5CED9">;</span></span>
<span class="line"><span style="color: #D5CED9">QueueHandle_t xQueue1 </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">NULL</span><span style="color: #D5CED9">, xQueue2 </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">NULL</span><span style="color: #D5CED9">;</span></span>
<span class="line"><span style="color: #D5CED9">xQueue1 </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xQueueCreate</span><span style="color: #D5CED9">(</span><span style="color: #F39C12">1</span><span style="color: #D5CED9">, </span><span style="color: #EE5D43">sizeof</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">char</span><span style="color: #EE5D43">*</span><span style="color: #D5CED9">));</span></span>
<span class="line"><span style="color: #D5CED9">xQueue2 </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xQueueCreate</span><span style="color: #D5CED9">(</span><span style="color: #F39C12">1</span><span style="color: #D5CED9">, </span><span style="color: #EE5D43">sizeof</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">char</span><span style="color: #EE5D43">*</span><span style="color: #D5CED9">));</span></span>
<span class="line"><span style="color: #D5CED9">xQueueSet </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">xQueueCreateSet</span><span style="color: #D5CED9">(</span><span style="color: #F39C12">1</span><span style="color: #EE5D43">*</span><span style="color: #F39C12">2</span><span style="color: #D5CED9">);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_add_set" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueAddToSet()
</b>

<p>
xQueueAddToSet() adds a queue, semaphore, or mutex to an existing queue set so a task can monitor it together with other set members. The member should be empty when added, and the function returns pdPASS if successful or pdFAIL if it cannot be added.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>BaseType_t xQueueAddToSet(QueueSetMemberHandle_t xQueueOrSemaphore,
                          QueueSetHandle_t xQueueSet)

// ---------------------- Example ----------------------

xQueueAddToSet(xQueue1, xQueueSet);
xQueueAddToSet(xQueue2, xQueueSet);                          </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">BaseType_t </span><span style="color: #FFE66D">xQueueAddToSet</span><span style="color: #D5CED9">(QueueSetMemberHandle_t </span><span style="color: #00E8C6">xQueueOrSemaphore</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">                          QueueSetHandle_t </span><span style="color: #00E8C6">xQueueSet</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #FFE66D">xQueueAddToSet</span><span style="color: #D5CED9">(xQueue1, xQueueSet);</span></span>
<span class="line"><span style="color: #FFE66D">xQueueAddToSet</span><span style="color: #D5CED9">(xQueue2, xQueueSet);                          </span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="queue_select_set" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
xQueueSelectFromSet()
</b>

<p>
xQueueSelectFromSet() blocks for a specified time until a queue or semaphore in a queue set becomes ready, then returns the handle of the ready member. A return value of NULL indicates that the timeout expired before any member became available.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>QueueSetMemberHandle_t xQueueSelectFromSet(QueueSetHandle_t xQueueSet, 
                                           TickType_t const xTicksToWait)

// ---------------------- Example ----------------------

QueueHandle_t xQueueThatContainsData;
xQueueThatContainsData = 
    (QueueHandle_t)xQueueSelectFromSet(xQueueSet, portMAX_DELAY);                                           </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">QueueSetMemberHandle_t </span><span style="color: #FFE66D">xQueueSelectFromSet</span><span style="color: #D5CED9">(QueueSetHandle_t </span><span style="color: #00E8C6">xQueueSet</span><span style="color: #D5CED9">, </span></span>
<span class="line"><span style="color: #D5CED9">                                           TickType_t </span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">xTicksToWait</span><span style="color: #D5CED9">)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// ---------------------- Example ----------------------</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">QueueHandle_t xQueueThatContainsData;</span></span>
<span class="line"><span style="color: #D5CED9">xQueueThatContainsData </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span></span>
<span class="line"><span style="color: #D5CED9">    (QueueHandle_t)</span><span style="color: #FFE66D">xQueueSelectFromSet</span><span style="color: #D5CED9">(xQueueSet, portMAX_DELAY);                                           </span></span></code></pre></div>



<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7194</post-id>	</item>
		<item>
		<title>TI C2000: Hardware Acceleration Subsystem &#8211; Control Law Accelerator (CLA)</title>
		<link>https://hangpersonal.com/2026/06/27/c2000-cla/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Sun, 28 Jun 2026 04:07:15 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=7168</guid>

					<description><![CDATA[TI C2000 Real-Time Microcontroller: Control, Sensing, and Communication Control Law Accelerator (CLA) CLA Memory and Register Access CLA Tasks CLA Registers CLA Initialization CLA Task Programming CLA C Language Implementation and Restrictions CLA Assembly Language Implementation CLA Code Debugging Control Law Accelerator (CLA) The CLA is an independent, fully programmable, 32-bit floating-point math processor. It...]]></description>
										<content:encoded><![CDATA[
<a href="https://hangpersonal.com/embedded-system/ti-mcu/c2000-tutorials/" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
TI C2000 Real-Time Microcontroller: Control, Sensing, and Communication
</a>



<ul style="margin-top:30px; margin-bottom:30px;">

<li style="margin-bottom:16px;">
<a href="#c28x_cla" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
Control Law Accelerator (CLA)
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_cla_memory_register" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
CLA Memory and Register Access
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_cla_task" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
CLA Tasks
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_cla_register" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
CLA Registers
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_cla_init" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
CLA Initialization
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_cla_task_programming" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
CLA Task Programming
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_cla_c_language" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
CLA C Language Implementation and Restrictions
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_cla_assembly" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
CLA Assembly Language Implementation
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_cla_debug" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
CLA Code Debugging
</a>
</li> 

</ul>



<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<b id="c28_cla" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Control Law Accelerator (CLA)
</b>

<p>
The CLA is an independent, fully programmable, 32-bit floating-point math processor. It executes algorithms independently and in parallel with the CPU. This extends the capabilities of the C28x CPU by adding parallel processing. The CLA has direct access to the ADC result registers. Additionally, the CLA has access to all ePWM, high-resolution PWM, eCAP, eQEP, CMPSS, DAC, SDFM, SPI, McBSP, uPP and GPIO data registers. This allows the CLA to read ADC samples just-intime and significantly reduces the ADC sample to output delay enabling faster system response and higher frequency operation. The CLA responds to peripheral interrupts independently of the CPU. Utilizing the CLA for time-critical tasks frees up the CPU to perform other system, diagnostics, and communication functions concurrently.
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="710" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla-1024x710.png" alt="" class="wp-image-7203" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla-1024x710.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla-300x208.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla-768x533.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla-850x590.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla.png 1440w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="732" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_block-1024x732.png" alt="" class="wp-image-7205" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_block-1024x732.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_block-300x215.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_block-768x549.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_block-850x608.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_block.png 1440w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<b id="c28_cla_memory_register" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
CLA Memory and Register Access
</b>

<p>
The CLA has access to the LSx RAM blocks and each memory block can be configured to be either dedicated to the CPU or shared between the CPU and CLA. After reset the memory block is mapped to the CPU, where it can be initialized by the CPU before being shared with the CLA. Once it is shared between the CPU and CLA it then can be configured to be either program memory or data memory. When configured as program memory it contains the CLA program code, and when configured as data memory it contains the variable and coefficients that are used by the CLA program code. Additionally, dedicated message RAMs are used to pass data
between the CPU and CLA, and CLA and CPU.
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_memory_register-1024x771.png" alt="" class="wp-image-7208" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_memory_register-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_memory_register-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_memory_register-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_memory_register-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_memory_register.png 1335w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<b id="c28_cla_task" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
CLA Tasks
</b>

<p>
Programming the CLA consists of initialization code, which is performed by the CPU, and tasks. A task is similar to an interrupt service routine, and once started it runs to completion. Tasks can be written in C or assembly code, where typically the user will use assembly code for high performance time-critical tasks, and C for non-critical tasks. Each task is capable of being triggered by a variety of peripherals without CPU intervention, which makes the CLA very efficient since it does not use interrupts for hardware synchronization, nor must the CLA do any context switching. Unlike the traditional interrupt-based scheme, the CLA approach becomes deterministic. The CLA supports eight independent tasks and each is mapped back to an event
trigger. Since the CLA is a software programmable accelerator, it is very flexible and can be modified for different applications.
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task-1024x771.png" alt="" class="wp-image-7211" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task.png 1335w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="773" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_software_trigger-1024x773.png" alt="" class="wp-image-7213" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_software_trigger-1024x773.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_software_trigger-300x227.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_software_trigger-768x580.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_software_trigger-850x642.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_software_trigger.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="c28_cla_ctrl_exec_register" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:0px;">
CLA Control and Execution Registers
</b>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="769" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-1024x769.png" alt="" class="wp-image-7217" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-1024x769.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-300x225.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-768x577.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-850x639.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register.png 1339w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="c28_cla_register" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:0px;">
CLA Registers
</b>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="793" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_register-1024x793.png" alt="" class="wp-image-7221" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_register-1024x793.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_register-300x232.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_register-768x595.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_register-850x658.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_register.png 1143w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="684" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_register-1024x684.png" alt="" class="wp-image-7223" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_register-1024x684.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_register-300x200.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_register-768x513.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_register-850x568.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_register.png 1241w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="769" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-1-1024x769.png" alt="" class="wp-image-7225" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-1-1024x769.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-1-300x225.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-1-768x577.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-1-850x639.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_ctrl_exec_register-1.png 1339w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="773" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_source_selection_register-1024x773.png" alt="" class="wp-image-7227" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_source_selection_register-1024x773.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_source_selection_register-300x227.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_source_selection_register-768x580.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_source_selection_register-850x642.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_source_selection_register.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="827" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_interrupt_trigger_source-1024x827.png" alt="" class="wp-image-7229" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_interrupt_trigger_source-1024x827.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_interrupt_trigger_source-300x242.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_interrupt_trigger_source-768x620.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_interrupt_trigger_source-850x686.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_task_interrupt_trigger_source.png 1225w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="674" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_interrupt_enable_register-1024x674.png" alt="" class="wp-image-7232" style="width:750px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_interrupt_enable_register-1024x674.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_interrupt_enable_register-300x197.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_interrupt_enable_register-768x505.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_interrupt_enable_register-350x230.png 350w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_interrupt_enable_register-850x559.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_interrupt_enable_register.png 1306w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="c28_cla_init" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
CLA Initialization
</b>

<p>
Set the Specify CLA support project option to <b>cla1</b>
</p>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="770" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init-1024x770.png" alt="" class="wp-image-7236" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init-1024x770.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init-850x639.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="c28_cla_task_programming" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
CLA Task Programming
</b>

<p>
</p><ul>

<li> Can be written in C or assembly code
</li>

<li> Assembly code will give best performance for time-critical tasks
</li>

<li> Writing in assembly may not be so bad
<ul>
<li> CLA programs in floating point
</li>
<li> Often not that much code in a task
</li>
</ul>
</li>

<li> The user will use assembly for critical tasks, and C for non-critical tasks
</li>

</ul>
<p></p>

</div>



<div class="article-text" style="margin-top:40px; margin-bottom:30px;">

<b id="c28_cla_c_language" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
CLA C Language Implementation and Restrictions
</b>


</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="775" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_language-1024x775.png" alt="" class="wp-image-7246" style="width:750px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_language-1024x775.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_language-300x227.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_language-768x581.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_language-850x643.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_language.png 1256w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="739" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_1-1024x739.png" alt="" class="wp-image-7248" style="width:750px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_1-1024x739.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_1-300x216.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_1-768x554.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_1-850x613.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_1.png 1339w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="710" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_2-1024x710.png" alt="" class="wp-image-7249" style="width:750px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_2-1024x710.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_2-300x208.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_2-768x532.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_2-850x589.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_restriction_2.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


            <div  class="spbtbl-wrapper spbtbl-blockmode" >
                                <table class="spbtbl-style spbtbl-color-blue" title="CLAmath"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left"></th><th style="font-size: 18px !important;"  itemprop="name"  align="left"></th><th style="font-size: 18px !important;"  itemprop="name"  align="left"></th><th style="font-size: 18px !important;"  itemprop="name"  align="left"></th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >acos</td>                                    <td style="font-size:18px !important;" itemprop="description" >asin</td>                                    <td style="font-size:18px !important;" itemprop="description" >atan</td>                                    <td style="font-size:18px !important;" itemprop="description" >atan2</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >atan2PU</td>                                    <td style="font-size:18px !important;" itemprop="description" >cos</td>                                    <td style="font-size:18px !important;" itemprop="description" >cosPU</td>                                    <td style="font-size:18px !important;" itemprop="description" >div</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >exp</td>                                    <td style="font-size:18px !important;" itemprop="description" >exp10</td>                                    <td style="font-size:18px !important;" itemprop="description" >exp2</td>                                    <td style="font-size:18px !important;" itemprop="description" >expN</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >isqrt</td>                                    <td style="font-size:18px !important;" itemprop="description" >In</td>                                    <td style="font-size:18px !important;" itemprop="description" >log10</td>                                    <td style="font-size:18px !important;" itemprop="description" >logN</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" >sin</td>                                    <td style="font-size:18px !important;" itemprop="description" >sinPU</td>                                    <td style="font-size:18px !important;" itemprop="description" >sincos</td>                                    <td style="font-size:18px !important;" itemprop="description" >sqrt</td>                            </tr>
                                            </tbody>
                </table>
                            </div>



<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="718" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_compiler_scratchpad-1024x718.png" alt="" class="wp-image-7253" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_compiler_scratchpad-1024x718.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_compiler_scratchpad-300x210.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_compiler_scratchpad-768x538.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_compiler_scratchpad-850x596.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_compiler_scratchpad.png 1290w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="770" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_example-1024x770.png" alt="" class="wp-image-7257" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_example-1024x770.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_example-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_example-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_example-850x639.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_c_example.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:40px; margin-bottom:30px;">

<b id="c28_cla_assembly" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
CLA Assembly Language Implementation
</b>


</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="793" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly-1024x793.png" alt="" class="wp-image-7261" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly-1024x793.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly-300x232.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly-768x595.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly-850x658.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly.png 1183w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_instruction-1024x771.png" alt="" class="wp-image-7263" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_instruction-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_instruction-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_instruction-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_instruction-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_instruction.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_parallel_instruction-1024x771.png" alt="" class="wp-image-7265" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_parallel_instruction-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_parallel_instruction-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_parallel_instruction-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_parallel_instruction-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_parallel_instruction.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="773" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_address_modes-1024x773.png" alt="" class="wp-image-7267" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_address_modes-1024x773.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_address_modes-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_address_modes-768x579.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_address_modes-850x641.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_address_modes.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="769" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_example-1024x769.png" alt="" class="wp-image-7269" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_example-1024x769.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_example-300x225.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_example-768x576.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_example-850x638.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_assembly_example.png 1339w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="773" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init_example-1024x773.png" alt="" class="wp-image-7271" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init_example-1024x773.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init_example-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init_example-768x579.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init_example-850x641.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_init_example.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="c28_cla_debug" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:0px;">
CLA Code Debugging
</b>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="773" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_code_debug-1024x773.png" alt="" class="wp-image-7274" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_code_debug-1024x773.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_code_debug-300x227.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_code_debug-768x580.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_code_debug-850x642.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_cla_code_debug.png 1336w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:60px; margin-bottom:40px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Reference
</b>

<p>
[1] <a href="https://www.ti.com/video/series/c2000-f2837xd-microcontroller-one-day-workshop-series.html" style="color: blue;">
TMS320F2837xD Microcontroller Workshop</a>
</p>

</div>



<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7168</post-id>	</item>
		<item>
		<title>STM32 FreeRTOS: Lists and List Items</title>
		<link>https://hangpersonal.com/2026/06/25/stm32-freertos-list/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Thu, 25 Jun 2026 20:14:37 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=6912</guid>

					<description><![CDATA[STM32 Microcontroller and FreeRTOS Development List &#38; List Item &#38; Mini List Item List: A FreeRTOS list is a doubly linked list used by the kernel to organize tasks and other objects. List Item: A list item is a node that stores a value, links to neighboring items, and can reference its owning object. Mini...]]></description>
										<content:encoded><![CDATA[
<a href="https://hangpersonal.com/embedded-system/stm32-mcu/freertos-tutorials/" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
STM32 Microcontroller and FreeRTOS Development
</a>
<br><br>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


            <div  class="spbtbl-wrapper spbtbl-blockmode spbtbl-fullwidth" >
                                <table class="spbtbl-style spbtbl-color-blue" title="FreeRTOS: List and List Item"  itemscope itemtype="http://schema.org/Table" >
                    <!-- Superb Tables Plugin -->
                    <thead>
                        <tr>
                            <th style="font-size: 18px !important;"  itemprop="name"  align="left">List and List Item API Function</th><th style="font-size: 18px !important;"  itemprop="name"  align="left">Description</th>                        </tr>
                    </thead>
                    <tbody>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#list_init" style="font-size: 20px;color: blue">vListInitialise()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Initializes an empty FreeRTOS list</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#list_init_item" style="font-size: 20px;color: blue">vListInitialiseItem()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Initializes a list item before it is added to a list</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#list_insert" style="font-size: 20px;color: blue">vListInsert()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Inserts a list item in ascending order based on its item value</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#list_insert_end" style="font-size: 20px;color: blue">vListInsertEnd()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Inserts a list item at the end of the list's current traversal position</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#list_remove" style="font-size: 20px;color: blue">uxListRemove()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Removes an item from its list and returns the number of remaining</td>                            </tr>
                        <tr>                                    <td style="font-size:18px !important;" itemprop="description" ><a href="#list_example" style="font-size: 20px;color: blue">vListTask()</a></td>                                    <td style="font-size:18px !important;" itemprop="description" >Example of List</td>                            </tr>
                                            </tbody>
                </table>
                            </div>




<div class="article-text" style="margin-top:20px; margin-bottom:30px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
List &amp; List Item &amp; Mini List Item
</b>

<p>
</p><ul>

<li>
<b>List</b>: A FreeRTOS list is a doubly linked list used by the kernel to organize tasks and other objects.
</li>

<li>
<b>List Item</b>: A list item is a node that stores a value, links to neighboring items, and can reference its owning object.
</li>

<li>
<b>Mini List Item</b>: A mini list item is a simplified list item used as the end marker of a FreeRTOS list.
</li>

</ul>
<p></p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>// List
typedef struct xLIST
{
	listFIRST_LIST_INTEGRITY_CHECK_VALUE				
	volatile UBaseType_t uxNumberOfItems;
	ListItem_t * configLIST_VOLATILE pxIndex;
	MiniListItem_t xListEnd;							
	listSECOND_LIST_INTEGRITY_CHECK_VALUE				
} List_t;

// List Item
struct xLIST_ITEM
{
	listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE			
	configLIST_VOLATILE TickType_t xItemValue;			
	struct xLIST_ITEM * configLIST_VOLATILE pxNext;		
	struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;	
	void * pvOwner;										
	struct xLIST * configLIST_VOLATILE pxContainer;		
	listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE			
};
typedef struct xLIST_ITEM ListItem_t;

// Mini List Item
struct xMINI_LIST_ITEM
{
	listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE			
	configLIST_VOLATILE TickType_t xItemValue;
	struct xLIST_ITEM * configLIST_VOLATILE pxNext;
	struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
};
typedef struct xMINI_LIST_ITEM MiniListItem_t;</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #A0A1A7CC">// List</span></span>
<span class="line"><span style="color: #C74DED">typedef</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xLIST</span></span>
<span class="line"><span style="color: #D5CED9">{</span></span>
<span class="line"><span style="color: #D5CED9">	listFIRST_LIST_INTEGRITY_CHECK_VALUE				</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">volatile</span><span style="color: #D5CED9"> UBaseType_t uxNumberOfItems;</span></span>
<span class="line"><span style="color: #D5CED9">	ListItem_t </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> configLIST_VOLATILE pxIndex;</span></span>
<span class="line"><span style="color: #D5CED9">	MiniListItem_t xListEnd;							</span></span>
<span class="line"><span style="color: #D5CED9">	listSECOND_LIST_INTEGRITY_CHECK_VALUE				</span></span>
<span class="line"><span style="color: #D5CED9">} List_t;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// List Item</span></span>
<span class="line"><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xLIST_ITEM</span></span>
<span class="line"><span style="color: #D5CED9">{</span></span>
<span class="line"><span style="color: #D5CED9">	listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE			</span></span>
<span class="line cbp-see-more-line "><span style="color: #D5CED9">	configLIST_VOLATILE TickType_t xItemValue;			</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xLIST_ITEM </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> configLIST_VOLATILE pxNext;		</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xLIST_ITEM </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> configLIST_VOLATILE pxPrevious;	</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> pvOwner;										</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xLIST </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> configLIST_VOLATILE pxContainer;		</span></span>
<span class="line"><span style="color: #D5CED9">	listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE			</span></span>
<span class="line"><span style="color: #D5CED9">};</span></span>
<span class="line"><span style="color: #C74DED">typedef</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xLIST_ITEM ListItem_t;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">// Mini List Item</span></span>
<span class="line"><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xMINI_LIST_ITEM</span></span>
<span class="line"><span style="color: #D5CED9">{</span></span>
<span class="line"><span style="color: #D5CED9">	listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE			</span></span>
<span class="line"><span style="color: #D5CED9">	configLIST_VOLATILE TickType_t xItemValue;</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xLIST_ITEM </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> configLIST_VOLATILE pxNext;</span></span>
<span class="line"><span style="color: #D5CED9">	</span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xLIST_ITEM </span><span style="color: #EE5D43">*</span><span style="color: #D5CED9"> configLIST_VOLATILE pxPrevious;</span></span>
<span class="line"><span style="color: #D5CED9">};</span></span>
<span class="line"><span style="color: #C74DED">typedef</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">struct</span><span style="color: #D5CED9"> xMINI_LIST_ITEM MiniListItem_t;</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="list_init" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
vListInitialise()
</b>

<p>
vListInitialise() prepares a List_t structure for use by clearing its item count, setting the list index to the end marker, and linking the mini list item to itself. After initialization, the list is empty and ready to accept list items.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>List_t TestList;
vListInitialise(&amp;TestList);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">List_t TestList;</span></span>
<span class="line"><span style="color: #FFE66D">vListInitialise</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="list_init_item" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
vListInitialiseItem()
</b>

<p>
vListInitialiseItem() prepares a ListItem_t structure for use by setting its owner pointer to NULL. After initialization, the list item is ready to be assigned an owner and inserted into a FreeRTOS list.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>ListItem_t ListItem1;
vListInitialiseItem(&amp;ListItem1);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">ListItem_t ListItem1;</span></span>
<span class="line"><span style="color: #FFE66D">vListInitialiseItem</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="list_insert" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
vListInsert()
</b>

<p>
vListInsert() inserts a list item into a FreeRTOS list in ascending order based on the item’s value. It updates the neighboring links, assigns the list as the item’s container, and increases the number of items in the list.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>List_t TestList;
ListItem_t ListItem1;
ListItem1.xItemValue = 40;
vListInitialise(&amp;TestList);
vListInitialiseItem(&amp;ListItem1);
vListInsert(&amp;TestList, &amp;ListItem1);</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">List_t TestList;</span></span>
<span class="line"><span style="color: #D5CED9">ListItem_t ListItem1;</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1.xItemValue </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">40</span><span style="color: #D5CED9">;</span></span>
<span class="line"><span style="color: #FFE66D">vListInitialise</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #FFE66D">vListInitialiseItem</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #FFE66D">vListInsert</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">, </span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">);</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="list_insert_end" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
vListInsertEnd()
</b>

<p>
vListInsertEnd() inserts a list item immediately before the list’s current index position. It updates the neighboring links, sets the item’s container pointer, and increases the list’s item count.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>List_t TestList;
ListItem_t ListItem1;
ListItem1.xItemValue = 40;
vListInitialise(&amp;TestList);
vListInitialiseItem(&amp;ListItem1);
vListInsertEnd(&amp;TestList, &amp;ListItem1); </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">List_t TestList;</span></span>
<span class="line"><span style="color: #D5CED9">ListItem_t ListItem1;</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1.xItemValue </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">40</span><span style="color: #D5CED9">;</span></span>
<span class="line"><span style="color: #FFE66D">vListInitialise</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #FFE66D">vListInitialiseItem</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #FFE66D">vListInsertEnd</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">, </span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">); </span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="list_remove" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
uxListRemove()
</b>

<p>
uxListRemove() removes a list item from its current FreeRTOS list, reconnects the neighboring items, clears the item’s container pointer, and decreases the list’s item count. It returns the number of items remaining in the list.
</p>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>uxListRemove(&amp;ListItem1); </textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #FFE66D">uxListRemove</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">); </span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b id="list_example" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:0px;">
Example: vListTask()
</b>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(3 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>List_t TestList;
ListItem_t ListItem1;
ListItem_t ListItem2;
ListItem_t ListItem3;

#define LIST_TASK_PRIO		3
#define LIST_STK_SIZE 		256
TaskHandle_t LISTTask_Handler;

xTaskCreate((TaskFunction_t ) vListTask,
            (const char*    ) "List Task",
            (uint16_t       ) LIST_STK_SIZE,
            (void*          ) NULL,
            (UBaseType_t    ) LIST_TASK_PRIO,
            (TaskHandle_t*  ) &amp;LISTTask_Handler);
            
void vListTask(void *pvParameters) {

  	vListInitialise(&amp;TestList);
  	vListInitialiseItem(&amp;ListItem1);
  	vListInitialiseItem(&amp;ListItem2);
  	vListInitialiseItem(&amp;ListItem3);
  
  	ListItem1.xItemValue = 40;
  	ListItem2.xItemValue = 60;
  	ListItem3.xItemValue = 50;

  	printf("/************** List &amp; List Item **************/\r\n");
  	printf("TestList                %#x	  \r\n",(int)&amp;TestList);
  	printf("TestList item number    %d    \r\n",(int)TestList.uxNumberOfItems);
  	printf("TestList->pxIndex       %#x	  \r\n",(int)TestList.pxIndex);
  	printf("TestList->xListEnd      %#x	  \r\n",(int)(&amp;TestList.xListEnd)); 
  	printf("ListItem1               %#x	  \r\n",(int)&amp;ListItem1);
  	printf("ListItem2               %#x	  \r\n",(int)&amp;ListItem2);
  	printf("ListItem3               %#x	  \r\n",(int)&amp;ListItem3);
  	printf("\r\n");
  
  	vListInsert(&amp;TestList, &amp;ListItem1); 
  	printf("/**************** Add ListItem1 ***************/\r\n");
  	printf("TestList item number              %d    \r\n",(int)TestList.uxNumberOfItems);
  	printf("TestList->xListEnd->pxNext        %#x	  \r\n",(int)(TestList.xListEnd.pxNext));     
  	printf("ListItem1->pxNext                 %#x	  \r\n",(int)(ListItem1.pxNext));             
  	printf("TestList->xListEnd->pxPrevious    %#x	  \r\n",(int)(TestList.xListEnd.pxPrevious)); 
  	printf("ListItem1->pxPrevious             %#x   \r\n",(int)(ListItem1.pxPrevious));         
  	printf("\r\n");
  
  	vListInsert(&amp;TestList, &amp;ListItem2); 
  	printf("/**************** Add ListItem2 ***************/\r\n");
  	printf("TestList item number              %d    \r\n",(int)TestList.uxNumberOfItems);
  	printf("TestList->xListEnd->pxNext        %#x	  \r\n",(int)(TestList.xListEnd.pxNext));     
  	printf("ListItem1->pxNext                 %#x	  \r\n",(int)(ListItem1.pxNext));             
  	printf("ListItem2->pxNext                 %#x	  \r\n",(int)(ListItem2.pxNext));             
  	printf("TestList->xListEnd->pxPrevious    %#x	  \r\n",(int)(TestList.xListEnd.pxPrevious)); 
  	printf("ListItem1->pxPrevious             %#x	  \r\n",(int)(ListItem1.pxPrevious));         
  	printf("ListItem2->pxPrevious             %#x   \r\n",(int)(ListItem2.pxPrevious));        
  	printf("\r\n");
  
  	vListInsert(&amp;TestList, &amp;ListItem3); 
  	printf("/**************** Add ListItem3 ***************/\r\n");
  	printf("TestList item number              %d    \r\n",(int)TestList.uxNumberOfItems);
  	printf("TestList->xListEnd->pxNext        %#x	  \r\n",(int)(TestList.xListEnd.pxNext));     
  	printf("ListItem1->pxNext                 %#x	  \r\n",(int)(ListItem1.pxNext));             
  	printf("ListItem3->pxNext                 %#x	  \r\n",(int)(ListItem3.pxNext));             
  	printf("ListItem2->pxNext                 %#x	  \r\n",(int)(ListItem2.pxNext));             
  	printf("TestList->xListEnd->pxPrevious    %#x	  \r\n",(int)(TestList.xListEnd.pxPrevious)); 
  	printf("ListItem1->pxPrevious             %#x	  \r\n",(int)(ListItem1.pxPrevious));        
  	printf("ListItem3->pxPrevious             %#x	  \r\n",(int)(ListItem3.pxPrevious));        
  	printf("ListItem2->pxPrevious             %#x   \r\n",(int)(ListItem2.pxPrevious));         
  	printf("\r\n");
  
  	uxListRemove(&amp;ListItem2); 
  	printf("/************** Delete ListItem2 *************/\r\n");
  	printf("TestList item number              %d    \r\n",(int)TestList.uxNumberOfItems);
  	printf("TestList->xListEnd->pxNext        %#x	  \r\n",(int)(TestList.xListEnd.pxNext));     
  	printf("ListItem1->pxNext                 %#x	  \r\n",(int)(ListItem1.pxNext));             
  	printf("ListItem3->pxNext                 %#x	  \r\n",(int)(ListItem3.pxNext));             
  	printf("TestList->xListEnd->pxPrevious    %#x	  \r\n",(int)(TestList.xListEnd.pxPrevious)); 
  	printf("ListItem1->pxPrevious             %#x	  \r\n",(int)(ListItem1.pxPrevious));        
  	printf("ListItem3->pxPrevious             %#x   \r\n",(int)(ListItem3.pxPrevious));         
  	printf("\r\n");
  
  	TestList.pxIndex = TestList.pxIndex->pxNext; 	
  	vListInsertEnd(&amp;TestList, &amp;ListItem2); 
  	printf("/*********** InsertEnd ListItem2 ************/\r\n");
  	printf("TestList->pxIndex                 %#x	  \r\n",(int)TestList.pxIndex);               
  	printf("TestList item number              %d    \r\n",(int)TestList.uxNumberOfItems);
  	printf("TestList->xListEnd->pxNext        %#x	  \r\n",(int)(TestList.xListEnd.pxNext));     
  	printf("ListItem2->pxNext                 %#x	  \r\n",(int)(ListItem2.pxNext));             
  	printf("ListItem1->pxNext                 %#x   \r\n",(int)(ListItem1.pxNext));             
  	printf("ListItem3->pxNext                 %#x	  \r\n",(int)(ListItem3.pxNext));             
  	printf("TestList->xListEnd->pxPrevious    %#x	  \r\n",(int)(TestList.xListEnd.pxPrevious)); 
  	printf("ListItem2->pxPrevious             %#x	  \r\n",(int)(ListItem2.pxPrevious));       
  	printf("ListItem1->pxPrevious             %#x	  \r\n",(int)(ListItem1.pxPrevious));         
  	printf("ListItem3->pxPrevious             %#x   \r\n",(int)(ListItem3.pxPrevious));         
  	printf("\r\n");

    while(1) {
    	  HAL_GPIO_TogglePin(GPIOD, RED);
        vTaskDelay(_500ms);
    }

}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #D5CED9">List_t TestList;</span></span>
<span class="line"><span style="color: #D5CED9">ListItem_t ListItem1;</span></span>
<span class="line"><span style="color: #D5CED9">ListItem_t ListItem2;</span></span>
<span class="line"><span style="color: #D5CED9">ListItem_t ListItem3;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">LIST_TASK_PRIO</span><span style="color: #D5CED9">		</span><span style="color: #F39C12">3</span></span>
<span class="line"><span style="color: #C74DED">#define</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">LIST_STK_SIZE</span><span style="color: #D5CED9"> 		</span><span style="color: #F39C12">256</span></span>
<span class="line"><span style="color: #D5CED9">TaskHandle_t LISTTask_Handler;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #FFE66D">xTaskCreate</span><span style="color: #D5CED9">((TaskFunction_t ) </span><span style="color: #00E8C6">vListTask</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">            (</span><span style="color: #C74DED">const</span><span style="color: #D5CED9"> </span><span style="color: #C74DED">char</span><span style="color: #EE5D43">*</span><span style="color: #D5CED9">    ) </span><span style="color: #96E072">&quot;List Task&quot;</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">            (</span><span style="color: #C74DED">uint16_t</span><span style="color: #D5CED9">       ) </span><span style="color: #00E8C6">LIST_STK_SIZE</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">            (</span><span style="color: #C74DED">void</span><span style="color: #EE5D43">*</span><span style="color: #D5CED9">          ) </span><span style="color: #00E8C6">NULL</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">            (UBaseType_t    ) </span><span style="color: #00E8C6">LIST_TASK_PRIO</span><span style="color: #D5CED9">,</span></span>
<span class="line"><span style="color: #D5CED9">            (TaskHandle_t</span><span style="color: #EE5D43">*</span><span style="color: #D5CED9">  ) </span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">LISTTask_Handler</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">            </span></span>
<span class="line"><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #FFE66D">vListTask</span><span style="color: #D5CED9">(</span><span style="color: #C74DED">void</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">*</span><span style="color: #00E8C6">pvParameters</span><span style="color: #D5CED9">) {</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">vListInitialise</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">TestList);</span></span>
<span class="line cbp-see-more-line "><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">vListInitialiseItem</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem1);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">vListInitialiseItem</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem2);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">vListInitialiseItem</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem3);</span></span>
<span class="line"><span style="color: #D5CED9">  </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xItemValue</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">40</span><span style="color: #D5CED9">;</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #00E8C6">ListItem2</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xItemValue</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">60</span><span style="color: #D5CED9">;</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #00E8C6">ListItem3</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xItemValue</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #F39C12">50</span><span style="color: #D5CED9">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;/************** List &amp; List Item **************/</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList                </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">TestList);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList item number    </span><span style="color: #EE5D43">%d</span><span style="color: #96E072">    </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">uxNumberOfItems</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;pxIndex       </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxIndex</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd      </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #EE5D43">&amp;</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">)); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1               </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem1);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem2               </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem2);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem3               </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem3);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">vListInsert</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">TestList, </span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem1); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;/**************** Add ListItem1 ***************/</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList item number              </span><span style="color: #EE5D43">%d</span><span style="color: #96E072">    </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">uxNumberOfItems</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxNext        </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));     </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxPrevious    </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">)); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">   </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));         </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">vListInsert</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">TestList, </span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem2); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;/**************** Add ListItem2 ***************/</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList item number              </span><span style="color: #EE5D43">%d</span><span style="color: #96E072">    </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">uxNumberOfItems</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxNext        </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));     </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem2-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem2</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxPrevious    </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">)); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));         </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem2-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">   </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem2</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));        </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">vListInsert</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">TestList, </span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem3); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;/**************** Add ListItem3 ***************/</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList item number              </span><span style="color: #EE5D43">%d</span><span style="color: #96E072">    </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">uxNumberOfItems</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxNext        </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));     </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem3-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem3</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem2-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem2</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxPrevious    </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">)); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));        </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem3-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem3</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));        </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem2-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">   </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem2</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));         </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">uxListRemove</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem2); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;/************** Delete ListItem2 *************/</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList item number              </span><span style="color: #EE5D43">%d</span><span style="color: #96E072">    </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">uxNumberOfItems</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxNext        </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));     </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem3-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem3</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxPrevious    </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">)); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));        </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem3-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">   </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem3</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));         </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxIndex</span><span style="color: #D5CED9"> </span><span style="color: #EE5D43">=</span><span style="color: #D5CED9"> </span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxIndex</span><span style="color: #D5CED9">-&gt;</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">; 	</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">vListInsertEnd</span><span style="color: #D5CED9">(</span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">TestList, </span><span style="color: #EE5D43">&amp;</span><span style="color: #D5CED9">ListItem2); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;/*********** InsertEnd ListItem2 ************/</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;pxIndex                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxIndex</span><span style="color: #D5CED9">);               </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList item number              </span><span style="color: #EE5D43">%d</span><span style="color: #96E072">    </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">uxNumberOfItems</span><span style="color: #D5CED9">);</span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxNext        </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));     </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem2-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem2</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">   </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem3-&gt;pxNext                 </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem3</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxNext</span><span style="color: #D5CED9">));             </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;TestList-&gt;xListEnd-&gt;pxPrevious    </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">TestList</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">xListEnd</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">)); </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem2-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem2</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));       </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem1-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">	  </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem1</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));         </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;ListItem3-&gt;pxPrevious             </span><span style="color: #EE5D43">%#x</span><span style="color: #96E072">   </span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">,(</span><span style="color: #C74DED">int</span><span style="color: #D5CED9">)(</span><span style="color: #00E8C6">ListItem3</span><span style="color: #D5CED9">.</span><span style="color: #00E8C6">pxPrevious</span><span style="color: #D5CED9">));         </span></span>
<span class="line"><span style="color: #D5CED9">  	</span><span style="color: #FFE66D">printf</span><span style="color: #D5CED9">(</span><span style="color: #96E072">&quot;</span><span style="color: #EE5D43">\r\n</span><span style="color: #96E072">&quot;</span><span style="color: #D5CED9">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">    </span><span style="color: #C74DED">while</span><span style="color: #D5CED9">(</span><span style="color: #F39C12">1</span><span style="color: #D5CED9">) {</span></span>
<span class="line"><span style="color: #D5CED9">    	  </span><span style="color: #FFE66D">HAL_GPIO_TogglePin</span><span style="color: #D5CED9">(GPIOD, RED);</span></span>
<span class="line"><span style="color: #D5CED9">        </span><span style="color: #FFE66D">vTaskDelay</span><span style="color: #D5CED9">(_500ms);</span></span>
<span class="line"><span style="color: #D5CED9">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D5CED9">}</span></span></code></pre></div>



<div class="article-text" style="margin-top:50px; margin-bottom:30px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:0px;">
Results
</b>

</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>/************** List &amp; List Item **************/
TestList                          0x20000254
TestList item number              0
TestList->pxIndex                 0x2000025c
TestList->xListEnd                0x2000025c
ListItem1                         0x20000268
ListItem2                         0x2000027c
ListItem3                         0x20000290

/**************** Add ListItem1 ***************/
TestList item number              1
TestList->xListEnd->pxNext        0x20000268
ListItem1->pxNext                 0x2000025c
TestList->xListEnd->pxPrevious    0x20000268
ListItem1->pxPrevious             0x2000025c</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #A0A1A7CC">/************** List &amp; List Item **************/</span></span>
<span class="line"><span style="color: #D5CED9">TestList                          </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000254</span></span>
<span class="line"><span style="color: #D5CED9">TestList item number              </span><span style="color: #F39C12">0</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxIndex                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd                </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1                         </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span>
<span class="line"><span style="color: #D5CED9">ListItem2                         </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000027c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem3                         </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000290</span></span>
<span class="line"></span>
<span class="line"><span style="color: #A0A1A7CC">/**************** Add ListItem1 ***************/</span></span>
<span class="line"><span style="color: #D5CED9">TestList item number              </span><span style="color: #F39C12">1</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext        </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious    </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span></code></pre></div>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="290" src="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex1-1024x290.png" alt="" class="wp-image-6934" style="width:530px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex1-1024x290.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex1-300x85.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex1-768x218.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex1-1536x436.png 1536w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex1-2048x581.png 2048w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex1-850x241.png 850w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>/**************** Add ListItem2 ***************/
TestList item number              2
TestList->xListEnd->pxNext        0x20000268
ListItem1->pxNext                 0x2000027c
ListItem2->pxNext                 0x2000025c
TestList->xListEnd->pxPrevious    0x2000027c
ListItem1->pxPrevious             0x2000025c
ListItem2->pxPrevious             0x20000268</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #A0A1A7CC">/**************** Add ListItem2 ***************/</span></span>
<span class="line"><span style="color: #D5CED9">TestList item number              </span><span style="color: #F39C12">2</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext        </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000027c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem2</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious    </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000027c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem2</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span></code></pre></div>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="229" src="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex2-1024x229.png" alt="" class="wp-image-6938" style="width:650px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex2-1024x229.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex2-300x67.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex2-768x172.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex2-1536x344.png 1536w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex2-850x190.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex2.png 1909w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>/**************** Add ListItem3 ***************/
TestList item number              3
TestList->xListEnd->pxNext        0x20000268
ListItem1->pxNext                 0x20000290
ListItem3->pxNext                 0x2000027c
ListItem2->pxNext                 0x2000025c
TestList->xListEnd->pxPrevious    0x2000027c
ListItem1->pxPrevious             0x2000025c
ListItem3->pxPrevious             0x20000268
ListItem2->pxPrevious             0x20000290</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #A0A1A7CC">/**************** Add ListItem3 ***************/</span></span>
<span class="line"><span style="color: #D5CED9">TestList item number              </span><span style="color: #F39C12">3</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext        </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000290</span></span>
<span class="line"><span style="color: #D5CED9">ListItem3</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000027c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem2</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious    </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000027c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem3</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span>
<span class="line"><span style="color: #D5CED9">ListItem2</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000290</span></span></code></pre></div>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="154" src="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex3-1024x154.png" alt="" class="wp-image-6946" style="object-fit:cover" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex3-1024x154.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex3-300x45.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex3-768x116.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex3-1536x231.png 1536w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex3-2048x309.png 2048w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex3-850x128.png 850w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(1 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>/************** Delete ListItem2 *************/
TestList item number              2
TestList->xListEnd->pxNext        0x20000268
ListItem1->pxNext                 0x20000290
ListItem3->pxNext                 0x2000025c
TestList->xListEnd->pxPrevious    0x20000290
ListItem1->pxPrevious             0x2000025c
ListItem3->pxPrevious             0x20000268</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #A0A1A7CC">/************** Delete ListItem2 *************/</span></span>
<span class="line"><span style="color: #D5CED9">TestList item number              </span><span style="color: #F39C12">2</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext        </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000290</span></span>
<span class="line"><span style="color: #D5CED9">ListItem3</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious    </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000290</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem3</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span></code></pre></div>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="176" src="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex4-1024x176.png" alt="" class="wp-image-6956" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex4-1024x176.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex4-300x52.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex4-768x132.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex4-1536x264.png 1536w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex4-850x146.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex4.png 2042w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D5CED9;--cbp-line-number-width:calc(2 * 0.6 * 1rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D5CED9;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>/*********** InsertEnd ListItem2 ************/
TestList->pxIndex                 0x20000268
TestList item number              3
TestList->xListEnd->pxNext        0x2000027c
ListItem2->pxNext                 0x20000268
ListItem1->pxNext                 0x20000290
ListItem3->pxNext                 0x2000025c
TestList->xListEnd->pxPrevious    0x20000290
ListItem2->pxPrevious             0x2000025c
ListItem1->pxPrevious             0x2000027c
ListItem3->pxPrevious             0x20000268</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki andromeda" style="background-color: #23262E" tabindex="0"><code><span class="line"><span style="color: #A0A1A7CC">/*********** InsertEnd ListItem2 ************/</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxIndex                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span>
<span class="line"><span style="color: #D5CED9">TestList item number              </span><span style="color: #F39C12">3</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext        </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000027c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem2</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000290</span></span>
<span class="line"><span style="color: #D5CED9">ListItem3</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxNext                 </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">TestList</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">xListEnd</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious    </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000290</span></span>
<span class="line"><span style="color: #D5CED9">ListItem2</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000025c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem1</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">2000027c</span></span>
<span class="line"><span style="color: #D5CED9">ListItem3</span><span style="color: #EE5D43">-&gt;</span><span style="color: #D5CED9">pxPrevious             </span><span style="color: #C74DED">0x</span><span style="color: #F39C12">20000268</span></span></code></pre></div>



<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="135" src="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex5-1024x135.png" alt="" class="wp-image-6960" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex5-1024x135.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex5-300x40.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex5-768x101.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex5-1536x202.png 1536w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex5-2048x270.png 2048w, https://hangpersonal.com/wp-content/uploads/2026/06/freertos_list_ex5-850x112.png 850w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">6912</post-id>	</item>
		<item>
		<title>TI C2000: Hardware Acceleration Subsystem &#8211; Direct Memory Access (DMA)</title>
		<link>https://hangpersonal.com/2026/06/25/c2000-dma/</link>
		
		<dc:creator><![CDATA[hangcui1201]]></dc:creator>
		<pubDate>Thu, 25 Jun 2026 17:58:56 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://hangpersonal.com/?p=6837</guid>

					<description><![CDATA[TI C2000 Real-Time Microcontroller: Control, Sensing, and Communication Direct Memory Access (DMA) DMA Operation DMA Example DMA Channel Priority Modes DMA Throughput DMA Registers Direct Memory Access (DMA) The DMA module provides a hardware method of transferring data between peripherals and/or memory without intervention from the CPU, effectively freeing up the CPU for other functions....]]></description>
										<content:encoded><![CDATA[
<a href="https://hangpersonal.com/embedded-system/ti-mcu/c2000-tutorials/" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
TI C2000 Real-Time Microcontroller: Control, Sensing, and Communication
</a>



<ul style="margin-top:30px; margin-bottom:30px;">

<li style="margin-bottom:16px;">
<a href="#c28x_dma" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
Direct Memory Access (DMA)
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_dma_operation" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
DMA Operation
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_dma_example" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
DMA Example
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_dma_channel_priority_modes" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
DMA Channel Priority Modes
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_dma_throughput" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
DMA Throughput
</a>
</li> 

<li style="margin-bottom:16px;">
<a href="#c28_dma_register" style="font-family: 'Inter', sans-serif; font-size: 22px; color: blue;">
DMA Registers
</a>
</li> 


</ul>



<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<b id="c28_dma" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Direct Memory Access (DMA)
</b>

<p>
The DMA module provides a hardware method of transferring data between peripherals and/or memory without intervention from the CPU, effectively freeing up the CPU for other functions. Each CPU subsystem has its own DMA and using the DMA is ideal when an application requires a significant amount of time spent moving large amounts of data from off-chip memory to on-chip memory, or from a peripheral such as the ADC result register to a memory RAM block, or between two peripherals. Additionally, the DMA is capable of rearranging the data for optimal CPU processing such as binning and ping-pong buffering.
</p>

<p>
Specifically, the DMA can read data from the ADC result registers, transfer to or from memory blocks G0 through G15, IPC RAM, EMIF, transfer to or from the McBSP and SPI, and also modify registers in the ePWM. A DMA transfer is started by a peripheral or software trigger. There are six independent DMA channels, where each channel can be configured individually and each DMA channel has its own unique PIE interrupt for CPU servicing. All six DMA channels operate the same way, except channel 1 can be configured at a higher priority over the other five channels. At its most basic level the DMA is a state machine consisting of two nested loops and
tightly coupled address control logic which gives the DMA the capability to rearrange the blocks of data during the transfer for post processing. When a DMA transfers is completed, the DMA can generate an interrupt.
</p>


</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma-1024x771.png" alt="" class="wp-image-6845" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_cla-1024x771.png" alt="" class="wp-image-6847" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_cla-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_cla-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_cla-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_cla-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_cla.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<b id="c28_dma_operation" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
DMA Operation
</b>

<p>
</p><ul>

<li> Word
<ul>
<li> 16 or 32 bits
</li>
<li> Word size is configurable per DMA channel
</li>
</ul>
</li>

<li> Burst
<ul>
<li> Consists of multiple words</li>
<li> Smallest amount of data transferred at one time
</li>
</ul>
</li>

<li> Burst Size
<ul>
<li> Number of words per burst
</li>
<li> Specified by BURST_SIZE register
<ul>
<li> 5-bit N-1 value (maximum of 32 words/burst)
</li>
</ul>
</li>
</ul>
</li>

<li> Transfer
<ul>
<li> Consists of multiple bursts
</li>
</ul>
</li>

<li> Transfer Size
<ul>
<li> Number of bursts per transfer
</li>
<li> Specified by TRANSFER_SIZE register
<ul>
<li> 16-bit N-1 value &#8211; exceeds any practical requirements
</li>
</ul>
</li>
</ul>
</li>


</ul>
<p></p>




</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="831" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_state_machine_op-1024x831.png" alt="" class="wp-image-6852" style="width:650px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_state_machine_op-1024x831.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_state_machine_op-300x244.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_state_machine_op-768x623.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_state_machine_op-850x690.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_state_machine_op.png 1163w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="790" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_addr_ctrl_register-1024x790.png" alt="" class="wp-image-6854" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_addr_ctrl_register-1024x790.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_addr_ctrl_register-300x231.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_addr_ctrl_register-768x592.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_addr_ctrl_register-850x656.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_addr_ctrl_register.png 1176w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_interrupt-1024x771.png" alt="" class="wp-image-6858" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_interrupt-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_interrupt-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_interrupt-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_interrupt-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_interrupt.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<b id="c28_dma_example" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
DMA Example
</b>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_example-1024x771.png" alt="" class="wp-image-6864" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_example-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_example-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_example-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_example-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_example.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="742" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_data_binning_ex-1024x742.png" alt="" class="wp-image-6866" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_data_binning_ex-1024x742.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_data_binning_ex-300x217.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_data_binning_ex-768x556.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_data_binning_ex-850x616.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_data_binning_ex.png 1307w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ex_register_setup-1024x771.png" alt="" class="wp-image-6869" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ex_register_setup-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ex_register_setup-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ex_register_setup-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ex_register_setup-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ex_register_setup.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="755" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_ex-1024x755.png" alt="" class="wp-image-6870" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_ex-1024x755.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_ex-300x221.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_ex-768x566.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_ex-850x627.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_ex.png 1240w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="772" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_setup-1024x772.png" alt="" class="wp-image-6872" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_setup-1024x772.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_setup-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_setup-768x579.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_setup-850x641.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ping_pong_buffer_setup.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<b id="c28_dma_channel_priority_modes" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
DMA Channel Priority Modes
</b>

</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="694" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_channel_priority_modes-1024x694.png" alt="" class="wp-image-6874" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_channel_priority_modes-1024x694.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_channel_priority_modes-300x203.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_channel_priority_modes-768x521.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_channel_priority_modes-850x576.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_channel_priority_modes.png 1317w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="795" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_priority_modes_state_machine-1024x795.png" alt="" class="wp-image-6875" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_priority_modes_state_machine-1024x795.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_priority_modes_state_machine-300x233.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_priority_modes_state_machine-768x596.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_priority_modes_state_machine-850x660.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_priority_modes_state_machine.png 1241w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<b id="c28_dma_throughput" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
DMA Throughput
</b>

<p>

<ul>

<li> 4 cycles/word (5 for McBSP reads)
</li>

<li> 1 cycle delay to start each burst
</li>

<li> 1 cycle delay returning from CH1 high priority interrupt
</li>

<li> 32-bit transfer doubles throughput (except McBSP, which supports 16-bit transfers only)
</li>

</ul>

</p>




</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="307" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_throughput-1024x307.png" alt="" class="wp-image-6882" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_throughput-1024x307.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_throughput-300x90.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_throughput-768x230.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_throughput-850x255.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_throughput.png 1232w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<p>

<ul>

<li> DMA has priority over CPU
<ul>
<li> If a multi-cycle CPU access is already in progress, DMA stalls until current CPU access finishes
</li>
<li> The DMA will interrupt back-to-back CPU accesses
</li>
</ul>
</li>

<li> Can the CPU be locked out?
<ul>
<li> Generally no
</li>
<li> DMA is multi-cycle transfer; CPU will sneak in an access when the DMA is accessing the other end of the transfer (e.g. while DMA accesses destination location, the CPU can access the source location)
</li>
</ul>
</li>

</ul>

</p>


</div>



<div class="article-text" style="margin-top:50px; margin-bottom:40px;">

<b id="c28_dma_register" style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
DMA Registers
</b>



</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_registers-1024x771.png" alt="" class="wp-image-6889" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_registers-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_registers-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_registers-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_registers-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_registers.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="651" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_register-1024x651.png" alt="" class="wp-image-6891" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_register-1024x651.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_register-300x191.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_register-768x488.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_register-850x541.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_register.png 1269w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="545" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_pri_ctrl_register-1024x545.png" alt="" class="wp-image-6892" style="width:700px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_pri_ctrl_register-1024x545.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_pri_ctrl_register-300x160.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_pri_ctrl_register-768x409.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_pri_ctrl_register-850x452.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_pri_ctrl_register.png 1268w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="744" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_mode_register-1024x744.png" alt="" class="wp-image-6894" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_mode_register-1024x744.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_mode_register-300x218.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_mode_register-768x558.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_mode_register-850x618.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_mode_register.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_trigger_source_selection_register-1024x771.png" alt="" class="wp-image-6896" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_trigger_source_selection_register-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_trigger_source_selection_register-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_trigger_source_selection_register-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_trigger_source_selection_register-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_trigger_source_selection_register.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_peri_interrupt_trigger_source-1024x771.png" alt="" class="wp-image-6907" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_peri_interrupt_trigger_source-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_peri_interrupt_trigger_source-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_peri_interrupt_trigger_source-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_peri_interrupt_trigger_source-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_peri_interrupt_trigger_source.png 1442w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:30px; margin-bottom:40px;">
</div>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="771" src="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_reg-1024x771.png" alt="" class="wp-image-6904" style="width:800px" srcset="https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_reg-1024x771.png 1024w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_reg-300x226.png 300w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_reg-768x578.png 768w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_reg-850x640.png 850w, https://hangpersonal.com/wp-content/uploads/2026/06/c28_dma_ctrl_reg.png 1365w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<div class="article-text" style="margin-top:60px; margin-bottom:40px;">

<b style="display:block;
          font-family: 'Inter', sans-serif; 
          font-size: 22px; 
          color: black; 
          margin-top:0px; 
          margin-bottom:20px;">
Reference
</b>

<p>
[1] <a href="https://www.ti.com/video/series/c2000-f2837xd-microcontroller-one-day-workshop-series.html" style="color: blue;">
TMS320F2837xD Microcontroller Workshop</a>
</p>

</div>



<br><br>
<a href="#top" style="font-size:20px; color: blue;">Back to top of the page</a>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">6837</post-id>	</item>
	</channel>
</rss>
