# Can't get LWIP to connect

**URL:** <https://forums.freertos.org/t/cant-get-lwip-to-connect/15452>\
**Category:** NXP\
**Created:** [July 12, 2022, 3:24am UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452 "2022-07-12T03:24:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaeldkfowler](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/michaeldkfowler/32/2698_2.png) [@michaeldkfowler](https://forums.freertos.org/u/michaeldkfowler)\
**Post date:** [July 12, 2022, 3:24am UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/1 "2022-07-12T03:24:48Z")

</div>

Hi All,  
I have been struggling for two weeks trying to get FreeRTOS and LWIP to connect to a server. Most of the time it fails with errno 103. The server and network are known to be working. I would greatly appreciate any help as I have run out of ideas. My code is here: drive .google .com/file/d/1AOdb8qDYk\_2HWSQMwx0rbeSZZw5MjMnc/view?usp=sharing

---

<div class="post-metadata">

**Author:** ![RAc](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rac/32/1389_2.png) [@RAc](https://forums.freertos.org/u/RAc)\
**Post date:** [July 12, 2022, 5:05am UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/2 "2022-07-12T05:05:23Z")

</div>

Can you provide a wireshark trace of the scenario?

What is your target platform? Have you got sample apps for that platform to work?

---

<div class="post-metadata">

**Author:** ![michaeldkfowler](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/michaeldkfowler/32/2698_2.png) [@michaeldkfowler](https://forums.freertos.org/u/michaeldkfowler)\
**Post date:** [July 12, 2022, 5:49am UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/3 "2022-07-12T05:49:44Z")

</div>

I’m using the RT1050 EVK. I had a similar demo working and have compared the two projects for differences, but don’t see anything. Sometimes it sends packets but doesn’t see the response, other times it doesn’t seem to send anything. The lights on the ethernet port are on and indicating activity.

---

<div class="post-metadata">

**Author:** ![michaeldkfowler](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/michaeldkfowler/32/2698_2.png) [@michaeldkfowler](https://forums.freertos.org/u/michaeldkfowler)\
**Post date:** [July 12, 2022, 6:04am UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/4 "2022-07-12T06:04:27Z")

</div>

Here’s the Wireshark trace

 ![image](https://d2v6vdsk2p900z.cloudfront.net/original/2X/c/ca531dbeb6fb02471c8ad62723d97df4af0eb8cb.png)  
and the console log:

```auto
Initializing PHY...
Copyright 2020 NXP

TCP/IP up.
Hello world.

SHELL>> Link Up!
Error connecting: 103
Link Up!
Error connecting: 103
Link Up!
Error connecting: 103
Link Up!
Error connecting: 103
Link Up!
error: socket: 105

```

---

<div class="post-metadata">

**Author:** ![RAc](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rac/32/1389_2.png) [@RAc](https://forums.freertos.org/u/RAc)\
**Post date:** [July 12, 2022, 6:57am UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/5 "2022-07-12T06:57:22Z")

</div>

Is it the physically identical hardware that the working and failing software runs on? If so, the next step would be to dump the contents of all SFRs (in particular interrupt and ethernet controller) in either scenario and compare them against each other. In the next step, you should analyse the PHY communication to see if the PHY gets initialized identically.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [July 12, 2022, 1:57pm UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/6 "2022-07-12T13:57:55Z")

</div>

Will MCUXpresso create a FreeRTOS and lwIP project for you? I have had success doing that in an RT1060.

---

<div class="post-metadata">

**Author:** ![michaeldkfowler](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/michaeldkfowler/32/2698_2.png) [@michaeldkfowler](https://forums.freertos.org/u/michaeldkfowler)\
**Post date:** [July 12, 2022, 2:31pm UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/7 "2022-07-12T14:31:29Z")

</div>

That’s how I started. I feel like there’s a trade condition because it works occasionally.

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [July 12, 2022, 3:44pm UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/8 "2022-07-12T15:44:28Z")

</div>

Looking at your PCAP, I think that the host on 172.16.0.11 is deaf. Meaning that the host is able to send, but it doesn’t receive anything.  
172.16.0.195 looks OK, it receives and it responds.

---

<div class="post-metadata">

**Author:** ![michaeldkfowler](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/michaeldkfowler/32/2698_2.png) [@michaeldkfowler](https://forums.freertos.org/u/michaeldkfowler)\
**Post date:** [July 12, 2022, 3:51pm UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/9 "2022-07-12T15:51:51Z")

</div>

Yes 195 is the PC 11 is the board running FreeRTOS

---

<div class="post-metadata">

**Author:** ![kanherea](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/kanherea/32/4106_2.png) [@kanherea](https://forums.freertos.org/u/kanherea)\
**Post date:** [July 21, 2022, 12:47am UTC](https://forums.freertos.org/t/cant-get-lwip-to-connect/15452/10 "2022-07-21T00:47:44Z")

</div>

Hey @michaeldkfowler,

Can you check whether your device is receiving anything at all? I would set up a break point inside the interrupt handler dealing with incoming data.  
This would allow you to see whether the device is not capable of receiving data due to misconfiguration or is it able to receive data but the stack is not performing its job.
