Skip to main content
This topic has been closed for replies.

6 replies

Asantos
AsantosAuthor
Associate III

Hi,

I can't enable LWIP_MDNS in MDNL/TFTP and i also can't enable LWIP_IGM in the "General Settings", of the STM32CubeMX V5.61.

why can I enable these features?

I'm trying to configure mDNS protocol for the LwIP.

I set up:

//at the end of the MX_LWIP_Init()

mdns_resp_init();

  mdns_resp_add_netif(&gnetif, "myhost", 60);

  mdns_resp_add_service(&gnetif, "myhost", "_http", DNSSD_PROTO_TCP, 80, 300, http_srv_txt, NULL);

// in fuction: static void low_level_init(struct netif *netif)

 #if LWIP_IPV4 && LWIP_IGMP

 netif->flags |= NETIF_FLAG_IGMP;

  #endif

// In LwIP options

#define LWIP_IGMP 1

#define LWIP_MDNS_RESPONDER 1

#define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER)

//And I include this callback function in lwip.c

static void http_srv_txt(struct mdns_service *service, void *txt_userdata)

{

  mdns_resp_add_service_txtitem(service, "path=/", 6);

}

//these function is only called once.

What am I missing?

Pavel A.

The Cube package for H7 has outdated LwIP version 2.03.

The feature you need may be in newer version 2.1x, this can be found in other packages - F7, F4...

-- pa

Asantos
AsantosAuthor
Associate III

--pa

LwIP version 2.03 also have support for mDNS. I tried to implement it using the latest STM32CubeMx for the F7, and it does not enable mDNS also .

I tested it in a MIMXRT1021 board from NXP, and there are an example of http server with mDNS, and it works well. I noticed that it depends on setting the ethernet MAC to multicast address 01 00 5E XX XX XX. I don't know how to do it on the STM32H7.

hasseb
Visitor II

"When MEMP_MEM_MALLOC is disabled, use LWIP_IGMP requires LWIP_MULTICAST_TX_OPTIONS enabled and also MEMP_NUM_IGMP_GROUP>1."

In addition, you need to have the following

MDNS_MAX_SERVICES 1

MDNS_RESP_USENETIF_EXTCALLBACK 1

LWIP_NETIF_STATUS_CALLBACK 1

LWIP_NETIF_EXT_STATUS_CALLBACK 1

You need to add following to the static void low_level_init(struct netif *netif) as well

// Allow multicast packets

ETH->MACPFR |= (1<<4);

Associate II

In case someone else struggles with this, note that LWIP_MULTICAST_TX_OPTIONS is enabled or disabled as an Advanced option within the Key Options tab.

Ergo, one must tap 'Key Options', select 'Show Advanced Parameters', and look for 'LWIP_MULTICAST_TX_OPTIONS' within the 'IPv4 - Multicast Options' tree item to enable or disable this option.

If the option is disabled, you may not be able to enable LWIP_IGMP, and that may prevent you from enabling LWIP_MDNS.