No communication with FreeRTOS-Plus-TCP over the FreeRTOS Windows Port

I am trying to get the FreeRTOS-Plus-TCP working with the FreeRTOS Windows port. I have compiled and I am running the application on a Windows computer with the firewall disabled.

Trying the connectivity test suggested in the FreeRTOS demo webpage, I have tried to ping the ip address. I get “destination host unreachable”, whether I ping from a command prompt on the same computer or whether I ping from a different machine.

In Wireshark, I do not see this as an interface to select, so I selected the regular Ethernet adaptor. Even when I ping, I do not see any traffic with the destination which is the ip address of the demo.

I have tried configuring the demo both with DHCP and with a static IP. When configured for DHCP, it displays an ip address which makes sense in the context of the network to which it is connected.

Any ideas on what could be preventing this demo from working, in the context of the FreeRTOS Windows port?

Thank you.

The stack has a configuration option that enables replying to ping requests. Is that set to 1? On my cell phone at the moment, otherwise I would provide a link.

Thank you for the suggestion. I was not aware of that option.

ipconfigREPLY_TO_INCOMING_PINGS is set to 1

When the application runs, it will send logging to a command windows. Can you copy/paste that logging?

This is what I mean:

The following network interfaces are available:

Interface 1 - rpcap://\Device\NPF_{D7F6B490-...}
              (Network adapter 'WAN Miniport (Network Monitor)' on local host)

Interface 2 - rpcap://\Device\NPF_{3654436B-..}
              (Network adapter 'WAN Miniport (IPv6)' on local host)
...

Interface 6 - rpcap://\Device\NPF_{21A5AEFB-..}
              (Network adapter 'Realtek PCIe GBE Family Controller' on local host)

In my case, I have to use the Realtek adapter, and so I define the following in FreeRTOSCOnfig.h:

#define configNETWORK_INTERFACE_TO_USE         6

I just managed to ping the virtual IP address from a command prompt:

H:\uTorrent\AllFolk\metart\txt>ping 192.168.2.127

Pinging 192.168.2.127 with 32 bytes of data:
Reply from 192.168.2.127: bytes=32 time=11ms TTL=64
Reply from 192.168.2.127: bytes=32 time=26ms TTL=64
Reply from 192.168.2.127: bytes=32 time=113ms TTL=64
Reply from 192.168.2.127: bytes=32 time=88ms TTL=64

The responses are very slow because of the PCAP interface. The project only serves as a demonstration of how to use FreeRTOS and +TCP.

Thank you.

Here is the screen output of the demo program (this example is using DHCP. I have tried with a static ip as well):

The following network interfaces are available:

Interface 1 - rpcap://\Device\NPF_{BF71043C-C211-44E7-9917-2087D7414173}
(Network adapter ‘WAN Miniport (Network Monitor)’ on local host)

Interface 2 - rpcap://\Device\NPF_{4DB694B3-ECED-411F-A83F-364816C13F73}
(Network adapter ‘WAN Miniport (IPv6)’ on local host)

Interface 3 - rpcap://\Device\NPF_{3CB64AE1-D855-4749-8765-77C6B61092D6}
(Network adapter ‘WAN Miniport (IP)’ on local host)

Interface 4 - rpcap://\Device\NPF_{1C58D63F-B494-4C7C-A833-0928336ABFE8}
(Network adapter ‘Intel(R) Ethernet Connection I217-LM’ on local host)

Interface 5 - rpcap://\Device\NPF_Loopback
(Network adapter ‘Adapter for loopback traffic capture’ on local host)

Interface 6 - rpcap://\Device\NPF_{C8AD5527-1069-4D88-9EE6-7A906E947907}
(Network adapter ‘TAP-Windows Adapter V9’ on local host)

The interface that will be opened is set by “configNETWORK_INTERFACE_TO_USE”, which
should be defined in FreeRTOSConfig.h
Attempting to open interface number 4.
Successfully opened interface number 4.
0 789 [IP-task] vDHCPProcess: offer 192.168.0.102
vDHCPProcess: offer 192.168.0.102
1 829 [IP-task]

IP Address: 192.168.0.102
Subnet Mask: 255.255.255.0
2 829 [IP-task] Gateway Address: 192.168.0.1
DNS Server Address: 192.168.0.1

This from the command prompt:

Pinging 192.168.0.102 with 32 bytes of data:
Request timed out.
Request timed out.
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.

Ping statistics for 192.168.0.102:
Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),

C:\Users\User>ping 192.168.0.102

Pinging 192.168.0.102 with 32 bytes of data:
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.

Ping statistics for 192.168.0.102:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Here are the results using a static IP:

The following network interfaces are available:

Interface 1 - rpcap://\Device\NPF_{BF71043C-C211-44E7-9917-2087D7414173}
(Network adapter ‘WAN Miniport (Network Monitor)’ on local host)

Interface 2 - rpcap://\Device\NPF_{4DB694B3-ECED-411F-A83F-364816C13F73}
(Network adapter ‘WAN Miniport (IPv6)’ on local host)

