PPP Connection Disconnection on EC200U when Connecting to ESP32-S3 Soft AP

I am currently involved in a project that integrates the ESP32-S3 with the EC200U 4G LTE modem, communicating over UART pins. The objective is to develop a functional dongle that enables devices to connect to the same network with internet access.

While I am able to successfully activate the PPP connection and set up NAT succesfully, I am encountering an issue when devices connect to the ESP32’s Soft AP. Specifically, the PPP connection on the EC200U drops, after connecting a device to esp32s3 soft-ap via NAT.
I have successfully ping -ed the module from esp32s3 via AT command, however, devices connected to the Soft AP are unable to access the internet.

I have attached the output from the ESP-IDF (imagepdperror.png) for your reference. Below are the module informations

  1. Module: EC200U-CN
  2. Firmware Version: EC200UCNAAR03A09M08
  3. Simcard : VI

Could you kindly provide insight into why the PPP connection is dropping when connecting a device to the Soft AP? Despite being able to ping the EC200U through AT commands in beginning , no internet access is available through NAT connection. Any insights regarding the firmware issues or additional configurations in the module would be greatly appreciated.

In addition, I would like to inquire whether the PPP connection is managed by Quectel in this module through a seperate AT command designed for Quectel, or if I need to handle it from the ESP32-S3 side by utilizing LwIP for the connection setup.

Here is the code snippets as well as image of the error (imagepdperror.png):

void uart_init() 
{ 
uart_config_t uart_config = { 
.baud_rate = UART_BAUD_RATE, 
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE, 
.stop_bits = UART_STOP_BITS_1, 
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE 
}; 

ESP_ERROR_CHECK(uart_param_config(UART_NUM, &uart_config)); 
ESP_ERROR_CHECK(uart_set_pin(UART_NUM, PIN_TX1, PIN_RX1, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE)); 
ESP_ERROR_CHECK(uart_driver_install(UART_NUM, UART_BUF_SIZE * 2, 0, 0, NULL, 0)); 
}

static uint32_t ppp_output_callback(ppp_pcb *pcb, uint8_t *data, uint32_t len, void *ctx) 
{ 
int output_data = uart_write_bytes(UART_NUM, (const char *)data, len); 
uart_wait_tx_done(UART_NUM, 100 / portTICK_PERIOD_MS); 
return output_data; 
}

