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.

create Task issue

請問各位,我想create new task專門負責處理send data to PHONE,
但程式卡在ICall_registerApp()就shutdown了,反覆看了sample code也沒發現有什麼可疑的。

我參考SDK的Sensor Tag create task,以下是我加的內容:

<define / flag>
ICALL_MAX_NUM_TASKS=4 ===> 5 //原本是4個task
#define SPP_TASK_STACK_SIZE      160

<main.c>
int main()
{
      ....
      TBD_createTask();
      App_process_createTask();
      DataSend_createTask(); <=== new task
}


<DataSendProcess.c>
void SppSendData_init(void)
{
      ICall_registerApp(&SppselfEntity, &sem); <================= 當在這
      sppMsgQueue = Util_constructQueue(&appMsg);

      Util_constructClock(&spp_periodicClock, SppDataSend_clockHandler,
      SPP_PERIODIC_EVT_PERIOD, 0, false, SPP_PERIODIC_EVT);
}
void SppDataSend_createTask(void)
{
      Task_Params taskParams;

      // Configure task.
      Task_Params_init(&taskParams);
      taskParams.stack = sppTaskStack;
      taskParams.stackSize = SPP_TASK_STACK_SIZE;
      taskParams.priority = SPP_TASK_PRIORITY;

      Task_construct(&sppSendTask, SppSendData_taskFxn, &taskParams, NULL);
}
void SppSendData_taskFxn(UArg a0, UArg a1)
{
      SppSendData_init();
      for (;;)
      {
            ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER);

            if (events & SPP_PERIODIC_EVT)
            {
                  Util_startClock(&spp_periodicClock);

                  sppSendEvt_t *pMsg = (sppSendEvt_t *)Util_dequeueMsg(sppMsgQueue);
                  if (pMsg->len != 0)
                  {
                        SPP_DATA_SEND(pMsg->len, pMsg->data); //SimpleProfile_SetParameter()
                        ICall_free(pMsg);
                  }
                  else
                  {
                        events &= ~SPP_PERIODIC_EVT;
                  }
           }
           while (!Queue_empty(sppMsgQueue))
           {
                 sppSendEvt_t *pMsg = (sppSendEvt_t *)Util_dequeueMsg(sppMsgQueue);
                 if (pMsg->len != 0)
                 {
                       SPP_DATA_SEND(pMsg->len, pMsg->data);
                       ICall_free(pMsg);
                 }
            }
      }
}

  • 仔细看下面的指引。光ICALL_MAX_NUM_TASKS 修改是不够的。

    http://processors.wiki.ti.com/index.php/Adding_BLE_Enabled_RTOS_Task

  • 另外,你具体在哪里修改的ICALL_MAX_NUM_TASKS?

  • 您好

    Properties .../Advanced Options/Predefined Symbols

  • 按Link做,还有问题请提。

  • Hi TY

    我按link修改了
    OSAL_MAX_NUM_PROXY_TASKS,ICALL_MAX_NUM_TASKS,ICALL_MAX_NUM_ENTITIES 

    也確定程序有跑進_taskFxn(),但不解為何會影響到其它的task(如廣播)

    Task 順序:
    void main (void)
    {
          SppDataSend_createTask();
          Advertising_createTask();

    <測試一>
    void SppSendData_taskFxn()

    {
          for (;;)
          {
                // 程序卡在這,廣播task無法廣播
          }

    <測試二>
    void SppSendData_taskFxn()

    {
          for (;;)
          {
                return; // return 後廣播task可以順序廣播
          }

    有跑進taskFxn裡代表我create Task成功,但各個Task應該是獨立的不是??
    為何不return就無法跑下一個task呢??