From a23dbdca7944e03a990f04f5aede0c1fb93d6919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Z=C3=BCger?= Date: Fri, 3 Nov 2023 11:18:05 +0100 Subject: [PATCH] stm32: Add optional lwip loopback support. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MICROPY_PY_LWIP_LOOPBACK must be set at the make level to enable this. Signed-off-by: Peter Züger --- ports/stm32/lwip_inc/lwipopts.h | 3 +++ ports/stm32/mpnetworkport.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/ports/stm32/lwip_inc/lwipopts.h b/ports/stm32/lwip_inc/lwipopts.h index 7b2460fa80..f641cf515a 100644 --- a/ports/stm32/lwip_inc/lwipopts.h +++ b/ports/stm32/lwip_inc/lwipopts.h @@ -24,6 +24,9 @@ #define LWIP_NETIF_HOSTNAME 1 #define LWIP_NETIF_EXT_STATUS_CALLBACK 1 +#define LWIP_LOOPIF_MULTICAST 1 +#define LWIP_LOOPBACK_MAX_PBUFS 8 + #define LWIP_IPV6 0 #define LWIP_DHCP 1 #define LWIP_DHCP_CHECK_LINK_UP 1 diff --git a/ports/stm32/mpnetworkport.c b/ports/stm32/mpnetworkport.c index 62f780a35a..3b9591213a 100644 --- a/ports/stm32/mpnetworkport.c +++ b/ports/stm32/mpnetworkport.c @@ -72,6 +72,10 @@ STATIC void pyb_lwip_poll(void) { // Run the lwIP internal updates sys_check_timeouts(); + + #if LWIP_NETIF_LOOPBACK + netif_poll_all(); + #endif } void mod_network_lwip_poll_wrapper(uint32_t ticks_ms) {