This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to switch between task by receving data on BLE using FREERTOS?

Hi Everyone,

I have two task in which i am receving data from bluetooth and if i receive a particular hex value , i want a task(which is Toggling LED State) to run on the basis of the received data.

If there was no data received , then both task should run as per they are scheduled.

If i give a task delay of 2 minutes , the task switches from BLE to LED but , it runs continously there and BLE task also runs alongwith it. (NOT WHAT I WANT)

However if i give a task delay 1 minute , The task switches from BLE to LED and does not run continously.(EXPECTING SAME WITH 2 MINUTES OF TASK DELAY)

What i need is , its something like Immediate Task Switching. 

I have been trying to use xTaskAbortDelay function , the task does run from the input from bluetooth data, however , after that the LED task is running continously.

Does xTaskAbortDelay creating some problem here? Should I use something else to achieve the same functionality?

I am using SDK 15.0 With Segger Embedded Studio

Thanks 

Rajat

Parents
  • Hi Rajat,

    I am little unsure if I understood your question correctly. 

    If there was no data received , then both task should run as per they are scheduled.

    What do you mean here? 

    vTaskAbortDelay function will be a task from blocked to ready state, and this does not mean that your task will run immediately. This means that when other high priority tasks are blocked/yielded, then the task that now entered ready state (due to vTaskAbortDelay) will run.

     

     

Reply
  • Hi Rajat,

    I am little unsure if I understood your question correctly. 

    If there was no data received , then both task should run as per they are scheduled.

    What do you mean here? 

    vTaskAbortDelay function will be a task from blocked to ready state, and this does not mean that your task will run immediately. This means that when other high priority tasks are blocked/yielded, then the task that now entered ready state (due to vTaskAbortDelay) will run.

     

     

Children
Related