cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 problem with netconn when setting up LwIP from CubeMX

LKris.1
Associate II

Hi

I will setup an application on my STM32H743ZI2 which should make a Client socket connection using the LwIP and netconn. When i'm uisng the LwIP HTTP Server Netconn RTOS example i can make it work and the Netonn API functions is working,

If i instead of uising the example is starting a project using CubeMX and Enabling the LwIP, activating the FREETOS, enabling the CPU iCache and DCache.

In the LwIP settings i activate the LWIP_NETCONN (NETCONN API) and checking that the follwing, described, is set correctly     

LWIP_NETCONN (NETCONN API)

Diagnostic:

Dependency: Use NETCONN API requires NO_SYS=0 and MEMP_NUM_TCPIP_MSG_API>0 if MEMP_MEM_MALLOC is disabled.

Parameter Description:

When this parameter is enabled, Netconn API is enabled (require to use api_lib.c).   

I'm then generating the project to run in Keil and in the main. c i #include the api.h, in lwipopts.h i define the LWIP_NETCONN. Within the thread in just using the same setup as in the working example, see some of this below.

 struct netconn *conn;

 err_t err, accept_err;

  

 ip_addr_t ipaddr;

 u16_t socketPort = 18761;

 IP4_SET_ADDR(ipaddr, 192, 168, 0, 101);

   

 /* Create tcp_ip stack thread */

 tcpip_init(NULL, NULL);

  

 /* Initialize the LwIP stack */

 Netif_Config(); // Function just copied from the example.

if (conn != NULL)

{

   while (netconn_connect(conn, &ipaddr, socketPort) != ERR_OK) {

...

}

When compiling this i get a lot of error saying that a lot of the Netconn part is undefined. What am i doing wrong or what am I missing to include or activate.

4 REPLIES 4

Hello

Is api_lib.c added to project? Contains the definitions of Netconn functions

it is under LwIP\src\api

LKris.1
Associate II

Yes the api_lib.c is added when its created from the CubeMX. I have included the api.h in main, does the api_lib also need to be included in my main file?

Piranha
Chief II

Use the tools on your PC and find it out! For example, Notepad++ has a "Find in Files" feature. Search for those undefined names with it. And many other text editors and IDEs have a similar features.

houssemmiled
Associate

i have the same problem but i work in stm32F439 ,i have include file library api_lib.c and api.h