cancel
Showing results for 
Search instead for 
Did you mean: 

Im trying to get LWIP to connect to a remote server, but im returned with Routing error ( err_t ERR_RTE) when calling tcp_connect(). The card is a Nucleo F746ZG and im using stm32QubeIDE with LwIP added as a middleware

DIsak.1
Associate

Snuippet of source code

 /* Initialize all configured peripherals */

 MX_GPIO_Init();

 MX_USART3_UART_Init();

 Print("USART init ok\n");

 MX_USB_OTG_FS_PCD_Init();

 Print("USB pcd init ok\n");

 MX_LWIP_Init();

 Print("LWIP init ok\n");

 /* USER CODE BEGIN 2 --------------------------------------------------------------------------------------------------------------------------------*/

 struct tcp_pcb * tcp_client = {0};

 tcp_client = tcp_new();

 if(tcp_client != 0)

 {

    Print("tcp_new ok\n");

    err_t error = {0};

    error = tcp_bind(tcp_client, IP_ADDR_ANY);

    if(error == ERR_OK)

    {

       Print("tcp_bind ok\n");

       err_t errorConnect = {0};

       struct ip4_addr remoteIP;

       IP4_ADDR(&remoteIP, 192, 168, 127, 250);

       errorConnect = tcp_connect(tcp_client, &remoteIP, 4002, tcpConnect);

       if(errorConnect == ERR_OK)

       {

          Print("tcp_connect ok\n");

       }

       else

       {

          Print("Error: tcp_connect \n");

       }

    }

    else

    {

       Print("Error: tcp_bind\n");

    }

 }

 else

 {

    Print("Error: tcp_new faild\n");

 }

0 REPLIES 0