PPP: Add burst of AT commands to lock autobaudrate on begin#12314
PPP: Add burst of AT commands to lock autobaudrate on begin#12314gonzabrusco wants to merge 1 commit intoespressif:masterfrom
Conversation
👋 Hello gonzabrusco, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Test Results 90 files 90 suites 35m 28s ⏱️ Results for commit 57fe36d. |
| // Send burst of AT to lock auto baurate on modem | ||
| for (int i = 0; i < 50; i++) { | ||
| esp_modem_at(_dce, "AT", NULL, 10); | ||
| } |
There was a problem hiding this comment.
IMO this should be only enabled if an argument of the constructor is set. @me-no-dev What do you think ?
There was a problem hiding this comment.
@lucasssvaz Just to add a data point: sending a short burst of "AT" commands is safe and has no side effects on modems that do not rely on autobaud.
In practice, this acts as a no-op for fixed-baud devices while greatly improving initialization reliability for autobaud-based modems, so I don’t think it needs to be gated behind an additional constructor option.

Description of Change
This Pull Request improves the robustness of PPPClass::begin() when used with cellular modems that boot in autobaud mode, such as SIMCom modules.
After a power-on reset, these modems often require multiple "AT\r" commands before they can lock onto the host UART baud rate. The current implementation attempts to synchronize immediately using esp_modem_sync(), which may fail if the modem is still determining the baud rate, leading to unnecessary retries and mode switching.
This change introduces a short burst of "AT\r" commands before calling esp_modem_sync(), allowing the modem to reliably lock the baud rate first. In practice, this significantly improves synchronization reliability without affecting modems that do not use autobaud.
Test Scenarios
I tested this change on a custom ESP32-based board equipped with a SIM7070 modem. Using a logic analyzer on the UART interface, I verified that the added AT command burst improves baud-rate locking and results in a more reliable initialization sequence.