Skip to content

Task Priorities

This document describes the thread priorities configured in the RTK Base firmware.

Priority Overview

Tasks are assigned priorities using FreeRTOS priority levels (0-24, where higher numbers = higher priority).

Task List

Task Name Status Prio HWM Task# CPU Description
esp_timer B 22/22 3788 1 0 ESP-IDF timer service
ipc0 B 24/24 428 2 0 Inter-processor communication (CPU0)
ipc1 B 24/24 396 3 1 Inter-processor communication (CPU1)
main R 1/1 332 5 0 Main application loop
IDLE0 R 0/0 924 6 0 Idle task (CPU0)
IDLE1 R 0/0 924 7 1 Idle task (CPU1)
Tmr Svc B 1/1 1132 8 0 FreeRTOS timer service
tiT B 18/18 3112 12 0 TCP/IP task
sys_evt B 20/20 1420 13 0 System event handler
long_work B 1/1 12844 14 x Long-running background work
debug_task_core B 10/10 1988 15 1 Debug output task
uart_msg_manage B 16/16 1036 16 1 UART message management
wifi B 23/23 2988 17 0 WiFi driver task
emac_rx S 15/15 3128 18 x Ethernet MAC receive
httpd B 23/23 4900 19 x HTTP server
uart-tcp B 5/5 1308 20 x UART-TCP bridge
periodic_task B 10/10 3252 21 x Periodic maintenance
ZedMainTask B 23/23 1480 22 x ZED GNSS main task
mqtt_task B 5/5 2236 23 x MQTT client task

Legend: - Status: R = Running, B = Blocked, S = Suspended - Prio: Current / Base priority - HWM: High Water Mark (stack usage) - CPU: x = Any CPU, 0/1 = Affinity

Priority Groups

Critical System (22-24)

Purpose: Core ESP-IDF infrastructure

Task Priority Notes
ipc0 24 Must preempt all for system calls
ipc1 24 Same for CPU1
wifi 23 WiFi timing critical
httpd 23 HTTP server responsiveness
ZedMainTask 23 GNSS data processing
esp_timer 22 Hardware timer accuracy

Network Stack (15-20)

Purpose: Network communication

Task Priority Notes
sys_evt 20 System events
emac_rx 15 Ethernet receive (can be interrupted)
uart_msg_manage 16 UART message handling
tiT 18 TCP/IP stack

Application Core (10-14)

Purpose: Main application logic

Task Priority Notes
debug_task_core 10 Debug output
periodic_task 10 Regular maintenance

Background Tasks (1-5)

Purpose: Non-critical background operations

Task Priority Notes
mqtt_task 5 MQTT client (network tolerant)
uart-tcp 5 UART-TCP bridge
main 1 Main loop
Tmr Svc 1 Software timers
long_work 1 Background processing

Idle (0)

Purpose: CPU power management

Task Priority Notes
IDLE0 0 CPU0 idle
IDLE1 0 CPU1 idle

Task Affinity

CPU0 Tasks

  • esp_timer
  • ipc0
  • main
  • IDLE0
  • tiT
  • sys_evt
  • wifi

CPU1 Tasks

  • ipc1
  • IDLE1
  • debug_task_core
  • uart_msg_manage

Any CPU (x)

  • long_work
  • emac_rx
  • httpd
  • uart-tcp
  • periodic_task
  • ZedMainTask
  • mqtt_task

Stack Usage

High Stack Users (>3000 bytes)

Task HWM Reason
httpd 4900 HTTP request/response buffers
long_work 12844 File operations, updates
tiT 3112 TCP/IP stack
emac_rx 3128 Ethernet frame buffers
periodic_task 3252 JSON processing

Medium Stack Users (1000-3000 bytes)

Task HWM Reason
wifi 2988 WiFi driver
sys_evt 1420 Event handling
mqtt_task 2236 MQTT protocol
ZedMainTask 1480 UBX protocol

Low Stack Users (<1000 bytes)

Task HWM Reason
ipc0 428 Simple messages
ipc1 396 Simple messages
main 332 Event loop

Configuration

Changing Priorities

Via Console:

dbg task prio <ID> <PRIO>

In Code:

vTaskPrioritySet(task_handle, new_priority);

Recommendations

  1. Never lower critical system tasks (ipc, wifi)
  2. Test thoroughly when modifying priorities
  3. Monitor HWM for stack overflow detection
  4. Balance between responsiveness and fairness

Monitoring

Runtime Statistics

View current task status:

dbg task

Stack Monitoring

Check high water marks:

dbg heap

Performance Impact

Priority changes affect: - Response latency - CPU utilization - Power consumption - Real-time guarantees

References