2025-10-18 11:20 AM
This is what my task looks like:
void StartMongooseTask(void const * argument)
{
/* init code for LWIP */
MX_LWIP_Init();
/* init code for USB_DEVICE */
MX_USB_DEVICE_Init();
while (netif_default == NULL || !netif_is_up(netif_default)
|| !ip4_addr_isany_val(*netif_ip4_addr(netif_default))
) {
osDelay(100);
}
extern struct dhcp_state_enum_t;
struct dhcp *dhcp_client = netif_dhcp_data(netif_default);
while (dhcp_client == NULL || dhcp_client->state != 10) {
osDelay(100);
}
ip = *netif_ip4_addr(netif_default);
printf("IP acquired: %u.%u.%u.%u", ip4_addr1(&ip), ip4_addr2(&ip),
ip4_addr3(&ip), ip4_addr4(&ip));
mdns_resp_init();
mdns_resp_add_netif(netif_default, "22223335", 3600);
mdns_resp_add_service(netif_default, "22223335", "_http",
DNSSD_PROTO_TCP, 80, 3600, NULL, NULL);
mdns_resp_announce(netif_default);
// --------------- mongoose ---------------
mg_log_set(MG_LL_DEBUG);
struct mg_mgr mgr;
mg_mgr_init(&mgr);
mg_http_listen(&mgr, "http://0.0.0.0:80", http_handler, &mgr);
for (;;) {
mg_mgr_poll(&mgr, 10); // 10 ms polling
osDelay(1); // Yield to other FreeRTOS tasks
}
}
I am certain that the LWIP is getting a valid IP and advertising the service as expected, since I can ping to it. However, I cannot seem to access the http server. The mongoose (v7.19.0) functions are not returning errors, and it looks like they are set up correctly. The poll function will call the `http_handler`.
To try to integrate mongoose with LWIP, I set up the following flags:
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
#define MG_ENABLE_LWIP 1
I also tried to set MG_ENABLE_TCPIP to 0, but when I do so, I get compilation errors saying undefined reference to both mg_mgr_poll and mg_open_listener.
My board is the NUCLEO-F767ZI. Can anyone help me try to diagnose the problem and hopefully find a solution? Thank you
2025-10-18 1:49 PM