Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Ping Utility with FreeRTOS

Posted by shaanktn on December 28, 2016

I am using FreeRTOS-TCP on customized platform. RTOS is UP and able to ping the board(where RTOS is deployed) from device on network, and able to capture packets on WireShark. But, my requirement is to ping to any system on network from board. For this I am using "FreeRTOSSendPingRequest()" with my required IP and other parameters as default(as given here: http://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusUDP/API/FreeRTOSSendPingRequest.shtml). I am able to receive the "usRequestSequenceNumber" incremented, but no packet is captured in WireShark. Am I missing something with Wireshark or any RTOS configuration ? Any Input will be helpful.

Thanks,


Ping Utility with FreeRTOS

Posted by rtel on December 28, 2016

If I understand you correctly, outgoing pings are working from the FreeRTOS+TCP device, but you just aren't seeing them in Wireshark. Are you seeing any pings in Wireshark? If not then maybe Wireshark is configured to filter out ICMP messages.


Ping Utility with FreeRTOS

Posted by shaanktn on January 2, 2017

Thanks. Looks like some issue with other thread of my platform, which is not allowing packet to be transmitted. I am able to see ping packets in wireshark if requested from PC. But was not seen if requested from board. But now I am able to capture it after some time.


Ping Utility with FreeRTOS

Posted by shaanktn on January 18, 2017

Hi all, I have one more issue now. As I told I am using "FreeRTOSSendPingRequest" for ping test. I am able to ping it without any problem for some 900-1000 packets(I track sequence number in Wireshark) but after that the API wil return NULL. When I tracked the flow, observed that "xSemaphoreTake()" is failing. I am using BufferAllocation2. Any input will be helpful. Thanks,


Ping Utility with FreeRTOS

Posted by heinbali01 on January 18, 2017

Hi,

What platform are you using?

How often are you calling FreeRTOS_SendPingRequest()? You might want to call uxGetNumberOfFreeNetworkBuffers() before sending a ping to know if there is enough space. Maybe you're asking too much of the interface?

If you're not sending too often, please check uxGetMinimumFreeNetworkBuffers() regularly to see if the number of free buffers is gradually decreasing.

Are you using the latest release 160919?


Ping Utility with FreeRTOS

Posted by shaanktn on January 18, 2017

Hi Hein, That was useful. I am usign STM32F on customised platform. uxGetNumberOfFreeNetworkBuffers() went on decreasing, and yeah no more freebuffers. Any way to refresh it or release the buffer back after ping ? I can use "vReleaseNetworkBufferAndDescriptor() ?". Why not the buffers are being released in my case ? That supposed to happen I believe ? I am just checking ping, so it is like contineously sending and receiving packets, I can say it is non stopping! No, I am using 160112.

Thanks,


Ping Utility with FreeRTOS

Posted by heinbali01 on January 18, 2017

Thanks for reporting back.I rarely ping from an embedded device, so I will first check FreeRTOS_SendPingRequest(), see if it is 'leaking' Network Buffers. As you can see in the code, it passes every buffer to the IP-task. If passing fails, the allocated Network Buffer will be released by calling vReleaseNetworkBufferAndDescriptor() :

~~~~ BaseTypet FreeRTOSSendPingRequest( uint32t ulIPAddress, sizet xNumberOfBytesToSend, TickTypet xBlockTimeTicks ) { ... if( xSendEventStructToIPTask( &xStackTxEvent, xBlockTimeTicks) != pdPASS ) { vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer ); iptraceSTACKTXEVENTLOST( ipSTACKTXEVENT ); } else { xReturn = usSequenceNumber; } ~~~~

Hein


Ping Utility with FreeRTOS

Posted by shaanktn on January 18, 2017

Hi Hein, Yea that was my initial thought that it should be cleared there. I believe the leak is not present in that place for me, I somehow feel the leak is happening in "prvNetworkInterfaceInput()". I need to confirm it, any ways will update you the observations. Thanks,


Ping Utility with FreeRTOS

Posted by heinbali01 on January 18, 2017

Hi Shaank,

I can not find a leakage. What I just did is implement this hook:

~~~~ void vApplicationPingReplyHook( ePingReplyStatust eStatus, uint16t usIdentifier ) ~~~~

As soon as it is called (i.e. my ping has been replied), it will wake-up the task that calls FreeRTOS_SendPingRequest().

So it becomes a chain:

~~~~ void vPingTask( void *pvArgument ) { for (;;) { ulTaskNotifyTake( pdFALSE, ulMaxBlockTime ); FreeRTOSSendPingRequest(); } } void vApplicationPingReplyHook( ePingReplyStatust eStatus, uint16_t usIdentifier ) { if (eStatus == eSuccess) { xTaskNotifyGive( xPingTaskHandle ); } } ~~~~

In this way I'm able to exchange thousands of ICMP messages, without ever running out of Network Buffers. ulMaxBlockTime makes sure that if a ping doesn't get answered, the chain won't be broken because a next ping will be sent.

Could you try something like the above and see what happens?


Ping Utility with FreeRTOS

Posted by shaanktn on January 19, 2017

Hi, Thanks Hein, Currently I am having it like, ~~~ //THIS WILL BE CALLED IN LOOP FROM MY CODE... RequestSequenceNum = FreeRTOSSendPingRequest(..); if( RequestSequenceNum == pdFAIL ) { } else { //custom code.. if( xQueueReceive( xPingReplyQueue, &ReplySequenceNum, 200 / portTICKPERIODMS ) == pdPASS ) { if( RequestSequenceNum == ReplySequenceNum ) { //custom code.. } } ~~~ And in "vApplicationPingReplyHook() " I am just updating the queue like ~~~ if (eStatus == eSuccess) { xQueueSend( xPingReplyQueue, &usIdentifier, 10 / portTICKPERIOD_MS ); } ~~~ Any issues ? Thanks,


Ping Utility with FreeRTOS

Posted by shaanktn on May 4, 2017

Hi all, There is no issue as such with the available code. Later I got that the leak is happening with the other modules added by me. Ping works well for days! Thanks, Shaank


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS