cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with TCP/IP Client not working on H743.

CHan.2
Associate II

The server connects and communicates normally, and the Client experiences a return value = -13, Abort in the connect function.

Using the Netconn API, the user program is hercles_3-2-8.exe. PC IP is 192.168.0.223 and Device IP is 192.168.0.222.

The code below is the Client connection code, which connects to TCP/IP and sends every second.

osThreadDef(TCP_Task, TCP_Task_Func, osPriorityBelowNormal, 0, 512);

TCP_TaskHandle = osThreadCreate(osThread(TCP_Task), NULL);

void TCP_Task_Func(void const * argument)

{

/* init code for LWIP */

MX_LWIP_Init();

/* USER CODE BEGIN 5 */

osDelay(1000);

const char* message = "Hello message!\n\r";

ip_addr_t PC_IPADDR;

IP_ADDR4(&PC_IPADDR, 192, 168, 0, 223);

ip_addr_t Device_IPADDR;

IP_ADDR4(&Device_IPADDR, 192, 168, 0, 222);

struct netconn *conn;

err_t err;

conn = netconn_new(NETCONN_TCP);

err = netconn_bind(conn, &Device_IPADDR, 55151); // return Value = 0

err = netconn_connect(conn, &PC_IPADDR, 55151);  // return Value = -13(Abort)

osDelay(100);

/* Infinite loop */

for(;;)

{

netconn_write(conn, message, 17, NETCONN_NOFLAG); // return Value = 0;

osDelay(1000);

}

/* USER CODE END 5 */

}

https://community.st.com/s/article/How-to-create-project-for-STM32H7-with-Ethernet-and-LwIP-stack-working

I tried UDP like the link above, and UDP didn't work either.(Once the PC side sends data, the Device will continue to send data thereafter.)

1 REPLY 1
CHan.2
Associate II

This issue has been resolved. I tested it with a Hercules file associated with my PC, but it was a problem because I didn't set an inbound rule.