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.

Adding custom application tasks in BLE NoOS Scheduler



Hello StoneStreet One,

We have made a custom boards where in we have used the TIVA C TM4C1230H6 controller and interfaced it with the CC2564B chipset. Here we have also managed to update/add the code in this BLE scheduler (using the reference of the C:\ti\Connectivity\CC256X BT\CC256x M4 Bluetopia SDK\v1.1\Cortex_M4\Sample\ANPDemo code) and we have managed  to read the data present from the TI Sensor TAG, like IR Temperature and Humidity.

Now we are planning to add our application code which is currently without BT ( containing inputs, output control, sd card integration, etc) in this scheduler, by adding more tasks.

My questions hare are w.r.t. the BLE scheduler:

1. Can we safely use global variables between tasks?

2. Is there any constrain of using global variables or the no. of global variables that can be used?

3. Is there any stack size constrain for a single Task?

4. Is there some document where we can get more details on this scheduler ( currently we are referring to C:\ti\Connectivity\CC256X BT\CC256x M4 Bluetopia SDK\v1.1\Documentation\BTPSKRNL.pdf)

Thanks,

Vahbiz

  • Hi Vahbiz,

    I think it is more appropriate that you post this query on the Tiva Forum as most queries are related to that.
    Regarding (4) - I don't think we have additional information. But I believe you have the full scheduler implementation as source with each app?

    Regards,
    Gigi Joseph.
  • Hi Vahbiz,

    Please see the responses I have received from the Bluetopia team.

    1. There is no problem that I am aware of.

    2. Related to the Tiva memory, I am not aware of any strict limitation.

    3. Related to the Tiva memory according to the specific model.

    4. I am not sure which scheduler you are referring to , but I am guessing it’s the main BTPSkrnl in the NoOS enviorment.

    We don’t have any other document regarding the NoOS scheduler beside the one you are using , but basically its running through the entire function that registered in a while loop , we have those 2 functions that handle the scheduling procedure:

    /* The following function begins execution of the actual Scheduler. */
    /* Once this function is called, it NEVER returns. This function is */
    /* responsible for executing all functions that have been added to */
    /* the Scheduler with the BTPS_AddFunctionToScheduler() function. */

    BTPSAPI_DECLARATION void BTPSAPI BTPS_ExecuteScheduler(void);

    /* The following function is provided to allow a mechanism to process*/
    /* the scheduled functions in the scheduler. This function performs */
    /* the same functionality as the BTPS_ExecuteScheduler() function */
    /* except that it returns as soon as it has made an iteration through*/
    /* the scheduled functions. This function is provided for platforms */
    /* that would like to implement their own processing loop and/or */
    /* scheduler and not rely on the Bluetopia implementation. */
    /* * NOTE * This function should NEVER be called if the */
    /* BTPS_ExecuteScheduler() schema is used. */

    BTPSAPI_DECLARATION void BTPSAPI BTPS_ProcessScheduler(void);

    We advise not to change the scheduling mechanism due to huge amount of testing that was done throughout the years to optimize it.

    Regards,
    Gigi Joseph.
  • Hello Joseph,


    Thank you very much for your reply.

    We have added additional tasks as below in main.c
    Question 1 :Does this way of adding new tasks to our existing BLE code look correct?
    We have added 5 new tasks to the already existing 2 tasks.
    The new tasks are :
    TASK1 called every 1 sec
    Task2 called every 500msec
    ProcessTask called every 10ms
    TimerTask called every 20ms
    BMSTask called every 200ms

    We have left the 2 original tasks "ProcessCharacters" and "IdleFunction" as it is (as yet).


    if(BTPS_AddFunctionToScheduler(ProcessCharacters, NULL, 200))
     {
     MailboxHandle = BTPS_CreateMailbox(2,60);
             /* Add the idle function (which determines if LPM3 may be      */
             /* entered) to the scheduler.                         */
    if(BTPS_AddFunctionToScheduler(TASK1, NULL, 1000))
      {
      if(BTPS_AddFunctionToScheduler(Task2, NULL, 500))
         {
            if(BTPS_AddFunctionToScheduler(ProcessTask, NULL, 10))
            {
             if(BTPS_AddFunctionToScheduler(TimerTask, NULL, 20))
                {
                   if(BTPS_AddFunctionToScheduler(BMSTask, NULL, 200))
                    {
                       if(BTPS_AddFunctionToScheduler(IdleFunction, NULL, 0))
                       {
                         /* Loop forever and execute the scheduler.              */
                         while(1)
                          BTPS_ExecuteScheduler();
                       }
                    }  
                 }
              }
           }
        }
      }
    }

    Question 2: When you say "We advise not to change the scheduling mechanism due to huge amount of testing that was done throughout the years to optimize it." .  Are you advising us not to add more tasks? Can this affect the schedule mechanism of the BLE "ProcessCharacters " task?

    Thanks,
    Vahbiz
  • Hi Vahbiz,

    No, but please bear in mind that the scheduler mechanism was tested with the number of tasks as in the demo apps.

    Regards,
    Gigi Joseph.