static void ppp_status_cb(ppp_pcb *pcb, int err_code, void *ctx) 
{ 
struct netif *pppif = ppp_netif(pcb); 
if (err_code == PPPERR_NONE) 
{ 
ppp_connected = true; 
ESP_LOGI("PPP", "Connected! IP: " IPSTR, IP2STR(&pppif->ip_addr.u_addr.ip4));
// Delay NAT enabling to ensure Wi-Fi is ready
    vTaskDelay(pdMS_TO_TICKS(2000));
    enable_nat();
}
else {
    ESP_LOGE("PPP", "Disconnected, error code: %d", err_code);
}

bool start_ppp_connection() 
{ 
ESP_LOGI("PPP", "Initializing PPP connection...");

// Create the PPP control block and attach it to netif
ppp = pppapi_pppos_create(&ppp_netif, ppp_output_callback, ppp_status_cb, NULL);
if (!ppp) {
    ESP_LOGE("PPP", "Failed to create PPP");
    return false;
}

pppapi_set_default(ppp);  // Set PPP as the default network interface
pppapi_connect(ppp, 0);   // Start PPP connection

return true;  // Successfully started PPP
}

Thank you in advance for your assistance. I look forward to your response.

I tried EC25 with the GitHub - espressif/esp-iot-solution: Espressif IoT Library. IoT Device Drivers, Documentations and Solutions.

EC25<- USB → ESP32S3

Maybe you can take as reference.
esp-iot-solution/examples/usb/host/usb_cdc_4g_module/main/app_main.c at master · espressif/esp-iot-solution


I (25891) modem_board: Modem state STAGE_CHECK_SIM, Start
I (25895) modem_board: SIM Card Ready
I (25895) modem_board: Modem state STAGE_CHECK_SIM, Success!
I (25895) 4g_main: Modem Board Event: SIM Card Connected
I (25995) modem_board: Modem state STAGE_CHECK_SIGNAL, Start
I (25997) modem_board: Signal quality: rssi=31, ber=99
I (25998) modem_board: Modem state STAGE_CHECK_SIGNAL, Success!
I (26099) modem_board: Modem state STAGE_CHECK_REGIST, Start
I (26104) modem_board: Network registered, Operator: "CHN-CT"
I (26105) modem_board: Modem state STAGE_CHECK_REGIST, Success!
I (26205) modem_board: Modem state STAGE_START_PPP, Start
I (26241) modem_board: Modem state STAGE_START_PPP, Success!
W (26242) modem_board: Modem event! 0
I (26341) modem_board: Modem state STAGE_WAIT_IP, Start
I (26456) esp-netif_lwip-ppp: Connected
I (26457) modem_board: IP event! 6
I (26457) modem_board: Modem Connected to PPP Server
I (26457) modem_board: ppp ip: 100.140.202.244, mask: 255.255.255.255, gw: 10.64.64.64
I (26465) modem_board: Main DNS: 202.102.213.68
I (26469) modem_board: Backup DNS: 61.132.163.68
I (26473) modem_board: Modem state STAGE_WAIT_IP, Success!
I (26473) esp-modem-netif: PPP state changed event 0: (NETIF_PPP_ERRORNONE)
I (26485) 4g_main: Modem Board Event: Network connected
I (26474) 4g_router_server: ssid : Can't find in NVS!
I (26495) 4g_router_server: password : Can't find in NVS!
I (26500) 4g_router_server: auth_mode : Can't find in NVS!
I (26505) 4g_router_server: channel : Can't find in NVS!
I (26510) 4g_router_server: hide_ssid : Can't find in NVS!
I (26515) 4g_router_server: bandwidth : Can't find in NVS!
I (26520) 4g_router_server: max_connection : Can't find in NVS!
I (26565) 4g_router_server: Partition size: total: 956561, used: 182477
I (26565) 4g_router_server: Starting server on port: '80'
I (26567) 4g_router_server: Registering URI handlers
I (26570) 4g_router_server: Starting webserver
I (26575) pp: pp rom version: e7ae62f
I (26578) net80211: net80211 rom version: e7ae62f
I (26583) wifi:wifi driver task: 3fcc6870, prio:23, stack:6656, core=0
I (26597) wifi:wifi firmware version: 48ea317a7
I (26597) wifi:wifi certification version: v7.0
I (26597) wifi:config NVS flash: enabled
I (26601) wifi:config nano formatting: disabled
I (26605) wifi:Init data frame dynamic rx buffer num: 32
I (26610) wifi:Init static rx mgmt buffer num: 5
I (26614) wifi:Init management short buffer num: 32
I (26619) wifi:Init dynamic tx buffer num: 32
I (26623) wifi:Init static tx FG buffer num: 2
I (26627) wifi:Init static rx buffer size: 1600
I (26631) wifi:Init static rx buffer num: 10
I (26635) wifi:Init dynamic rx buffer num: 32
I (26640) wifi_init: accept mbox: 6
I (26643) wifi_init: tcpip mbox: 32
I (26646) wifi_init: udp mbox: 6
I (26649) wifi_init: tcp mbox: 6
I (26652) wifi_init: tcp tx win: 5760
I (26655) wifi_init: tcp rx win: 5760
I (26659) wifi_init: tcp mss: 1440
I (26662) wifi_init: WiFi IRAM OP enabled
I (26665) wifi_init: WiFi RX IRAM OP enabled
I (26669) wifi_init: LWIP IRAM OP enabled
I (26674) phy_init: phy_version 680,a6008b2,Jun  4 2024,16:41:10
I (26700) phy: error: pll_cal exceeds 2ms!!!
W (26716) phy_init: saving new calibration data because of checksum failure, mode(0)
I (26729) wifi:mode : softAP (f4:12:fa:cb:a9:8d)
I (26757) wifi:Total power save buffer number: 16
I (26758) wifi:Init max length of beacon: 752/752
I (26758) wifi:Init max length of beacon: 752/752
I (26760) modem_wifi: Wi-Fi AP started
I (26761) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.4.1
I (27078) wifi:Total power save buffer number: 16
I (27079) modem_wifi: softap ssid: esp_4g_router password: 12345678
I (27079) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.4.1
I (27086) modem_wifi: ap dns addr(default): 8.8.8.8
I (27091) 4g_main: changed: ap dns addr (auto): 202.102.213.68

Hello Bean,

Thank you for your prompt response, I am trying out the code and will update shortly with output.
Additionally, I have a few questions regarding the PPP connection in the EC200UCN module to better understand the issue i am facing.

  1. Is the PPP connection supported in firmware version EC200UCNAAR03A09M08?
  2. Is the EC200U module primarily designed for cellular connectivity, with NAT usually managed externally? While I understand that Quectel’s specific AT commands (like AT+QCFG=“nat/cid”,1) can enable NAT for the PDP context, is there a similar command to enable PPP functionality over UART?
  3. Is there a specific parameter or command that should be set on the EC200U module to optimize high data throughput?

Thank you in advance for your help.

Hello again Bean,

Could you also provide the pinout of the connection you used with esp32s3 with modem? Specifically, did you connect an additional UART to the module for checking the logs? If so, did you use a USB-to-TTL converter to view the logs or for communication purposes? Would appreciate if you could give additional details on the setup and configuration to modem.

I feel like I’m hitting a roadblock with something in the module.

Here is an eample to use EC200U in USB mode. And I have verified that. I didn’t test the Uart yet.

esp-iot-solution/examples/usb/host/usb_cdc_4g_module at master · espressif/esp-iot-solution

What you need to set


we got this logs using EC200U-CN module .