RTCS_time_get?

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

RTCS_time_get?

跳至解决方案
1,362 次查看
gaozida
Contributor II

The returned value of RTCS_time_get small than the real time, why? thanks.

标记 (1)
0 项奖励
回复
1 解答
1,158 次查看
gaozida
Contributor II

Hi Daniel

     Very grateful to reply in a timely manner.

      The code in the tcpip.c (MQX version 3.8)

  1. while (1)
  2. {
  3.   tcpip_msg = (TCPIP_MESSAGE_PTR)RTCS_msgq_receive(tcpip_qid, timeout, RTCS_data_ptr->TCPIP_msg_pool);
  4.   if (tcpip_msg)
  5.   {
  6.   timebefore = RTCS_time_get();
  7.   if (NULL != tcpip_msg->COMMAND)
  8.   {
  9.   tcpip_msg->COMMAND(tcpip_msg->DATA);
  10.   }
  11.   RTCS_msg_free(tcpip_msg);
  12.   }  
  13.   timeout = TCP_tick();
  14.   timeafter = RTCS_time_get();
  15.   timedelta = RTCS_timer_get_interval(timebefore, timeafter);
  16.   timedelta = TCPIP_Event_time(timedelta);  
  17.        
  18.   if (timedelta != 0)
  19.   {
  20.   if ((timedelta < timeout) || (timeout == 0))
  21.   {
  22.   timeout = timedelta;
  23.   timebefore = timeafter;
  24.   }
  25.   }
  26. }

The exception is that net will be abnormal. arp frame can not send successfully when the cpu power on before cable disconnection state.

The code is rewritten in MQX version 4.2:

  1. while (1)
  2. {
  3.   tcpip_msg = (TCPIP_MESSAGE_PTR)RTCS_msgq_receive(tcpip_qid, timeout, RTCS_data_ptr->TCPIP_msg_pool);
  4.   if (tcpip_msg)
  5.   {
  6.   //timebefore = RTCS_time_get();
  7.   if (NULL != tcpip_msg->COMMAND)
  8.   {
  9.   tcpip_msg->COMMAND(tcpip_msg->DATA);
  10.   }
  11.   RTCS_msg_free(tcpip_msg);
  12.   }  
  13.   timeout = TCP_tick();
  14.   timeafter = RTCS_time_get();
  15.   timedelta = RTCS_timer_get_interval(timebefore, timeafter);
  16.   timedelta = TCPIP_Event_time(timedelta);  
  17. timebefore = timeafter;
  18.        
  19.   if (timedelta != 0)
  20.   {
  21.   if ((timedelta < timeout) || (timeout == 0))
  22.   {
  23.   timeout = timedelta;
  24.   //timebefore = timeafter;
  25.   }
  26.   }
  27. }

Retest , the exception disappear.

I made a mistake, I thought it was a RTCS_time_get return value error. Thus lead to not call the arp retransmission.

Regards

   gaozida.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,158 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi

Could you please elaborate more on this?

Basic MQX timing is based on ticks. Default value of tick time is 5ms

Regards

Daniel

0 项奖励
回复
1,159 次查看
gaozida
Contributor II

Hi Daniel

     Very grateful to reply in a timely manner.

      The code in the tcpip.c (MQX version 3.8)

  1. while (1)
  2. {
  3.   tcpip_msg = (TCPIP_MESSAGE_PTR)RTCS_msgq_receive(tcpip_qid, timeout, RTCS_data_ptr->TCPIP_msg_pool);
  4.   if (tcpip_msg)
  5.   {
  6.   timebefore = RTCS_time_get();
  7.   if (NULL != tcpip_msg->COMMAND)
  8.   {
  9.   tcpip_msg->COMMAND(tcpip_msg->DATA);
  10.   }
  11.   RTCS_msg_free(tcpip_msg);
  12.   }  
  13.   timeout = TCP_tick();
  14.   timeafter = RTCS_time_get();
  15.   timedelta = RTCS_timer_get_interval(timebefore, timeafter);
  16.   timedelta = TCPIP_Event_time(timedelta);  
  17.        
  18.   if (timedelta != 0)
  19.   {
  20.   if ((timedelta < timeout) || (timeout == 0))
  21.   {
  22.   timeout = timedelta;
  23.   timebefore = timeafter;
  24.   }
  25.   }
  26. }

The exception is that net will be abnormal. arp frame can not send successfully when the cpu power on before cable disconnection state.

The code is rewritten in MQX version 4.2:

  1. while (1)
  2. {
  3.   tcpip_msg = (TCPIP_MESSAGE_PTR)RTCS_msgq_receive(tcpip_qid, timeout, RTCS_data_ptr->TCPIP_msg_pool);
  4.   if (tcpip_msg)
  5.   {
  6.   //timebefore = RTCS_time_get();
  7.   if (NULL != tcpip_msg->COMMAND)
  8.   {
  9.   tcpip_msg->COMMAND(tcpip_msg->DATA);
  10.   }
  11.   RTCS_msg_free(tcpip_msg);
  12.   }  
  13.   timeout = TCP_tick();
  14.   timeafter = RTCS_time_get();
  15.   timedelta = RTCS_timer_get_interval(timebefore, timeafter);
  16.   timedelta = TCPIP_Event_time(timedelta);  
  17. timebefore = timeafter;
  18.        
  19.   if (timedelta != 0)
  20.   {
  21.   if ((timedelta < timeout) || (timeout == 0))
  22.   {
  23.   timeout = timedelta;
  24.   //timebefore = timeafter;
  25.   }
  26.   }
  27. }

Retest , the exception disappear.

I made a mistake, I thought it was a RTCS_time_get return value error. Thus lead to not call the arp retransmission.

Regards

   gaozida.

0 项奖励
回复