Hello,
I’m trying to send a simple TCP packet to a TCP server on the w5500-evb-pico.
w5500-evb-pico (TCP client) → PC (packetSender TCP server)
When I send a TCP packet with packet sender application to the TCP server IP I receive the packet correctly.
Because i don’t get the status SOCK_ESTABLISHED it’s not possible to send data.
Code to init socket:
uint16_t any_port = 1000;
socket(sn, Sn_MR_TCP, any_port, 0x00);
while (getSn_SR(sn) != SOCK_INIT)
;
After a few seconds, I get SOCK_INIT (0x13)
So this seems OK.
Code to connect:
sn = 0; // using only the socket 0
uint Serverip[4] = {192, 168, 201, 55}; // set Server(destination) IP
uint Serverport = 54858; // set Server(destination) port
connect(sn, Serverip, Serverport);
while (getSn_SR(sn) != SOCK_ESTABLISHED)
;
The above will never get to SOCK_ESTABLISHED (0x17) instead it gets stuck on SOCK_SYNSENT (0x15)
The TCP server does have the ports opened, I can send with another PC with packetSender to the server with packetSender.
I add the complete code block, you can add it to the w5x00_loopback.c example.
wizchip_spi_initialize();
wizchip_cris_initialize();
wizchip_reset();
wizchip_initialize();
wizchip_check();
network_initialize(g_net_info);
print_network_information(g_net_info);
int32_t ret; // return value for SOCK_ERRORs
uint16_t sn = 0; // using only the socket 0
uint16_t any_port = 1000;
// init socket
socket(sn, Sn_MR_TCP, any_port, 0x00);
while (getSn_SR(sn) != SOCK_INIT)
;
// connect part
sn = 0; // using only the socket 0
uint Serverip[4] = {192, 168, 201, 55}; // set Server(destination) IP
uint Serverport = 54858; // set Server(destination) port
connect(sn, Serverip, Serverport);
while (getSn_SR(sn) != SOCK_ESTABLISHED)
;
// basic send, just to see if it works
send(sn, "test", strlen("test"), 0);
Does anybody have more information or a minimal example how to send a TCP packet?