0%

Book Description

Most microcontroller-based applications nowadays are large, complex, and may require several tasks to share the MCU in multitasking applications. Most modern high-speed microcontrollers support multitasking kernels with sophisticated scheduling algorithms so that many complex tasks can be executed on a priority basis. ARM-based Microcontroller Multitasking Projects: Using the FreeRTOS Multitasking Kernel explains how to multitask ARM Cortex microcontrollers using the FreeRTOS multitasking kernel.

The book describes in detail the features of multitasking operating systems such as scheduling, priorities, mailboxes, event flags, semaphores etc. before going onto present the highly popular FreeRTOS multitasking kernel.

Practical working real-time projects using the highly popular Clicker 2 for STM32 development board (which can easily be transferred to other boards) together with FreeRTOS are an essential feature of this book. Projects include: LEDs flashing at different rates; Refreshing of 7-segment LEDs; Mobile robot where different sensors are controlled by different tasks; Multiple servo motors being controlled independently; Multitasking IoT project; Temperature controller with independent keyboard entry; Random number generator with 3 tasks: live, generator, display; home alarm system; car park management system, and many more.

  • Explains the basic concepts of multitasking
  • Demonstrates how to create small multitasking programs
  • Explains how to install and use the FreeRTOS on an ARM Cortex processor
  • Presents structured real-world projects that enables the reader to create their own

