diff --git a/components/esp_modem/Kconfig b/components/esp_modem/Kconfig index dd650f936..665bddcb8 100644 --- a/components/esp_modem/Kconfig +++ b/components/esp_modem/Kconfig @@ -36,6 +36,12 @@ menu "esp-modem" The typical reason for failing SABM request without a delay is that some devices (SIM800) send MSC requests just after opening a new DLCI. + config ESP_MODEM_CMUX_DELAY_AFTER_NETIF_DISCONNECT + int "Delay in ms to wait before closing virtual terminal abd rigt after PPP disconnect(NETIF)" + default 0 + help + Some devices might need a pause before sending disconnect command that closes + virtual terminal. This delay applies only in CMUX mode. config ESP_MODEM_CMUX_USE_SHORT_PAYLOADS_ONLY bool "CMUX to support only short payloads (<128 bytes)" default n diff --git a/components/esp_modem/src/esp_modem_dce.cpp b/components/esp_modem/src/esp_modem_dce.cpp index 1828d87e9..3b1735fa8 100644 --- a/components/esp_modem/src/esp_modem_dce.cpp +++ b/components/esp_modem/src/esp_modem_dce.cpp @@ -160,6 +160,7 @@ bool DCE_Mode::set_unsafe(DTE *dte, ModuleIf *device, Netif &netif, modem_mode m if (mode == modem_mode::CMUX_MODE) { netif.stop(); netif.wait_until_ppp_exits(); + usleep(CONFIG_ESP_MODEM_CMUX_DELAY_AFTER_NETIF_DISCONNECT * 1'000); if (!dte->set_mode(modem_mode::COMMAND_MODE)) { return false; }