Freertos Interrupt Example

FreeRTOS Queue. This means that one possible technique for communicating between threads would be to declare a global variable, which both threads have access to. For example, you could declare a variable called “uint32t ledColor” and have the the LED Thread read the variable to determine which LED to blink.

  1. May 04, 2016  Readme.md. This is a FreeRTOS USART TX-RX interrupts example for STM32F407, especially for STM32F4-Discovery. It is GPIO example extended with FreeRTOS library.
  2. In this example, the tick interrupt is used in preference of an interrupt generated by a peripheral to ensure the hardware neutrality is maintained. The event semaphore task The event semaphore task uses the FreeRTOS xSemaphoreTake API function to wait for the semaphore that is given by the RTOS tick hook function. The task increments the.
  3. If you look at the demos that are distributed with FreeRTOS, there are examples of using queue inside of Interrupt handlers. For example, the serial ports in the demos run based on using a queue. The biggest thing to remember is that inside an Interrupt handler, you should only call FreeRTOS functions that end in FromISR, and none of these functions will offer the opertunity to ‘block’ for something, as ISRs.

Here we will discuss some of the most frequently used APIs related to tasks.

Freertos Interrupt Example

xTaskCreate(): This interface is used to create a new Task, if the task is successfully created then it returns pdPass(1) or else errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY(-1). Check this link for more details.

vTaskDelay(): This function is used to delay/block the task for specified delay time(ticks). INCLUDE_vTaskDelay needs to be set to 1 in FreeRtosConfig.h file for using this function. Check this link for more details.

vTaskDelete():This function is used to delete as task. We need to pass the taskHandle of the task to be deleted.To delete the own task we should pass NULL as the parameter. Please check this link for more details.

vTaskSuspend(): This function is used to Suspend a task, the suspended remains in the same state util it is resumed.For this, we need to pass the handle of the tasks that needs to be suspended. Passing NULL will suspend own task. Check this link for more details.

vTaskResume(): This function is used to resume a suspended task. If the Resumed task has higher priority than the running task then it will preempt the running task or else stays in ready stateFor this, we need to pass the handle of the task to be resumed. Check this link for more details.

Freertos Timer Interrupt Example

Freertos Interrupt Example

Freertos Tutorial

xTaskResumeFromISR(): This function is used to resume a task from ISR.For this, we need to pass the handle of the task to be resumed. Check this link for more details.