RTCS_time_get?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTCS_time_get?

Jump to solution
1,395 Views
gaozida
Contributor II

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

Tags (1)
0 Kudos
Reply
1 Solution
1,191 Views
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.

View solution in original post

0 Kudos
Reply
2 Replies
1,191 Views
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 Kudos
Reply
1,192 Views
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 Kudos
Reply