Skip to content

Commit b2c805a

Browse files
authored
fix(ppp): Fix PPP not working after reboot if no RST (espressif#10264)
Modem will try to switch to CMUX and then back to COMMAND in order to allow communication with the modem.
1 parent 019855f commit b2c805a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

libraries/PPP/src/PPP.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,17 @@ bool PPPClass::begin(ppp_modem_model_t model, uint8_t uart_num, int baud_rate) {
324324
} else {
325325
// try to communicate with the modem
326326
if (esp_modem_sync(_dce) != ESP_OK) {
327-
log_v("Modem does not respond to AT, maybe in DATA mode? ...exiting network mode");
327+
log_v("Modem does not respond to AT! Switching to COMMAND mode.");
328328
esp_modem_set_mode(_dce, ESP_MODEM_MODE_COMMAND);
329+
if (esp_modem_sync(_dce) != ESP_OK) {
330+
log_v("Modem does not respond to AT! Switching to CMUX mode.");
331+
if (esp_modem_set_mode(_dce, ESP_MODEM_MODE_CMUX) != ESP_OK) {
332+
log_v("Modem failed to switch to CMUX mode!");
333+
} else {
334+
log_v("Switching back to COMMAND mode");
335+
esp_modem_set_mode(_dce, ESP_MODEM_MODE_COMMAND);
336+
}
337+
}
329338
if (esp_modem_sync(_dce) != ESP_OK) {
330339
log_e("Modem failed to respond to AT!");
331340
goto err;

0 commit comments

Comments
 (0)