esp_modem_dte_send_cmd: process command timeout – SOLVED

In ESP-IDF code using PPPoS for cellular modem interfacing, esp_modem_dte_send_cmd() timeout error occurs when no response is received from the modem and timeout period set for that AT command expires.
In new applications or when switching to a new modem firmware version, you may encounter timeout errors – especially after power-up and on sending the first “AT” command.
esp_modem_dte_send_cmd process command timeout esp_modem_dce_sync send command failed
ESP32 PPPoS Error: esp_modem_dte_send_cmd process command timeout

Reasons for esp_modem_dte_send_cmd() Timeout

There can be many reasons that cause AT commands to time out where it is not expected. This can be an error or malfunction on the modem end (though this is very rare). Make sure you rule out any hardware issues by checking how we interface an ESP32 with cellular modems.

In most cases, timeouts occur because the timeout period set in the ESP32 firmware is not sufficient as per the AT command manual. 4G CAT1 modems tend to take longer to boot and respond to AT commands after power-up than 2G modems do.

Listed below are some reasons and proposed methods for fixing the timeout error. We have tried these fixes in diffierent products, mainly with ESP32 and SIM7600 or A7670 4G LTE modems from Simcom.

1. Bad Modem Reset or Power-Up

If the ESP32 was reset or was flashed during testing but the 4G modem was not reset by the ESP32 firmware, the modem may be in the middle of a previous operation. This can result in the UART AT commands being ignored or read incorrectly by the modem.
The modem may not respond and cause a DTE command timeout.

Solution:

Make sure that the ESP32 (or host) powers down the modem properly and then re-starts it as per the requirements specific to your modem.
This will make the 4G modem enter a known state.

2. Not Waiting for AT Firmware to be Ready

Simcom cellular modems have a STATUS signal that indicates to the host MCU that the modem is ready to communicate via UART. Note that this STATUS line simply indicates that the UART port is initialized. STATUS being high does not mean that the host can send AT commands.
If the host sends an AT command before the modem is ready, the first AT command sent to the modem after power-up may cause an esp_modem_dte_send_cmd: process command timeout.
RDY SIM7600 time before first AT command
Host must wait for "RDY" before sending any AT command (Source: SIM7600 AT command manual)

Solution:

There are three ways to solve this:

  • Wait for the “RDY” message or similar indicator to ensure that the modem can accept AT commands before sending one.
  •  After modem is powered up and re-started and STATS becomes high to signal end of boot process, re-send AT command up to 10 times with 5 second delay in between attempts. This ensures that the modem receives the AT command when it is ready.
  • After STATUS becomes high to signal that the modem is ready, wait an additional 15 seconds to make sure that the AT firmware is ready.

3. Short Default Timeout Setting

Considering the PPPoS examples provided in ESP32 ESP-IDF examples directory, there are some standard timeout values that are defined within the file “esp_modem_dce.h”. The “default” timeout setting of 500ms is too little for many 4G modems.

Solution:

These timeout values can be changed and should be set to something that covers most command-response timelines specified in the modem datasheet. For SimCom 4G LTE modems, we like to use these values:

esp32 modem command timeout value setting for esp_modem_dte_send_cmd
Modem command timeout value setting used for AT commands
Change Log
  • Initial Release: 23 October 2022
References

You may also like

Leave a Comment

two × 5 =