This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Task switching using Timer in TI-RTOS

Other Parts Discussed in Thread: EK-TM4C1294XL

Hi,

I am doing one POC for task switching using TI-RTOS. Following are functionalities I want to implement:
- A timer will be running at every 10 Sec.
- Whenever timer expires, read the data from GPIO pin
- 1st task: If network is available than try to send this GPIO pin data to Remote server.
- 2nd Task: If network is available and there is some data inside SD card than send this data to Remote server.
- 3rd Task, if data sending failed or network is not available than save this to SD card
- Network TCP/IP hook to know whether board is assigned IP address or not. If IP address is not there than timer will call 3rd task directly.
- All Communication with Remote server should be secure.

As a starting point I am referring httpsget_TivaTM4C1294NCPDT example.
I created two static tasks with Priority as -1. In timer function I am changing priority of 1st task to 1. Inside 1st Task routine, I created 2nd task dynamically and changed the priority of task 1 again to -1. Inside 2nd task routine changed the priority to -1 for 2nd task.
Timer is running at every 10 seconds as expected but 1st and 2nd tasks are executed once. Also sequence is Timer->Task1->Timer->Task2->Timer->Timer.... instead of Timer->Task1->Task2->Timer-Task1->Task2.....
Any reason for this? And any thoughts to achieve above functionalities?

Using EK-TM4C1294XL board, CCS v6.1.0.00104 , tirtos_tivac_2_12_01_33, TivaWare_C_Series-2.1.1.71 on Windows 8 64-bit machine. 

Thanks,
Bhavesh

  • Bhavesh,

    When you change a Task priority to -1, then its not going to execute again until someone changes that priority to 1 or greater.

    Sounds like a desing flaw anyways to have to be changing these priorities all the time.  Why don't you just set Task1 to be higher priority than Task2.  And these Tasks can block on a semaphore once they are done with what they need to do...Then Timer can post semaphore for Task1 and Task1 can post the semaphore for Task 2?

    Judah