TCP/IP task crashes with MQX_UNHANDLED_INTERRUPT

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

TCP/IP task crashes with MQX_UNHANDLED_INTERRUPT

跳至解决方案
1,014 次查看
bowe
Contributor III

I am seeing an issue that causes the TCP/IP task to crash with "MQX_UNHANDLED_INTERRUPT".  I have installed the unexpected ISR [_int_install_unexpected_isr()], it is says it is vector 0x03, which is a hard fault.  In looking at the call stack in KDS when the hard fault interrupt occurs, there are numerous (at least 50) _isr_execute() instances (namely on the line that calls the actual interrupt handler, which is after an interrupt enable), with nothing in between them and _int_unexpected_isr() at the top.  Is this the cause of the hard fault, is this a KDS bug, or am I seeing something else?

-Bowe

0 项奖励
1 解答
520 次查看
bowe
Contributor III

Ok, I have inserted lines 9-13 below (I assume line 12 is actually what you meant) in the TCP_Close_TCB() in TCP_clos.c, and it is seeming more stable in the 10 minutes of testing (usually the MQX_UNHANDLED_INTERRUPT occurred pretty quickly).  I will continue to test, and reply back in about a week if everything still looks good.

  /*

   ** Cancel timers...

   */

   (void)TCP_Timer_stop(&tcb->sndxmittq.t, tcp_cfg->qhead);

   (void)TCP_Timer_stop(&tcb->sndacktq.t, tcp_cfg->qhead);

   (void)TCP_Timer_stop(&tcb->sndtq.t, tcp_cfg->qhead);

   (void)TCP_Timer_stop(&tcb->rcvtq.t, tcp_cfg->qhead);

   if(tcb->expire.PRIVATE)

   {

       TCPIP_Event_cancel(&tcb->expire);

       tcb->expire.PRIVATE = NULL;

   }

Thanks,

-Bowe

在原帖中查看解决方案

0 项奖励
4 回复数
520 次查看
bowe
Contributor III

In further debugging, it appears that adding small delay in the TCPIP_task() main while loop (in tcpip.c) after getting the TCP/IP message avoids the MQX_UNHANDLED_INTERRUPT issue (of course this is not an acceptable fix).  This seems like it indicates a race condition.  Any ideas as to what this would be and how to fix it?

while(1)

{

     TCPIP_EVENT_PTR queue = TCPIP_Event_head;

     tcpip_msg = (TCPIP_MESSAGE_PTR)RTCS_msgq_receive(tcpip_qid, timeout, RTCS_data_ptr->TCPIP_msg_pool);

     if (tcpip_msg)

     {

          _time_delay(1);  // This line seems to eliminate the MQX_UNHANDLED_INTERRUPT crash

          if (NULL != tcpip_msg->COMMAND)

          {

               tcpip_msg->COMMAND(tcpip_msg->DATA);

          }

          RTCS_msg_free(tcpip_msg);

     }

     ...

}

-Bowe

0 项奖励
520 次查看
RadekS
NXP Employee
NXP Employee

I suppose that this will be probably caused by bug in TCP close in KSDK 1.1. There is problem with canceling timeout events.

As workaround please edit tcp_close.c file and add lines 9-13 below to TCP_Close_TCB() function:

  /*

  ** Cancel timers...

  */

(void)TCP_Timer_stop(&tcb->sndxmittq.t, tcp_cfg->qhead);

(void)TCP_Timer_stop(&tcb->sndacktq.t, tcp_cfg->qhead);

(void)TCP_Timer_stop(&tcb->sndtq.t, tcp_cfg->qhead);

(void)TCP_Timer_stop(&tcb->rcvtq.t, tcp_cfg->qhead);

if(tcb->expire.PRIVATE)

  {

      TCPIP_Event_cancel(&tcb->expire);

      tcb->expier = NULL;

  }

I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

521 次查看
bowe
Contributor III

Ok, I have inserted lines 9-13 below (I assume line 12 is actually what you meant) in the TCP_Close_TCB() in TCP_clos.c, and it is seeming more stable in the 10 minutes of testing (usually the MQX_UNHANDLED_INTERRUPT occurred pretty quickly).  I will continue to test, and reply back in about a week if everything still looks good.

  /*

   ** Cancel timers...

   */

   (void)TCP_Timer_stop(&tcb->sndxmittq.t, tcp_cfg->qhead);

   (void)TCP_Timer_stop(&tcb->sndacktq.t, tcp_cfg->qhead);

   (void)TCP_Timer_stop(&tcb->sndtq.t, tcp_cfg->qhead);

   (void)TCP_Timer_stop(&tcb->rcvtq.t, tcp_cfg->qhead);

   if(tcb->expire.PRIVATE)

   {

       TCPIP_Event_cancel(&tcb->expire);

       tcb->expire.PRIVATE = NULL;

   }

Thanks,

-Bowe

0 项奖励
520 次查看
bowe
Contributor III

Just following up.  This fix seems to have worked.  We have not seen a crash in over a week now.  Thanks again.

-Bowe

0 项奖励