hello, im new user. Im using w5500 and stm32 as client to connect to my laptop. i read data by hercules. But when im debugging the program, it stopped at " code = connect(http_socket, addr, 5354);" and return TIMEOUT. I checked server ip and its correct, I don’t know what went wrong. This is my code:
void init() {
wiz_NetTimeout timeout = {
.retry_cnt = 3, //RCR = 3
.time_100us = 5000};
wiz_NetTimeout tmpTimeout;
UART_Printf(“\r\ninit() called!\r\n”);
UART_Printf(“Registering W5500 callbacks…\r\n”);
reg_wizchip_cs_cbfunc(W5500_Select, W5500_Unselect);
reg_wizchip_spi_cbfunc(W5500_ReadByte, W5500_WriteByte);
ver = getVERSIONR();
UART_Printf(“Calling wizchip_init()…\r\n”);
uint8_t rx_tx_buff_sizes = {2, 2, 2, 2, 2, 2, 2, 2};
wizchip_init(rx_tx_buff_sizes, rx_tx_buff_sizes);
wiz_NetInfo netInfo = { .mac = {0x00, 0x08, 0xdc, 0xab, 0xcd, 0xef}, // Mac address
.ip = {198, 168, 1, 90}, // IP address
.sn = {255, 255, 255, 0}, // Subnet mask
.gw = {192, 168, 1, 100}}; // Gateway address
uint8_t dns[4] = {8, 8, 8, 8};
UART_Printf("IP: %d.%d.%d.%d\r\nGW: %d.%d.%d.%d\r\nNet: %d.%d.%d.%d\r\nDNS: %d.%d.%d.%d\r\n",
netInfo.ip[0], netInfo.ip[1], netInfo.ip[2], netInfo.ip[3],
netInfo.gw[0], netInfo.gw[1], netInfo.gw[2], netInfo.gw[3],
netInfo.sn[0], netInfo.sn[1], netInfo.sn[2], netInfo.sn[3],
dns[0], dns[1], dns[2], dns[3]
);
UART_Printf("Calling wizchip_setnetinfo()...\r\n");
wizchip_setnetinfo(&netInfo);
ctlnetwork(CN_SET_TIMEOUT,(void*)&timeout);
ctlnetwork(CN_GET_TIMEOUT, (void*)&tmpTimeout);
uint8_t addr[4] = { 192,168,88,171};
UART_Printf("Creating socket...\r\n");
uint8_t http_socket = HTTP_SOCKET;
int8_t code = socket(http_socket, Sn_MR_TCP, 5656, SF_TCP_NODELAY);
if(code != http_socket) {
UART_Printf("socket() failed, code = %d\r\n", code);
return;
}
UART_Printf("Socket created, connecting...\r\n");
code = connect(http_socket, addr, 5354);
if(code != SOCK_OK) {
UART_Printf("connect() failed, code = %d\r\n", code);
close(http_socket);
}
}