Master The Pico WiFi: Installing FreeRTOS
Written by Harry Fairhead and Mike James   
Monday, 01 September 2025
Article Index
Master The Pico WiFi: Installing FreeRTOS
Scheduling and Tasks
The Standard Tasks

The Standard Tasks

Working with the scheduling algorithm would be easy if there were only the tasks you created in the system. There are, however, standard tasks that the system starts before your program is loaded: 

Task Name

Description

Affinity

Priority

Idle Task (IDLEx)

Created for each core x.

Core x

0

Timer Task (Tmr Svc)

Created by FreeRTOS when any FreeTOS Timer APIs is called

Core 0

CONFIG_FREERTOS_TIMER_TASK_PRIORITY

These tasks aren’t running all of the time, but the priorities that you assign to tasks that you create can stop them running at all and this is not a good idea. The Idle Task is responsible for freeing the kernel-allocated memory from tasks that have been deleted. It is therefore important that the Idle Task is not starved of microcontroller processing time if your application makes any calls to vTaskDelete. Memory allocated by a task is not automatically freed and should be freed before the task is deleted.

In chapter but not in this extract

  • A First Example
  • The Timing Problem
  • Managing Tasks
  • A Better Main
  • Race Conditions
  • Update Loss
  • Locks
  • Queues
  • WiFi
  • FreeRTOS Web Client
  • FreeRTOS Considered

Summary

  • FreeRTOS is an open source project to make a realtime operating system available on a wide range of processors.

  • The version of FreeRTOS used by the Pico is available on the Raspberry Pi website and this has been extended to work with two cores to utilize Symmetric Multi-Processing (SMP).

  • FreeRTOS works in terms of tasks. A task is a function that can be run as if it was a “main” program in its own right. Tasks never return and are generally written as infinite loops.

  • Each task has a priority and tasks get to run on a processor according to their priority.

  • At each tick, the scheduler stops the current task and selects the task with the highest priority to run next.

  • Tasks with equal priority take equal turns to run.

  • As well as the custom tasks a program creates, there are some standard tasks created by the system.

  • A range of functions allows you to control how tasks are run.

  • The problem with multi-tasking is the danger of creating race conditions where the outcome of a computation depends on the order in which tasks are run.

  • To avoid race conditions you have to use locks to restrict access to shared resources.

  • An alternative to using locks is to use safe data structures such as xQueue to allow tasks to interact and pass data to each other.

  • You can run the WiFi libraries on either core as a FreeRTOS task.

  • To avoid race hazards, a single WiFi task running on a single core is a good design choice.

  • Implementing a web client using FreeRTOS is little different from working without FreeRTOS.

Master the Raspberry Pi Pico in C:
WiFiwith lwIP, mbedTLS & FreeRTOS
Second Edition

By Harry Fairhead & Mike James

masterPicoE2360

Buy from Amazon.

Contents

       Preface

  1. The Pico WiFi Stack
  2. Introduction To TCP
          Extract:
    Simplest HTTP Client *
  3. More Advanced TCP
  4. SSL/TLS and HTTPS
          Extract:
    Simplest HTTPS Client *
  5. Details of Cryptography
          Extract:
    Random Numbers*
  6. Servers
          Extract: HTTP Server *    
  7. UDP For Speed
          Extract: 
    Basic UDP *
  8. SNTP For Time-Keeping
  9. SMTP For Email
  10. MQTT For The IoT
  11. FreeRTOS
         Extract: 
    Installing FreeRTOS NEW!!
  12. Client Sockets
  13. Socket Server
  14. Secure Sockets

    Appendix 1 Getting Started In C

* Extracts from the first edition not yet updated.

<ASIN:B0FDYDPQ54>

 

pico book

 

Comments




or email your comment to: comments@i-programmer.info

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.



Last Updated ( Monday, 01 September 2025 )