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. Chapter 1 - Microcomputer systems 1.1 - Overview 1.2 - Microcontroller systems 1.2.1 - RAM 1.2.2 - ROM 1.2.3 - PROM 1.2.4 - EPROM 1.2.5 - EEPROM 1.2.6 - Flash EEPROM 1.3 - Microcontroller features 1.3.1 - Supply voltage 1.3.2 - The clock 1.3.3 - Timers 1.3.4 - Watchdog 1.3.5 - Reset input 1.3.6 - Interrupts 1.3.7 - Brown-out detector 1.3.8 - Analog-to-digital converter 1.3.9 - Serial input-output 1.3.10 - SPI and I2C 1.3.11 - LCD drivers 1.3.12 - Analog comparator 1.3.13 - Real-time clock 1.3.14 - Sleep mode 1.3.15 - Power-on reset 1.3.16 - Low power operation 1.3.17 - Current sink/source capability 1.3.18 - USB interface 1.3.19 - CAN interface 1.3.20 - Ethernet interface 1.3.21 - Wi-Fi and/or Bluetooth interface 1.4 - Microcontroller architectures 1.4.1 - RISC and CISC 1.5 - Summary Further readings Chapter 2 - Architecture of ARM microcontrollers 2.1 - Overview 2.2 - ARM microcontrollers 2.2.1 - Cortex-M 2.2.1.1 - Cortex-M7 2.2.1.2 - Cortex-M4 2.2.1.3 - Cortex-M3 2.2.1.4 - Cortex-M0+ 2.2.1.5 - Cortex-M0 2.2.2 - Cortex-R 2.2.3 - Cortex-A 2.2.4 - Cortex-M processor comparison 2.2.5 - Cortex-M compatibility 2.2.6 - Processor performance measurement 2.3 - The STM32F407VGT6 microcontroller 2.3.1 - Basic features of the STM32F407VGT6 2.3.2 - Internal block diagram 2.3.3 - The power supply 2.3.4 - Low power modes 2.3.5 - The clock circuit 2.3.5.1 - External clock sources 2.3.5.2 - Internal clock sources 2.3.5.3 - Configuring the clock 2.4 - General purpose inputs and outputs 2.5 - Nested vectored interrupt controller (NVIC) 2.6 - External interrupt controller (EXTI) 2.7 - Timers 2.8 - Analog-to-digital converters (ADCs) 2.9 - Built-in temperature sensor 2.10 - Digital-to-analog converter 2.11 - Reset 2.12 - Electrical characteristics 2.13 - Summary Further readings Chapter 3 - ARM Cortex microcontroller development boards 3.1 - Overview 3.2 - LPC1768 3.3 - STM32 Nucleo family 3.4 - EasyMX Pro V7 For STM32 3.5 - STM32F4DISCOVERY board 3.6 - mbed application board 3.7 - EasyMx Pro V7 for Tiva 3.8 - MINI-M4 for STM32 3.9 - Clicker 2 for MSP432 3.10 - Tiva EK-TM4C123GXL LaunchPad 3.11 - Fusion for ARM V8 3.12 - Clicker 2 for STM32 3.13 - Summary Further readings Chapter 4 - Clicker 2 for STM32 development board 4.1 - Overview 4.2 - Clicker 2 for STM32 hardware 4.2.1 - On-board LEDs 4.2.2 - On-board push-button switches 4.2.3 - Reset switch 4.2.4 - Power supply 4.2.5 - On-board mikroBUS sockets 4.2.6 - Input-output pins 4.2.7 - Oscillators 4.2.8 - Programming the on-board microcontroller 4.3 - Summary Further reading Chapter 5 - Programming the ARM-based microcontrollers 5.1 - Overview 5.2 - IDEs supporting the ARM-based microcontrollers 5.2.1 - EWARM 5.2.2 - ARM Mbed 5.2.3 - MDK-ARM 5.2.4 - TrueStudio for STM32 5.2.5 - System Workbench for STM32 by AC6 5.2.6 - MikroC Pro for ARM 5.3 - Summary Further readings Chapter 6 - Programming using the mikroC Pro for ARM 6.1 - Overview 6.2 - MikroC Pro for ARM 6.3 - The general purpose input-output library 6.3.1 - GPIO_Clk_Enable 6.3.2 - GPIO_Clk_Disable 6.3.3 - GPIO_Config 6.3.4 - GPIO_Set_Pin_Mode 6.3.5 - GPIO_Digital_Input 6.3.6 - GPIO_Digital_Output 6.3.7 - GPIO_Analog_Input 6.3.8 - GPIO_Alternate_Function_Enable 6.4 - Memory type specifiers 6.5 - PORT input-output 6.6 - Accessing individual bits 6.7 - Bit data type 6.8 - Interrupts and exceptions 6.8.1 - Exceptions 6.8.2 - Interrupt service routine 6.9 - Creating a new project 6.9.1 - Uploading the executable code 6.10 - Simulation 6.10.1 - Setting break points 6.11 - Debugging 6.12 - Other mikroC IDE tools 6.12.1 - ASCII chart 6.12.2 - GLCD bitmap editor 6.12.3 - HID terminal 6.12.4 - Interrupt assistant 6.12.5 - LCD custom character 6.12.6 - Seven segment editor 6.12.7 - UDP terminal 6.12.8 - USART terminal 6.12.9 - USB HID bootloader 6.12.10 - Statistics 6.12.11 - The library manager 6.12.12 - Assembly listing 6.12.13 - Output files 6.12.14 - Options window 6.13 - Summary Further readings Chapter 7 - Introduction to multitasking 7.1 - Overview 7.2 - Multitasking kernel advantages 7.3 - Need for an RTOS 7.4 - Task scheduling algorithms 7.4.1 - Co-operative scheduling 7.4.2 - Round-robin scheduling 7.4.3 - Preemptive scheduling 7.4.4 - Scheduling algorithm goals 7.4.5 - Difference between preemptive and nonpreemptive scheduling 7.4.6 - Some other scheduling algorithms 7.4.6.1 - First come first served 7.4.6.2 - Shortest remaining time first 7.4.6.3 - Longest remaining time first 7.4.6.4 - Multilevel queue scheduling 7.4.6.5 - Dynamic priority scheduling 7.5 - Choosing a scheduling algorithm 7.6 - Summary Further readings Chapter 8 - Introduction to FreeRTOS 8.1 - Overview 8.2 - FreeRTOS distribution 8.3 - Installing from MikroElektronika web site 8.4 - Developing project files 8.5 - FreeRTOS headers files path and source files path 8.6 - Compiler case sensitivity 8.7 - Compiling the template program 8.8 - Summary Further readings Chapter 9 - Using the FreeRTOS functions 9.1 - Overview 9.2 - FreeRTOS data types 9.3 - FreeRTOS variable names 9.4 - FreeRTOS function names 9.5 - Common macro definitions 9.6 - Task states 9.7 - Task-related functions 9.7.1 - Creating a new task 9.7.2 - Delaying a task 9.7.3 - Project 1—flashing an LED every second 9.7.4 - Project 2—flashing two LEDs, one every second, other one every 200 ms 9.7.5 - Suspending a task 9.7.6 - Resuming a suspended task 9.7.7 - Project 3—suspending and resuming a task 9.7.8 - Deleting a task 9.7.9 - Project 4—flashing LEDs and deleting a task 9.7.10 - Getting the task handle 9.7.11 - Running at fixed intervals 9.7.12 - Tick count 9.7.13 - Project 5—flashing an LED using function vTaskDelayUntil() 9.7.14 - Task priorities 9.7.15 - Project 6—flashing LED and push-button switch at different priorities 9.7.16 - Project 7—getting/setting task priorities 9.8 - Using an LCD 9.8.1 - HD44780 LCD module 9.8.2 - Connecting the LCD to the Clicker 2 for STM32 development board 9.8.3 - LCD functions 9.8.4 - Project 8—displaying text on the LCD 9.9 - Task name, number of tasks, and tick count 9.10 - Project 9—displaying a task name, number of tasks, and tick count on the LCD 9.11 - Yield to another task of equal priority 9.12 - Aborting delay 9.13 - Project 10—7-segment 2-digit multiplexed LED display counter 9.14 - Project 11—7-segment 4-digit multiplexed LED display counter 9.15 - Project 12—7-segment 4-digit multiplexed LED display event counter 9.16 - Project 13—traffic lights controller 9.17 - Project 14—changing LED flashing rate 9.18 - Project 15—sending data to a PC over USB serial link 9.19 - Project 16—changing LED flashing rate from the PC keyboard 9.20 - Task list 9.21 - Project 17—displaying the task list on the PC screen 9.22 - Task info 9.23 - Project 19—displaying the task info on the PC screen 9.24 - Task state 9.25 - Project 20—displaying the task state on the PC screen 9.26 - Task parameters 9.27 - Summary Further readings Chapter 10 - Queue management 10.1 - Overview–global variables 10.2 - Why queues? 10.3 - Creating a queue, sending and receiving data using queues 10.4 - Project 21–changing LED flashing rate from the PC keyboard 10.5 - Deleting a queue, name of a queue, resetting a queue 10.6 - Project 22—using various queue functions 10.7 - Some other queue functions 10.8 - Project 23—ON-OFF temperature controller 10.9 - Summary Further readings Chapter 11 - Semapores and mutexes 11.1 - Overview 11.2 - Creating binary semaphore and mutex 11.3 - Creating a counting semaphore 11.4 - Deleting a semaphore, getting the semaphore count 11.5 - Giving and taking the semaphores 11.6 - Project 24: sending internal and external temperature data to a PC 11.7 - Summary Further reading Chapter 12 - Event groups 12.1 - Overview 12.2 - Event flags and event groups 12.3 - Creating and deleting an event group 12.4 - Setting, clearing, waiting For event group bits, and getting event group bits 12.5 - Project 25—sending internal and external temperature data to a PC 12.6 - Project 26—controlling the flashing of an LED 12.7 - Project 27—GPS based project 12.8 - Summary Further readings Chapter 13 - Software timers 13.1 - Overview 13.2 - Creating, deleting, starting, stopping, and resetting a timer 13.3 - Change timer period, get timer period 13.4 - Timer name and ID 13.5 - Project 28—reaction timer 13.6 - Project 29—generate square waveform 13.7 - Project 30—event counter (e.g., frequency counter) 13.8 - Summary Further readings Chapter 14 - Some example projects 14.1 - Overview 14.2 - Project 31: square wave generation with adjustable frequency 14.3 - Project 32: frequency sweep waveform generator 14.4 - Project 33: RGB light controller 14.5 - Project 34: home alarm system with keyboard 14.6 - Project 35: ultrasonic car parking with buzzer 14.7 - Project 36: stepper motor project 14.8 - Project 37: communicating with the Arduino 14.9 - Summary Further reading Chapter 15 - The Idle task and the idle task hook 15.1 - Overview 15.2 - The Idle task 15.3 - Idle task hook functions 15.4 - Project 39: display the free processor time 15.5 - Summary Further reading Chapter 16 - Task Notifications 16.1 - Overview 16.2 - xTaskNotifyGive() and uITaskNotifyTake() 16.3 - Project 40: start flashing an LED after receiving notification 16.4 - xTaskNotify() and xTaskNotifyWait() 16.5 - Project 41: flashing at different rates after receiving notifications 16.6 - xTaskNotifyStateClear() and xTaskNotifyQuery() 16.7 - Summary Further reading Chapter 17 - Critical sections 17.1 - Overview 17.2 - Project 42: critical sections – Sharing the UART 17.3 - Suspending the scheduler 17.4 - Project 43: suspending the scheduler 17.5 - Summary Further reading Chapter 18 - Interrupts in Cortex-M4 based microcontrollers 18.1 - Overview 18.2 - Interrupts in general 18.3 - STM32F407 interrupts 18.2.1 - External Interrupts 18.4 - Project 44—External interrupt based event counter 18.5 - Project 45—Multiple external interrupts 18.6 - Internal interrupts (timer interrupts) 18.7 - Project 46—Generating waveform using a timer interrupt 18.8 - Project 47—External interrupt with timer interrupt 18.9 - Summary Further readings Chapter 19 - USING the FreeRTOS API function calls from an ISR 19.1 - Overview 19.2 - The xHigherPriorityTaskWoken parameter 19.3 - Deferred interrupt processing 19.4 - Task related functions from ISR 19.4.1 - taskENTER_CRITICAL_FROM_ISR() and taskEXIT_CRITICAL_FROM_ISR() 19.4.2 - xTaskNotifyFromISR() 19.4.3 - xTaskNotifyGiveFromISR() 19.4.4 - xTaskResumeFromISR() 19.5 - Project 48-Using function xTaskResumeFromISR() 19.6 - Project 49-Deferred interrupt processing 19.7 - Project 50-Using function xTaskNotifyFromISR() 19.8 - Event group related functions from ISR 19.8.1 - xEventGroupSetBitsFromISR() 19.8.2 - xEventGroupClearBitsFrmISR() 19.9 - Project 51-Using function xEventGroupSetBitsFromISR() 19.10 - Timer related functions from ISR 19.10.1 - xTimerStartFromISR() 19.10.2 - xTimerStopFromISR() 19.10.3 - xTimerResetFromISR() 19.10.4 - xTimerChangePeriodFromISR() 19.11 - Project 52-Using functions xTimerStartFromISR() and xTimerChangePeriodFromISR() 19.12 - Semaphore related functions from ISR 19.12.1 - xSemaphoreGiveFromISR() 19.12.2 - xSemaphoreTakeFromISR() 19.13 - Project 53-Using functions xSemaphoreTakeFromISR() and xSemaphoreGive() 19.14 - Queue related functions from ISR 19.14.1 - xQueueReceiveFromISR() 19.14.2 - xQueueSendFromISR() 19.15 - Project 54-Using functions xQueueSendFromISR() and xQueueReceive() 19.16 - Summary Further reading Chapter 20 - Car park management system 20.1 - Overview 20.2 - Project 55: car park control Further reading Chapter 21 - Time in different cities 21.1 - Overview 21.2 - Project 56: time project Further reading Chapter 22 - Mobile robot project: the Buggy 22.1 - Overview 22.2 - The Buggy 22.3 - Wheel motors 22.4 - Lights (LEDs) 22.5 - Project 57: controlling the Buggy lights 22.6 - Project 58: controlling the Buggy motors 22.7 - Project 59: obstacle avoiding Buggy 22.8 - Project 60: controlling the Buggy remotely Further reading