Hi Daniel
Very grateful to reply in a timely manner.
The code in the tcpip.c (MQX version 3.8)
- while (1)
- {
- tcpip_msg = (TCPIP_MESSAGE_PTR)RTCS_msgq_receive(tcpip_qid, timeout, RTCS_data_ptr->TCPIP_msg_pool);
- if (tcpip_msg)
- {
- timebefore = RTCS_time_get();
- if (NULL != tcpip_msg->COMMAND)
- {
- tcpip_msg->COMMAND(tcpip_msg->DATA);
- }
- RTCS_msg_free(tcpip_msg);
- }
- timeout = TCP_tick();
- timeafter = RTCS_time_get();
- timedelta = RTCS_timer_get_interval(timebefore, timeafter);
- timedelta = TCPIP_Event_time(timedelta);
-
- if (timedelta != 0)
- {
- if ((timedelta < timeout) || (timeout == 0))
- {
- timeout = timedelta;
- timebefore = timeafter;
- }
- }
- }
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:
- while (1)
- {
- tcpip_msg = (TCPIP_MESSAGE_PTR)RTCS_msgq_receive(tcpip_qid, timeout, RTCS_data_ptr->TCPIP_msg_pool);
- if (tcpip_msg)
- {
- //timebefore = RTCS_time_get();
- if (NULL != tcpip_msg->COMMAND)
- {
- tcpip_msg->COMMAND(tcpip_msg->DATA);
- }
- RTCS_msg_free(tcpip_msg);
- }
- timeout = TCP_tick();
- timeafter = RTCS_time_get();
- timedelta = RTCS_timer_get_interval(timebefore, timeafter);
- timedelta = TCPIP_Event_time(timedelta);
- timebefore = timeafter;
-
- if (timedelta != 0)
- {
- if ((timedelta < timeout) || (timeout == 0))
- {
- timeout = timedelta;
- //timebefore = timeafter;
- }
- }
- }
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.