Interface 3 - rpcap://\Device\NPF_{3CB64AE1-D855-4749-8765-77C6B61092D6}
(Network adapter ‘WAN Miniport (IP)’ on local host)

Interface 4 - rpcap://\Device\NPF_{1C58D63F-B494-4C7C-A833-0928336ABFE8}
(Network adapter ‘Intel(R) Ethernet Connection I217-LM’ on local host)

Interface 5 - rpcap://\Device\NPF_Loopback
(Network adapter ‘Adapter for loopback traffic capture’ on local host)

Interface 6 - rpcap://\Device\NPF_{C8AD5527-1069-4D88-9EE6-7A906E947907}
(Network adapter ‘TAP-Windows Adapter V9’ on local host)

The interface that will be opened is set by “configNETWORK_INTERFACE_TO_USE”, which
should be defined in FreeRTOSConfig.h
Attempting to open interface number 4.
Successfully opened interface number 4.
0 9 [IP-task]

IP Address: 192.168.0.103
Subnet Mask: 255.255.255.0
1 9 [IP-task] Gateway Address: 192.168.0.1
DNS Server Address: 192.168.0.1

And from the console:

C:\Users\User>ping 192.168.0.103

Pinging 192.168.0.103 with 32 bytes of data:
Request timed out.
Request timed out.
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.

Ping statistics for 192.168.0.103:
Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),

C:\Users\User>ping 192.168.0.103

Pinging 192.168.0.103 with 32 bytes of data:
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.

Ping statistics for 192.168.0.103:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

C:\Users\User>ping 192.168.0.103

Pinging 192.168.0.103 with 32 bytes of data:
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.
Reply from 192.168.0.101: Destination host unreachable.

Ping statistics for 192.168.0.103:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

I would also choose the “Intel(R) Ethernet Connection”.

There seems to be a bit of communication:

0 789 [IP-task] vDHCPProcess: offer 192.168.0.102

and also I see a valid set of parameters:

IP Address: 192.168.0.102
Subnet Mask: 255.255.255.0
Gateway Address: 192.168.0.1
DNS Server Address: 192.168.0.1

Could you try looking with a “network sniffer” like WireShark or tcpdump?
I think that you will see traffic for DHCP and also there will be ARP packets.
If you want you can attach a zipped PCAP file to your post and I will look at it.
Possibly someone has to grant you permission to attach files, we will see.

