From 28d534ad33e79bd97278d786aa02ddb097039d58 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 18 Oct 2021 12:56:39 +0200 Subject: [PATCH 1/3] Examples/PPPoS: Add mandatory delay after +++ command Switching back from data (PPP) mode to command mode must be done is the following sequence: * No characters entered for T1 time (1 second) * "+++" characters entered with no characters in between (1 second) * No characters entered for T1 timer (1 second) (per specification of SIM800 SIM800_Series_AT_Command_Manual_V1.09.pdf) Related https://github.com/espressif/esp-idf/issues/7608 --- examples/protocols/pppos_client/components/modem/src/sim800.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/protocols/pppos_client/components/modem/src/sim800.c b/examples/protocols/pppos_client/components/modem/src/sim800.c index f4a3d90e59..fcc67d9787 100644 --- a/examples/protocols/pppos_client/components/modem/src/sim800.c +++ b/examples/protocols/pppos_client/components/modem/src/sim800.c @@ -92,6 +92,7 @@ static esp_err_t sim800_set_working_mode(modem_dce_t *dce, modem_mode_t mode) DCE_CHECK(dce->state == MODEM_STATE_SUCCESS, "sync failed", err); } else { DCE_CHECK(dce->state == MODEM_STATE_SUCCESS, "enter command mode failed", err); + vTaskDelay(pdMS_TO_TICKS(1000)); // spec: 1s delay after `+++` command } ESP_LOGD(DCE_TAG, "enter command mode ok"); dce->mode = MODEM_COMMAND_MODE; From 12f4f8f7f8503ac8076e7a25c965f342b5d079b0 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 18 Oct 2021 12:58:24 +0200 Subject: [PATCH 2/3] Examples/PPPoS: Fixed missed NETIF_PPP_STATUS event unregister NETIF_PPP_STATUS is registerd while modem gets attached to the related netif. we don't have any network detach functionality in the modem component, so we unregister the event during esp_modem_netif_clear_default_handlers(). Related https://esp32.com/viewtopic.php?f=13&t=23632 Related https://github.com/espressif/esp-idf/issues/7469 --- .../pppos_client/components/modem/src/esp_modem_netif.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c b/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c index 9dd081ab6b..0aab9c2d36 100644 --- a/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c +++ b/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c @@ -153,6 +153,10 @@ esp_err_t esp_modem_netif_clear_default_handlers(void *h) goto clear_event_failed; } + // this event is registered while modem gets attached to netif. + // we don't have any detach functionality, so we unregister here and ignore potential error + esp_event_handler_unregister(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, on_ppp_changed); + return ESP_OK; clear_event_failed: From 9ceadb4e18a03db94c875d79d6e47a1198584fb2 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 18 Oct 2021 13:03:07 +0200 Subject: [PATCH 3/3] Examples/PPPoS: Fix copyright headers --- .../components/modem/src/esp_modem_netif.c | 18 +++++------------- .../pppos_client/components/modem/src/sim800.c | 18 +++++------------- tools/ci/check_copyright_ignore.txt | 2 -- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c b/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c index 0aab9c2d36..de7d682a4c 100644 --- a/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c +++ b/examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c @@ -1,16 +1,8 @@ -// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "esp_netif.h" #include "esp_netif_ppp.h" #include "esp_modem.h" diff --git a/examples/protocols/pppos_client/components/modem/src/sim800.c b/examples/protocols/pppos_client/components/modem/src/sim800.c index fcc67d9787..f1396a8ac7 100644 --- a/examples/protocols/pppos_client/components/modem/src/sim800.c +++ b/examples/protocols/pppos_client/components/modem/src/sim800.c @@ -1,16 +1,8 @@ -// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include #include "esp_log.h" diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 6f3506f569..45ab2b9a86 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -3725,9 +3725,7 @@ examples/protocols/pppos_client/components/modem/include/sim800.h examples/protocols/pppos_client/components/modem/src/bg96.c examples/protocols/pppos_client/components/modem/src/esp_modem_compat.c examples/protocols/pppos_client/components/modem/src/esp_modem_dce_service.c -examples/protocols/pppos_client/components/modem/src/esp_modem_netif.c examples/protocols/pppos_client/components/modem/src/sim7600.c -examples/protocols/pppos_client/components/modem/src/sim800.c examples/protocols/pppos_client/example_test.py examples/protocols/pppos_client/main/pppos_client_main.c examples/protocols/slip/slip_udp/components/slip_modem/include/slip_modem.h