Quality RTOS & Embedded Software

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


Freertos_connect always timesout

Posted by frankthetank34 on May 6, 2016


I have ported over the tcp stack to the tiva tm4c1294 launchpad. I am playing with socket connections.

I successfully get assigned a ip address via dhcp. Using wireshark, I also see my device periodically sending out a Gradtuitous ARP for (my ip address). Makes me believe my device is talking. However, when I setup a socket, I can never get it to successfully connect. The value returned is a 116, or pdFREERTOSERRNOETIMEDOUT.

Any suggestions as to where to go from here?


Freertos_connect always timesout

Posted by rtel on May 7, 2016

What are you trying to connect to? Do you have an external echo server set up, or something similar? If so, could you please post a wireshark log of the attempted communication.

Some links that may be helpful, although I expect you have seen them already: http://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTCP/TCPNetworkingTutorialSendingTCP_Data.html

http://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTCP/TCPEchoClients.html (this one is referring to an example that is in the download).

Freertos_connect always timesout

Posted by heinbali01 on May 8, 2016

Yes a WireShark PCAP file would be useful in this case :-)

Suppose that you want your device to connect to your laptop, for example IP address, port 7.

You can connect to other laptops or devices, but then WireShark may not be able see all traffic.

Make sure that you assign this port 7 in network byte order:

~~~~ addr.sinport = FreeRTOShtons( 7 ); ~~~~

otherwise +TCP will try to connect to port 0x0700 in stead of 0x0007.

A FreeRTOS_connect() will do the following:

  • It will start an ARP lookup request for
  • It waits for a reply to this ARP request
  • It will send out a TCP SYN packet

All three actions should be visible in WireShark.

In case you connect to an outside IP address, the hw address of a router (gateway) will be lookup up.


Freertos_connect always timesout

Posted by heinbali01 on May 8, 2016

Ps. The target IP address can be asigned safely in this way:

~~~~ addr.sinaddr = FreeRTOSinetaddrquick( 192, 168, 2, 100 ); ~~~~

Both FreeRTOS_inet_addr_quick() and FreeRTOS_inet_ntoa() work with IP adddresses in network-byte order (i.e. big endian)

Freertos_connect always timesout

Posted by frankthetank34 on May 11, 2016

Hi Hein,

Your questions and suggestions really helped. I had been using wireshark, but one of the things that confused me was I would only see my dhcp messages go out. Then silence from my device. I am on a switched network. I may be a network newbie but I should have known switches mask messages to network plugs/ports that don't have the inteneded device connected to it.

Once I got around the wireshark issue, I had another light bulb moment. I asked our IT folks to set me up with a connection not behind our network firewall. Turns out that didn't happen. We love to lock things down. Reason I was failing connection was our firewall. I am up an running now, no issues. I was convinced it was my code. I need to learn to trust myself more.

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists