Any Method to trigger/start FreeRTOS task from normal STM32 ISR??

madhan719 wrote on Thursday, February 21, 2019:

Hello Folks,

What is the most effecient method to start a freeRTOS task only after an ISR is completed and flag or something set by ISR that triggers freeRTOS task.

Lets take an example scenario , I have STM32F3 nucleo board in which i would like to toggle two different led’s using freeRTOS task by using xTaskCreate . Also i want to Serial read a character say ‘T’ (T-toggel just random) using DMA which will generate interrupt on tranfer complete, the corresponding Interrupt Service Routine should have a method/flag to trigger/execute the tasks created (toggling of LED’s). Once the two tasks are completed should wait for the arrival of character ‘T’ over Serial.

Any IDE is ok for explanation and preferably ST’s standard periperal library (if any good heart would like to provide entire code structure as an eaxmple/explanation )

Any Ideas would be very welcome :wink:

Thanks in advance.

rtel wrote on Thursday, February 21, 2019:

What is the most effecient method to start a freeRTOS task only after an
ISR is completed and flag or something set by ISR that triggers freeRTOS
task.

There is no really efficient way of doing that - most efficient would be
to have the tasks already created then just unblock them from the ISR to
start them running as per
https://sourceforge.net/p/freertos/discussion/382005/thread/9baed78cc9/#1720/a912

If you must create a task, then you can’t do that directly in an ISR,
but you can pend a function that starts them from the RTOS daemon task
(aka the timer task).
https://www.freertos.org/xTimerPendFunctionCallFromISR.html

If the daemon task is the highest priority task then it will run after
the ISR, execute the function that creates the task you want, which will
create the tasks.

Any IDE is ok for explanation and preferably ST’s standard periperal
library (if any good heart would like to provide entire code structure
as an eaxmple/explanation )

So this sight remains narrowly focused on helping people with FreeRTOS
my preference is not to provide support for third party libraries here -
FreeRTOS runs on many different architectures.

madhan719 wrote on Thursday, February 21, 2019:

Hi Richard,
Thanks for the quick response.

To be precise i don’t want any task to be dynamically created by ISR, instead i’m interested in something like this https://docs.aws.amazon.com/freertos-kernel/latest/ref/reference125.html in which the previously existing task should be in suspended state and once ISR is triggered, the ISR should unblock the existing task ( by using any FreeRTOS API ) and should be executed.

luckily something am looking for exists in FreeRTOS_Support_Forum
https://www.freertos.org/FreeRTOS_Support_Forum_Archive/October_2014/freertos_How_to_wake_up_a_FreeRtos_task_from_a_high_priority_ISR_140cde98j.html

:slight_smile: :slight_smile: :slight_smile: so could you please suggest me ideas for the same.