Table of Contents

  1. Cover
  2. Title page
  3. Contents
  4. Copyright
  5. About the author
  6. Preface
  7. Acknowledgments
  8. Chapter 1: Microcomputer systems
    1. Abstract
    2. 1.1. Overview
    3. 1.2. Microcontroller systems
    4. 1.3. Microcontroller features
    5. 1.4. Microcontroller architectures
    6. 1.5. Summary
  9. Chapter 2: Architecture of ARM microcontrollers
    1. Abstract
    2. 2.1. Overview
    3. 2.2. ARM microcontrollers
    4. 2.3. The STM32F407VGT6 microcontroller
    5. 2.4. General purpose inputs and outputs
    6. 2.5. Nested vectored interrupt controller (NVIC)
    7. 2.6. External interrupt controller (EXTI)
    8. 2.7. Timers
    9. 2.8. Analog-to-digital converters (ADCs)
    10. 2.9. Built-in temperature sensor
    11. 2.10. Digital-to-analog converter
    12. 2.11. Reset
    13. 2.12. Electrical characteristics
    14. 2.13. Summary
  10. Chapter 3: ARM Cortex microcontroller development boards
    1. Abstract
    2. 3.1. Overview
    3. 3.2. LPC1768
    4. 3.3. STM32 Nucleo family
    5. 3.4. EasyMX Pro V7 For STM32
    6. 3.5. STM32F4DISCOVERY board
    7. 3.6. mbed application board
    8. 3.7. EasyMx Pro V7 for Tiva
    9. 3.8. MINI-M4 for STM32
    10. 3.9. Clicker 2 for MSP432
    11. 3.10. Tiva EK-TM4C123GXL LaunchPad
    12. 3.11. Fusion for ARM V8
    13. 3.12. Clicker 2 for STM32
    14. 3.13. Summary
  11. Chapter 4: Clicker 2 for STM32 development board
    1. Abstract
    2. 4.1. Overview
    3. 4.2. Clicker 2 for STM32 hardware
    4. 4.3. Summary
  12. Chapter 5: Programming the ARM-based microcontrollers
    1. Abstract
    2. 5.1. Overview
    3. 5.2. IDEs supporting the ARM-based microcontrollers
    4. 5.3. Summary
  13. Chapter 6: Programming using the mikroC Pro for ARM
    1. Abstract
    2. 6.1. Overview
    3. 6.2. MikroC Pro for ARM
    4. 6.3. The general purpose input-output library
    5. 6.4. Memory type specifiers
    6. 6.5. PORT input-output
    7. 6.6. Accessing individual bits
    8. 6.7. Bit data type
    9. 6.8. Interrupts and exceptions
    10. 6.9. Creating a new project
    11. 6.10. Simulation
    12. 6.11. Debugging
    13. 6.12. Other mikroC IDE tools
    14. 6.13. Summary
  14. Chapter 7: Introduction to multitasking
    1. Abstract
    2. 7.1. Overview
    3. 7.2. Multitasking kernel advantages
    4. 7.3. Need for an RTOS
    5. 7.4. Task scheduling algorithms
    6. 7.5. Choosing a scheduling algorithm
    7. 7.6. Summary
  15. Chapter 8: Introduction to FreeRTOS
    1. Abstract
    2. 8.1. Overview
    3. 8.2. FreeRTOS distribution
    4. 8.3. Installing from MikroElektronika web site
    5. 8.4. Developing project files
    6. 8.5. FreeRTOS headers files path and source files path
    7. 8.6. Compiler case sensitivity
    8. 8.7. Compiling the template program
    9. 8.8. Summary
  16. Chapter 9: Using the FreeRTOS functions
    1. Abstract
    2. 9.1. Overview
    3. 9.2. FreeRTOS data types
    4. 9.3. FreeRTOS variable names
    5. 9.4. FreeRTOS function names
    6. 9.5. Common macro definitions
    7. 9.6. Task states
    8. 9.7. Task-related functions
    9. 9.8. Using an LCD
    10. 9.9. Task name, number of tasks, and tick count
    11. 9.10. Project 9—displaying a task name, number of tasks, and tick count on the LCD
    12. 9.11. Yield to another task of equal priority
    13. 9.12. Aborting delay
    14. 9.13. Project 10—7-segment 2-digit multiplexed LED display counter
    15. 9.14. Project 11—7-segment 4-digit multiplexed LED display counter
    16. 9.15. Project 12—7-segment 4-digit multiplexed LED display event counter
    17. 9.16. Project 13—traffic lights controller
    18. 9.17. Project 14—changing LED flashing rate
    19. 9.18. Project 15—sending data to a PC over USB serial link
    20. 9.19. Project 16—changing LED flashing rate from the PC keyboard
    21. 9.20. Task list
    22. 9.21. Project 17—displaying the task list on the PC screen
    23. 9.22. Task info
    24. 9.23. Project 19—displaying the task info on the PC screen
    25. 9.24. Task state
    26. 9.25. Project 20—displaying the task state on the PC screen
    27. 9.26. Task parameters
    28. 9.27. Summary
  17. Chapter 10: Queue management
    1. Abstract
    2. 10.1. Overview–global variables
    3. 10.2. Why queues?
    4. 10.3. Creating a queue, sending and receiving data using queues
    5. 10.4. Project 21–changing LED flashing rate from the PC keyboard
    6. 10.5. Deleting a queue, name of a queue, resetting a queue
    7. 10.6. Project 22—using various queue functions
    8. 10.7. Some other queue functions
    9. 10.8. Project 23—ON-OFF temperature controller
    10. 10.9. Summary
  18. Chapter 11: Semapores and mutexes
    1. Abstract
    2. 11.1. Overview
    3. 11.2. Creating binary semaphore and mutex
    4. 11.3. Creating a counting semaphore
    5. 11.4. Deleting a semaphore, getting the semaphore count
    6. 11.5. Giving and taking the semaphores
    7. 11.6. Project 24: sending internal and external temperature data to a PC
    8. 11.7. Summary
  19. Chapter 12: Event groups
    1. Abstract
    2. 12.1. Overview
    3. 12.2. Event flags and event groups
    4. 12.3. Creating and deleting an event group
    5. 12.4. Setting, clearing, waiting For event group bits, and getting event group bits
    6. 12.5. Project 25—sending internal and external temperature data to a PC
    7. 12.6. Project 26—controlling the flashing of an LED
    8. 12.7. Project 27—GPS based project
    9. 12.8. Summary
  20. Chapter 13: Software timers
    1. Abstract
    2. 13.1. Overview
    3. 13.2. Creating, deleting, starting, stopping, and resetting a timer
    4. 13.3. Change timer period, get timer period
    5. 13.4. Timer name and ID
    6. 13.5. Project 28—reaction timer
    7. 13.6. Project 29—generate square waveform
    8. 13.7. Project 30—event counter (e.g., frequency counter)
    9. 13.8. Summary
  21. Chapter 14: Some example projects
    1. Abstract
    2. 14.1. Overview
    3. 14.2. Project 31: square wave generation with adjustable frequency
    4. 14.3. Project 32: frequency sweep waveform generator
    5. 14.4. Project 33: RGB light controller
    6. 14.5. Project 34: home alarm system with keyboard
    7. 14.6. Project 35: ultrasonic car parking with buzzer
    8. 14.7. Project 36: stepper motor project
    9. 14.8. Project 37: communicating with the Arduino
    10. 14.9. Summary
  22. Chapter 15: The Idle task and the idle task hook
    1. Abstract
    2. 15.1. Overview
    3. 15.2. The Idle task
    4. 15.3. Idle task hook functions
    5. 15.4. Project 39: display the free processor time
    6. 15.5. Summary
  23. Chapter 16: Task Notifications
    1. Abstract
    2. 16.1. Overview
    3. 16.2. xTaskNotifyGive() and uITaskNotifyTake()
    4. 16.3. Project 40: start flashing an LED after receiving notification
    5. 16.4. xTaskNotify() and xTaskNotifyWait()
    6. 16.5. Project 41: flashing at different rates after receiving notifications
    7. 16.6. xTaskNotifyStateClear() and xTaskNotifyQuery()
    8. 16.7. Summary
  24. Chapter 17: Critical sections
    1. Abstract
    2. 17.1. Overview
    3. 17.2. Project 42: critical sections – Sharing the UART
    4. 17.3. Suspending the scheduler
    5. 17.4. Project 43: suspending the scheduler
    6. 17.5. Summary
  25. Chapter 18: Interrupts in Cortex-M4 based microcontrollers
    1. Abstract
    2. 18.1. Overview
    3. 18.2. Interrupts in general
    4. 18.3. STM32F407 interrupts
    5. 18.4. Project 44—External interrupt based event counter
    6. 18.5. Project 45—Multiple external interrupts
    7. 18.6. Internal interrupts (timer interrupts)
    8. 18.7. Project 46—Generating waveform using a timer interrupt
    9. 18.8. Project 47—External interrupt with timer interrupt
    10. 18.9. Summary
  26. Chapter 19: USING the FreeRTOS API function calls from an ISR
    1. Abstract
    2. 19.1. Overview
    3. 19.2. The xHigherPriorityTaskWoken parameter
    4. 19.3. Deferred interrupt processing
    5. 19.4. Task related functions from ISR
    6. 19.5. Project 48-Using function xTaskResumeFromISR()
    7. 19.6. Project 49-Deferred interrupt processing
    8. 19.7. Project 50-Using function xTaskNotifyFromISR()
    9. 19.8. Event group related functions from ISR
    10. 19.9. Project 51-Using function xEventGroupSetBitsFromISR()
    11. 19.10. Timer related functions from ISR
    12. 19.11. Project 52-Using functions xTimerStartFromISR() and xTimerChangePeriodFromISR()
    13. 19.12. Semaphore related functions from ISR
    14. 19.13. Project 53-Using functions xSemaphoreTakeFromISR() and xSemaphoreGive()
    15. 19.14. Queue related functions from ISR
    16. 19.15. Project 54-Using functions xQueueSendFromISR() and xQueueReceive()
    17. 19.16. Summary
  27. Chapter 20: Car park management system
    1. Abstract
    2. 20.1. Overview
    3. 20.2. Project 55: car park control
  28. Chapter 21: Time in different cities
    1. Abstract
    2. 21.1. Overview
    3. 21.2. Project 56: time project
  29. Chapter 22: Mobile robot project: the Buggy
    1. Abstract
    2. 22.1. Overview
    3. 22.2. The Buggy
    4. 22.3. Wheel motors
    5. 22.4. Lights (LEDs)
    6. 22.5. Project 57: controlling the Buggy lights
    7. 22.6. Project 58: controlling the Buggy motors
    8. 22.7. Project 59: obstacle avoiding Buggy
    9. 22.8. Project 60: controlling the Buggy remotely
  30. Appendix A. Number systems
  31. Appendix B. The program description language
  32. Index
44.212.50.220