Hello,
The last couple of days I’ve been busy with getting the plus TCP stack for FreeRTOS to work on my Nucleo-144 STM32F767ZI discovery board. The project has been set-up using STM32CubeMX, and altered to include the plus TCP stack.
I’ve followed the tutorial as described in: TCP_Networking_Tutorial.html
(removing all standard STM32 HAL ETH drivers etc.) I am not getting any errors when I try to flash a client TCP application to the STM32. The PHY seems to be chosen correctly by the library (PHY_ID_LAN8742A
).
I’ve also created a Python script to create an echo server, that is not based on a STM32:
import socket
import sys
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Bind the socket to the port
server_address = ('192.168.0.2', 7)
print('starting up on {} port {}'.format(*server_address))
sock.bind(server_address)
# Listen for incoming connections
sock.listen(1)
while True:
# Wait for a connection
print('waiting for a connection')
connection, client_address = sock.accept()
try:
print('connection from', client_address)
# Receive the data in small chunks and retransmit it
while True:
data = connection.recv(16)
print('received {!r}'.format(data))
if data:
print('sending data back to the client')
connection.sendall(data)
else:
print('no data from', client_address)
break
finally:
# Clean up the connection
connection.close()
When I try to connect my STM32 client to my Python echo server, an ARP package is received and responded to (see my uploaded Wireshark PCAP). Although, I can’t seem to find any TCP packages.
I’ve updated the FreeRTOS kernel to this version: b0a8bd8f28d0138b5eb70e8b53da3e9d17ce8d40
After a bit of debugging, and adding extra FreeRTOS_debug_printf
statements into the FreeRTOS code, I found out that the function prvTCPConnectStart(pxSocket, pxAddress)
does return a correct result, but the function FreeRTOS_issocketconnected( pxSocket );
always returns 0 (this needs to be a 1). Because of this issocketconnected
return val, I get an pdFREERTOS_ERRNO_ETIMEDOUT
error from my FreeRTOS_connect()
call.
I can’t seem to figure out why this call gets timed out.
Hopefully someone else might have a clue where I could look next.
Thanks in advance!
Kind regards,
Mats de Waard
P.S. attachments are as follows:
- Wireshark proof that ARP works
- Source code and header files (that I made, so not the TCP IP stack/FreeRTOS lib)
Attachments can be downloaded from (I am new FreeRTOS forum user, so I can’t upload directly, please remove all the ‘;’ semicolumns):
https://;;;;;;;drive.google;;;;;;;.com/f;;;;;;ile/d/1LWGy;;;;;bQNprNmkk905KnWJMNFFQNLRUHBf/view?u;;;;;;sp=sharing