PS I commented this line in Logging_WinSim.c:

    xLength = snprintf( cPrintString, dlMAX_PRINT_STRING_LENGTH, ...
    /* Remove the following line: */
    //xAfterLineBreak = pdFALSE;

because it kills the logging.

Yes, there is definitely some communication since the demo can get an ip address via DHCP.

I discovered today that, at some point during my experimenting yesterday, I left the demo running in the background when running another copy; I don’t know exactly at what point during my testing this happened. However, I now made sure that I only had the one current (DHCP) copy running, and I looked in Wireshark. I see the ARP and DHCP communication, but, when pinging, I don’t see the demo (currently it is ip address 192.168.0.100) responding. I have attached the Wireshark log.

Wireshark capture.zip (14.8 KB)

Thank you for the PCAP.

I also see UDP messages:

Server received (not zero copy): Message number 0
Server received (not zero copy): Message number 1
Server received (not zero copy): Message number 2
Server received (not zero copy): Message number 3
...

And indeed there is ARP: 192.168.0.102 is looking for 192.168.0.100, possibly because of the ping command.

In packet 940 I see an ICMP packet, from x.x.x.102 to x.x.x.100:

    Protocol: ICMP (1)
    Header Checksum: 0x0000 incorrect, should be 0x50c2
    (may be caused by "IP checksum offload"?)
    [Header checksum status: Bad]
    [Calculated Checksum: 0x50c2]
    Source Address: 192.168.0.102
    Destination Address: 192.168.0.100

I assume that is indeed caused by the fact that IP checksums are offloaded.
To be sure you can check the properties of your network card as show here:

One more question : from what location did you download the WinSim project? I will run it myself and see if it works for me.

Thank you. I did this and I still could not ping.
I see above a suggestion to choose the other Ethernet adaptor. I had previously used that one. The one I am currently using is separate from the company network and its policies, which I thought might have been interfering; this is a router with just this computer connected to it.

I did at one point connect a laptop to the router as well, and try to ping from it, but that was before the change you suggested. I do not have that computer available today.

I got to the project from here.

@Batya Are you able to ping your machine or the simulator from another machine on the same network?

Perhaps your ethernet switch does not have “hairpin” mode enabled, is limiting each port to a single MAC address, or there is some kind of firewall filtering out packets.

Which version of windows/ winpcap / npcap are you using?

Also check if you have any other pcap or tun/tap drivers in use, since they may conflict.

Is this issue resolved? I try to do the same thing. I can ping from the FreeRTOS CLI to the host, but cannot ping the FreeRTOS app from the host. I set ipconfigREPLY_TO_INCOMING_PINGS to 1.
I have 11 network interfaces. None of them worked:
The following network interfaces are available:

Interface 1 - rpcap://\Device\NPF_{A7EF5992-581C-42C0-AAA8-31A76394C8DD}
(Network adapter ‘WAN Miniport (Network Monitor)’ on local host)

Interface 2 - rpcap://\Device\NPF_{3DF2A0EA-AE30-468F-A834-6455FB8CD98D}
(Network adapter ‘WAN Miniport (IPv6)’ on local host)

Interface 3 - rpcap://\Device\NPF_{628A48B7-D1A7-454C-98B0-760E7A68400E}
(Network adapter ‘WAN Miniport (IP)’ on local host)

Interface 4 - rpcap://\Device\NPF_{9EAF0289-342C-443F-A04D-BBCFB0E5A167}
(Network adapter ‘Intel(R) Wi-Fi 6E AX211 160MHz’ on local host)

Interface 5 - rpcap://\Device\NPF_{68740B9D-9023-4E50-9340-1A4C1282FD70}
(Network adapter ‘Microsoft Wi-Fi Direct Virtual Adapter #2’ on local host)

Interface 6 - rpcap://\Device\NPF_{6A1ADE64-D7F0-45FC-810D-A43E8A320F60}
(Network adapter ‘Microsoft Wi-Fi Direct Virtual Adapter’ on local host)

Interface 7 - rpcap://\Device\NPF_{BD9029FC-CF37-42A0-9745-4EEEC31B3190}
(Network adapter ‘Microsoft KM-TEST Loopback Adapter’ on local host)

Interface 8 - rpcap://\Device\NPF_{4AF3EB31-4D25-445C-B3CA-46DCEAD5429A}
(Network adapter ‘Realtek USB GbE Family Controller’ on local host)

Interface 9 - rpcap://\Device\NPF_{CE006E3A-EE52-4A66-930F-844F4CD3FFD6}
(Network adapter ‘Hyper-V Virtual Ethernet Adapter’ on local host)

Interface 10 - rpcap://\Device\NPF_Loopback
(Network adapter ‘Adapter for loopback traffic capture’ on local host)

Interface 11 - rpcap://\Device\NPF_{AE67E0D0-99FF-43CA-9606-206757B7BEB2}
(Network adapter ‘Intel(R) Ethernet Connection (17) I219-LM’ on local host)

The interface that will be opened is set by “configNETWORK_INTERFACE_TO_USE”, which
should be defined in FreeRTOSConfig.h
Attempting to open interface number 7.
Successfully opened interface number 7.

Hi @stevwu,
Welcome to FreeRTOS community!

Could you help elaborate more on your environment setting?
Like what version of FreeRTOS-Plus-TCP are you using?
And what IP address do you set on the interface?

I’ve never tried on loopback interface. Could you help try interface 4 or 11? (4 if you’re using wifi, 11 if you’re using ethernet)

Thank you.

Thank you for your reply. I am using FreeRTOS-Plus-IP V202112.00. Actually the interface number 8 worked fine. Now, I have another problem. We have a project worked on Xilinx ZCU104 and try to run it on the Windows port. After running a few minutes, it stuck in the infinite loop of prvWinPcapRecvThread function. All other tasks did not have a chance to run. What should I look for?

Hi @stevwu,
I’m not sure if I understand what you mean correctly. Are you trying to use Windows port into Xilinx project and flash it into ZCU104 platform? Then it stucks in prvWinPcapRecvThread function? If so, that won’t work because you’re using totally different hardware compared to Windows one.

Assuming you’re using Zynq UltraScale+ MPSoC ZCU104 Evaluation Kit. Could you help try xilinx_ultrascale network interface in your project?

Thank you.

Hi ActoryOu,
Thank you for your reply again. It is another way. We have the FreeRTOS application on the Xilinx board running and try to get it running on the Windows port. Then it stuck in prvWinPcapRecvThread function. The application code is complicated and it may be easier to debug in some cases in the Windows port.
Thanks,

How did you verify that the code is stuck in this thread? Did you put breakpoints in other tasks and those are not getting hit? If so, can you check if those tasks are in the ready list?

We have a syslog and expect at least one message every 3 seconds. I did not see anything anymore after a random number of minutes. The CLI console was frozen. I could not type anything. When I hit the pause button on Visual Studio. The cursor always pointed to the pap_dispatch function call. How do I see the task list’s state when the CLI is not working?

Thanks,

Is your code using any Windows system calls, such as writing to the console (what does the CLI use for IO?), writing to disk, etc.? That can cause Windows to block threads that are running FreeRTOS tasks, which can cause hangs. There are methods of sending IO to Windows threads that are outside the control of the FreeRTOS scheduler so that doesn’t happen.

Just add to my previous email. I checked the Thread on the VS, all stopped at
void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber )
{


ReleaseMutex( pvInterruptEventMutex );


}

Thanks,