How to stop RTCS_ping() while awaiting ICMP echo reply before the TIMEOUT expires

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

How to stop RTCS_ping() while awaiting ICMP echo reply before the TIMEOUT expires

Jump to solution
810 Views
icelee
Contributor III


hello


I'm using MQX 4.2.0.2 RTCS_ping() on FRDM-K64F.

I created a PING task using RTCS_ping() to regularly check the network.
And I know it will block the PING task while await ICMP echo reply.


Now the situation is,
After RTCS_ping() be executed, while awaiting ICMP echo reply before the TIMEOUT expires,
in some cases, PING task needs to be restart using _task_restart() by the MAIN task.
Although the return value of _task_restart() is MQX_OK,
in fact, PING task doesn't work after 'restart'.


Does anyone know how to stop the wait of ICMP echo reply before the TIMEOUT expires?

Thanks.

Tags (1)
0 Kudos
1 Solution
619 Views
icelee
Contributor III

I found the way to stop RTCS_ping() while awaiting ICMP echo reply before the TIMEOUT expires.


[Solution]

point is
・Remove the ICMP echo send info in ICMP config chain (Can get by RTCS_getcfg(ICMP))
・Cancel the TCPIP timer event used for PING expire (TCPIP_Event_cancel())


Refer to the ICMP echo reply code can be achieved.

---------------------------------------------------------
Freescale_MQX_4_2\rtcs\source\tcpip\icmp.c

void ICMP_service(){
...
   case ICMPTYPE_ECHO_REPLY:

}
---------------------------------------------------------


Now PING task runs well after _task_restart().

View solution in original post

0 Kudos
3 Replies
620 Views
icelee
Contributor III

I found the way to stop RTCS_ping() while awaiting ICMP echo reply before the TIMEOUT expires.


[Solution]

point is
・Remove the ICMP echo send info in ICMP config chain (Can get by RTCS_getcfg(ICMP))
・Cancel the TCPIP timer event used for PING expire (TCPIP_Event_cancel())


Refer to the ICMP echo reply code can be achieved.

---------------------------------------------------------
Freescale_MQX_4_2\rtcs\source\tcpip\icmp.c

void ICMP_service(){
...
   case ICMPTYPE_ECHO_REPLY:

}
---------------------------------------------------------


Now PING task runs well after _task_restart().

0 Kudos
619 Views
danielchen
NXP TechSupport
NXP TechSupport

HI Bing:

I suggest you check the state and priority of ping_task after restart.

In MQX, Task can create, destroy , block, set ready and restart.

_task_create() _task_destroy() _task_block() _task_ready() _task_restart()

Regards

Daniel

0 Kudos
619 Views
icelee
Contributor III

HI Daniel:


Thank you for the reply.

As your suggest,
I added "STATE of TD_STRUCT_PTR" and "_task_get_priority" to get the state and priority of PING task
before restart and after restart.


[result is below]

-----------------------------------------------------------------------------------------------
before restart --- Ping task priority: 10.    <-- priority is 10
before restart --- Ping task state: 13.       <-- state is SEND_BLOCKED

..._task_restart() Ping_task OK.

after restart --- Ping task priority: 10.     <-- priority is 10
after restart --- Ping task state: 2.         <-- state is SEND_BLOCKED

... after 1 sec get again

after restart --- Ping task priority: 10.     <-- priority is 10
after restart --- Ping task state: 11.        <-- state is UNHANDLED_INT_BLOCKED

... and then always get the same results

after restart --- Ping task priority: 10.
after restart --- Ping task state: 11.
-----------------------------------------------------------------------------------------------


After _task_restart(), the state of PING task was from READY turn to UNHANDLED_INT_BLOCKED.

It seems that unhandled interrupt or exception occurs happened ?


Regards

Bing

0 Kudos