Hello,
I am currently evaluating the Embedded Studio Pro Cortex-M ide, libraries and the PTP Client. I have had good success working with the PTP Client by itself. Today I tried adding a Webserver task and was unable to get the Webserver to respond until I moved the PTP Task start code from here:
Display All
to Here (below). Is this acceptable? Are there any consequences with starting the PTP Client later in the IP/Ethernet setup process?
Display All
I am currently evaluating the Embedded Studio Pro Cortex-M ide, libraries and the PTP Client. I have had good success working with the PTP Client by itself. Today I tried adding a Webserver task and was unable to get the Webserver to respond until I moved the PTP Task start code from here:
C Source Code
- IP_Init();
- IP_AddLogFilter(IP_MTYPE_APPLICATION);
- _IFaceId = IP_INFO_GetNumInterfaces() - 1; // Get the last registered interface ID as this is most likely the interface we want to use in this sample.
- OS_SetPriority(OS_GetTaskID(), TASK_PRIO_IP_TASK); // For now, this task has highest prio except IP management tasks.
- OS_CREATETASK(&_IPTCB , "IP_Task" , IP_Task , TASK_PRIO_IP_TASK , _IPStack); // Start the TCP/IP_Task.
- #if USE_RX_TASK
- OS_CREATETASK(&_IPRxTCB , "IP_RxTask" , IP_RxTask , TASK_PRIO_IP_RX_TASK, _IPRxStack); // Start the IP_RxTask, optional.
- #endif
- OS_CREATETASK(&_PTPcTCB, "PTPClient", _PTPcTask, TASK_PRIO_IP_PTPC , _PTPcStack); // Start the PTP client.
- IP_AddStateChangeHook(&_StateChangeHook, _OnStateChange); // Register hook to be notified on disconnects.
- IP_Connect(_IFaceId); // Connect the interface if necessary.
- OS_SetPriority(OS_GetTaskID(), 255); // Now this task has highest prio for real-time application. This is only allowed when this task does not use blocking IP API after this point.
- while (IP_IFaceIsReadyEx(_IFaceId) == 0) {
- OS_Delay(50);
- BSP_ToggleLED(1);
- }
- //
- // Start Webserver
- //
- OS_CREATETASK(&_WEBServer_TCB, "Webserver", WebserverTask, TASK_PRIO_WEBS_PARENT, _WEBServer_Stack);
to Here (below). Is this acceptable? Are there any consequences with starting the PTP Client later in the IP/Ethernet setup process?
C Source Code
- IP_Init();
- IP_AddLogFilter(IP_MTYPE_APPLICATION);
- _IFaceId = IP_INFO_GetNumInterfaces() - 1; // Get the last registered interface ID as this is most likely the interface we want to use in this sample.
- OS_SetPriority(OS_GetTaskID(), TASK_PRIO_IP_TASK); // For now, this task has highest prio except IP management tasks.
- OS_CREATETASK(&_IPTCB , "IP_Task" , IP_Task , TASK_PRIO_IP_TASK , _IPStack); // Start the TCP/IP_Task.
- #if USE_RX_TASK
- OS_CREATETASK(&_IPRxTCB , "IP_RxTask" , IP_RxTask , TASK_PRIO_IP_RX_TASK, _IPRxStack); // Start the IP_RxTask, optional.
- #endif
- IP_AddStateChangeHook(&_StateChangeHook, _OnStateChange); // Register hook to be notified on disconnects.
- IP_Connect(_IFaceId); // Connect the interface if necessary.
- OS_SetPriority(OS_GetTaskID(), 255); // Now this task has highest prio for real-time application. This is only allowed when this task does not use blocking IP API after this point.
- while (IP_IFaceIsReadyEx(_IFaceId) == 0) {
- OS_Delay(50);
- BSP_ToggleLED(1);
- }
- OS_CREATETASK(&_PTPcTCB, "PTPClient", _PTPcTask, TASK_PRIO_IP_PTPC , _PTPcStack); // Start the PTP client.
- //
- // Start Webserver
- //
- OS_CREATETASK(&_WEBServer_TCB, "Webserver", WebserverTask, TASK_PRIO_WEBS_PARENT, _WEBServer_Stack);