Skip to content

PPP: Add burst of AT commands to lock autobaudrate on begin#12314

Open
gonzabrusco wants to merge 1 commit intoespressif:masterfrom
gonzabrusco:pppatburst
Open

PPP: Add burst of AT commands to lock autobaudrate on begin#12314
gonzabrusco wants to merge 1 commit intoespressif:masterfrom
gonzabrusco:pppatburst

Conversation

@gonzabrusco
Copy link
Contributor

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.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "Add burst of AT to lock autobaudrate":
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

👋 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 ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 57fe36d

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

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.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP320⚠️ +200.000.00000.000.00
ESP32C30⚠️ +240.000.00000.000.00
ESP32C50⚠️ +320.00⚠️ +0.01000.000.00
ESP32C60⚠️ +320.00⚠️ +0.01000.000.00
ESP32H20⚠️ +340.00⚠️ +0.01000.000.00
ESP32P40⚠️ +260.000.00000.000.00
ESP32S20⚠️ +200.000.00000.000.00
ESP32S30⚠️ +240.000.00000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32ESP32C3ESP32C5ESP32C6ESP32H2ESP32P4ESP32S2ESP32S3
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/PPP/examples/PPP_Basic⚠️ +200⚠️ +240⚠️ +320⚠️ +320⚠️ +340⚠️ +260⚠️ +200⚠️ +200
libraries/PPP/examples/PPP_WIFI_BRIDGE⚠️ +200⚠️ +240⚠️ +240⚠️ +320--⚠️ +240⚠️ +160⚠️ +240

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Test Results

 90 files   90 suites   35m 28s ⏱️
 67 tests  67 ✅ 0 💤 0 ❌
683 runs  683 ✅ 0 💤 0 ❌

Results for commit 57fe36d.

Comment on lines +303 to +306
// Send burst of AT to lock auto baurate on modem
for (int i = 0; i < 50; i++) {
esp_modem_at(_dce, "AT", NULL, 10);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should be only enabled if an argument of the constructor is set. @me-no-dev What do you think ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@gonzabrusco
Copy link
Contributor Author

Hi, just an afterthought. In my implementation, the modem reset is handled externally and not delegated to PPP.begin().

In the current begin() code path, when a reset pin is configured, the module is reset and the code waits only 100 ms before attempting to synchronize. Even with the added AT burst introduced in this PR, this delay is likely insufficient.

According to the SIM7000 datasheet, the minimum boot time after reset is approximately 4.5 seconds. I believe the code should wait longer before attempting to communicate with the modem in order to avoid premature sync failures. If you agree with this approach, I can add a longer delay after issuing the reset command in this same PR.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants