RTCS_time_get?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,367件の閲覧回数
gaozida
Contributor II

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

タグ(1)
0 件の賞賛
返信
1 解決策
1,163件の閲覧回数
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,163件の閲覧回数
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,164件の閲覧回数
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 件の賞賛
返信