cancel
Showing results for 
Search instead for 
Did you mean: 

I maked simple program with LWiP, and call netconn_bind(conn, IP4_ADDR_ANY, port) halted MCU board nucleo-f767zi.

Andrew Ivanov
Associate II

I maked simple program with LWiP. After I got dinamyc address, I tried socket connection and call netconn_bind halted MCU.

My code:

 for(;;)

 {

  if(OK_D == 0)  

  {

    IP_A = gnetif.ip_addr.addr;

    if(IP_A == 0)

    {

      HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_RESET); // led 2

      HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET); // led 3

    } else

    {

      dhcp_stop(&gnetif);

      OK_D = 1;

    }

  } else

    {

      HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET); //led 3

      osDelay(1);

      if(OK_E == 0)

      {

         

        conn = netconn_new(NETCONN_TCP);

        if(conn != NULL)

        {

          HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET); //led 2

          osDelay(1);

          err1 = netconn_bind(conn, IP4_ADDR_ANY, 100);

          osDelay(1);

          err2 = netconn_connect(conn, &IP_Server, 21000);

          if (err1 == ERR_OK)

          {

            OK_E = 1;           

            HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET);

          }

        }

       }

    }

 }

Please, help me resolve this problem.

LWiP settings in CubeMX:

0690X000008wQQqQAM.png

1 ACCEPTED SOLUTION

Accepted Solutions
Andrew Ivanov
Associate II

This problem solved as follows, I ran functions netconn_new, netconn_bind, netconn_connect in separate thread. This thread maked with function sys_thread_new.

And, it`s ok in my case.

View solution in original post

3 REPLIES 3
Andrew Ivanov
Associate II

I`ts OK. I solve this problem.

Hi @Andrew Ivanov​ ,

Glad to know that your problem is resolved.

It will be more helpful for the Community if you share more details about your findings (what was the issue and how you resolved it?).

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Andrew Ivanov
Associate II

This problem solved as follows, I ran functions netconn_new, netconn_bind, netconn_connect in separate thread. This thread maked with function sys_thread_new.

And, it`s ok in my case.