From b2568a3d83fac4411b2705f36a3f446ae1cae17f Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 25 Aug 2025 14:51:59 +0200 Subject: [PATCH 1/3] fix(eppp): Fix stack-overflow in ping task for TUN netif Closes https://github.com/espressif/esp-protocols/issues/867 --- components/eppp_link/eppp_netif_tun.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/eppp_link/eppp_netif_tun.c b/components/eppp_link/eppp_netif_tun.c index 63c0896d9..7b905213e 100644 --- a/components/eppp_link/eppp_netif_tun.c +++ b/components/eppp_link/eppp_netif_tun.c @@ -167,6 +167,9 @@ esp_err_t eppp_check_connection(esp_netif_t *netif) { esp_err_t ret = ESP_OK; esp_ping_config_t config = ESP_PING_DEFAULT_CONFIG(); +#if CONFIG_LOG_MAXIMUM_LEVEL > 3 + config.task_stack_size += 1024; // Some additional stack needed for verbose logs +#endif config.count = 100; ESP_LOGI(TAG, "Checking connection on EPPP interface #%" PRIu32, config.interface); ip_addr_t target_addr = {0}; From 497ee2d6d4baf23feba08ff9aa49a2c700cf7a1b Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 25 Aug 2025 15:23:07 +0200 Subject: [PATCH 2/3] fix(eppp): Fix SPI transport to allow already init GPIO ISR Closes https://github.com/espressif/esp-protocols/issues/868 --- components/eppp_link/eppp_spi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/eppp_link/eppp_spi.c b/components/eppp_link/eppp_spi.c index 233a8ee01..0c496b691 100644 --- a/components/eppp_link/eppp_spi.c +++ b/components/eppp_link/eppp_spi.c @@ -208,7 +208,9 @@ static esp_err_t init_master(struct eppp_config_spi_s *config, struct eppp_spi * }; ESP_GOTO_ON_ERROR(gpio_config(&io_conf), err_dev, TAG, "Failed to config interrupt GPIO"); - ESP_GOTO_ON_ERROR(gpio_install_isr_service(0), err_dev, TAG, "Failed to install GPIO ISR"); + ret = gpio_install_isr_service(0); + ESP_GOTO_ON_FALSE(ret == ESP_OK || ret == ESP_ERR_INVALID_STATE /* In case the GPIO ISR already installed */, + ret, err_dev, TAG, "Failed to install GPIO ISR"); ESP_GOTO_ON_ERROR(gpio_set_intr_type(config->intr, GPIO_INTR_ANYEDGE), err_dev, TAG, "Failed to set ISR type"); ESP_GOTO_ON_ERROR(gpio_isr_handler_add(config->intr, gpio_isr_handler, h), err_dev, TAG, "Failed to add ISR handler"); return ESP_OK; @@ -468,9 +470,6 @@ err: if (h->ready_semaphore) { vSemaphoreDelete(h->ready_semaphore); } - if (h->out_queue) { - vQueueDelete(h->out_queue); - } free(h); return NULL; } From cd57f1bb13c4559cabc9aaba299277b3de0e0310 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 25 Aug 2025 16:29:44 +0200 Subject: [PATCH 3/3] feat(eppp): Add support for UART flow control Closes https://github.com/espressif/esp-protocols/issues/870 --- components/eppp_link/eppp_uart.c | 5 +++-- components/eppp_link/include/eppp_link.h | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/eppp_link/eppp_uart.c b/components/eppp_link/eppp_uart.c index 75283aa58..6d89d18ba 100644 --- a/components/eppp_link/eppp_uart.c +++ b/components/eppp_link/eppp_uart.c @@ -80,12 +80,12 @@ static esp_err_t init_uart(struct eppp_uart *h, struct eppp_config_uart_s *confi uart_config.data_bits = UART_DATA_8_BITS; uart_config.parity = UART_PARITY_DISABLE; uart_config.stop_bits = UART_STOP_BITS_1; - uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE; + uart_config.flow_ctrl = config->flow_control; uart_config.source_clk = UART_SCLK_DEFAULT; ESP_RETURN_ON_ERROR(uart_driver_install(h->uart_port, config->rx_buffer_size, 0, config->queue_size, &h->uart_event_queue, 0), TAG, "Failed to install UART"); ESP_RETURN_ON_ERROR(uart_param_config(h->uart_port, &uart_config), TAG, "Failed to set params"); - ESP_RETURN_ON_ERROR(uart_set_pin(h->uart_port, config->tx_io, config->rx_io, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE), TAG, "Failed to set UART pins"); + ESP_RETURN_ON_ERROR(uart_set_pin(h->uart_port, config->tx_io, config->rx_io, config->rts_io, config->cts_io), TAG, "Failed to set UART pins"); ESP_RETURN_ON_ERROR(uart_set_rx_timeout(h->uart_port, 1), TAG, "Failed to set UART Rx timeout"); return ESP_OK; } @@ -269,6 +269,7 @@ eppp_transport_handle_t eppp_uart_init(struct eppp_config_uart_s *config) ESP_GOTO_ON_ERROR(init_uart(h, config), err, TAG, "Failed to init UART"); return &h->parent; err: + free(h); return NULL; } diff --git a/components/eppp_link/include/eppp_link.h b/components/eppp_link/include/eppp_link.h index 3df11c4d8..4d6766e30 100644 --- a/components/eppp_link/include/eppp_link.h +++ b/components/eppp_link/include/eppp_link.h @@ -34,6 +34,9 @@ extern "C" { .rx_io = 26, \ .queue_size = 16, \ .rx_buffer_size = 1024, \ + .rts_io = -1, \ + .cts_io = -1, \ + .flow_control = 0, \ }, \ #define EPPP_DEFAULT_SDIO_CONFIG() \ @@ -135,6 +138,9 @@ typedef struct eppp_config_t { int rx_io; int queue_size; int rx_buffer_size; + int rts_io; + int cts_io; + int flow_control; } uart; struct eppp_config_sdio_s {