why the mainLoopTask gone while run the lwip_FreeRTOS_s32k396 project for half an hour

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

why the mainLoopTask gone while run the lwip_FreeRTOS_s32k396 project for half an hour

171 次查看
zhangzhixing
Contributor III

why the mainLoopTask gone while run the lwip_FreeRTOS_s32k396 project for half an hour ,i import the profinet master control code and run the program ,got the below:the #1 task which is mainLoopTask  is missing.

zhangzhixing_0-1754126647621.png

 

static void mainLoopTask(void* pvParameters)
{
(void)pvParameters;

/* initialize lwIP stack, network interfaces and applications */
#if !NO_SYS
err_t err;
sys_sem_t init_sem;

#if defined (CPU_MPC5777C)|| defined (CPU_MPC5746R)
#ifdef PIT_0
#define PIT PIT_0
#endif
PIT->MCR &= (uint32_t)(~PIT_MCR_FRZ_MASK);/* stop the timer in debug workaround for compability on MPC5777C PIT timer*/
#endif

err = sys_sem_new(&init_sem, 0);
LWIP_ASSERT("failed to create init_sem", err == (err_t)ERR_OK);
LWIP_UNUSED_ARG(err);
tcpip_init(test_init, (void*)&init_sem);
/* we have to wait for initialization to finish before
* calling update_adapter()! */
(void)sys_sem_wait(&init_sem);
sys_sem_free(&init_sem);
#if (LWIP_SOCKET || LWIP_NETCONN) && LWIP_NETCONN_SEM_PER_THREAD
netconn_thread_init();
#endif
#else /* !NO_SYS */
sys_init();
lwip_init();
test_init(NULL);
#endif /* !NO_SYS */


#if LWIP_INIT_COMPLETE_CALLBACK
tcpip_init_complete_callback();
#endif /* LWIP_INIT_COMPLETE_CALLBACK */
// vJYBus_SetCyclicDataSize(4,4);
/* MAIN LOOP for driver update (and timers if NO_SYS) */
while (1) {
#if NO_SYS
/* handle timers (already done in tcpip.c when NO_SYS=0) */
sys_check_timeouts();
#else /* NO_SYS */
// sys_msleep(500);
// ucTestOut[0]++;
// ucTestOut[1]++;
// ucTestOut[2]++;
// ucTestOut[3]++;
// JYBus_WriteCylicData(ucTestOut, 4);

#endif /* NO_SYS */

#if defined(USING_RTD)
uint32 time_now = OsIf_GetMilliseconds();
#else /* USING_RTD */
uint32_t time_now = OSIF_GetMilliseconds();
#endif /* USING_RTD */
time_now = time_now / (double)1000;

/* If more than expected time passed during tests execution, shut down the stack */
if (time_now - start_time >= tests_timeout)
{
for(int i = 0 ; i < ETHIF_NUMBER ; i++)
{
ETHIF_SHUTDOWN(&network_interfaces[i]);
}

end_tcpip_execution(NULL);
}

}

#if (LWIP_SOCKET || LWIP_NETCONN) && LWIP_NETCONN_SEM_PER_THREAD
netconn_thread_cleanup();
#endif
/* release the network interfaces... */
for(int i = 0 ; i < ETHIF_NUMBER ; i++)
{
ETHIF_SHUTDOWN(&network_interfaces[i]);
}
}

标记 (1)
0 项奖励
回复
1 回复

143 次查看
PavelL
NXP Employee
NXP Employee

Hello @zhangzhixing ,

Please comment out the entire timeout section in the code, as I typically do when bringing up lwIP examples on various boards:

PavelL_0-1754295798109.png

The variable tests_timeout is set to 1200, which corresponds to 20 minutes. After this period, the code explicitly shuts down the Ethernet interfaces and calls end_tcpip_execution(NULL), which may internally terminate the mainLoopTask.

Best regards,

Pavel

0 项奖励
回复