From 4f2ebaa7532d319f672e663dd3e5d6a905d0a739 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 26 Sep 2023 10:43:17 +0200 Subject: [PATCH 1/3] fix(modem): Add CMUX example to target tests --- .github/workflows/modem__target-test.yml | 4 ++-- README.md | 2 +- .../examples/simple_cmux_client/pytest_cmux.py | 17 +++++++++++++++++ .../simple_cmux_client/sdkconfig.ci.sim800_cmux | 17 +++++++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 components/esp_modem/examples/simple_cmux_client/pytest_cmux.py create mode 100644 components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux diff --git a/.github/workflows/modem__target-test.yml b/.github/workflows/modem__target-test.yml index 02d6ed0e4..7aadb0eb2 100644 --- a/.github/workflows/modem__target-test.yml +++ b/.github/workflows/modem__target-test.yml @@ -15,7 +15,7 @@ jobs: matrix: idf_ver: ["latest"] idf_target: ["esp32c3"] - test: [ { app: pppd, path: test/target }, { app: sim800_c3, path: examples/pppos_client } ] + test: [ { app: pppd, path: test/target }, { app: sim800_c3, path: examples/pppos_client }, { app: sim800_cmux, path: examples/simple_cmux_client } ] runs-on: ubuntu-20.04 container: espressif/idf:${{ matrix.idf_ver }} env: @@ -54,7 +54,7 @@ jobs: matrix: idf_ver: ["latest"] idf_target: ["esp32c3"] - test: [ { app: pppd, path: test/target }, { app: sim800_c3, path: examples/pppos_client } ] + test: [ { app: pppd, path: test/target }, { app: sim800_c3, path: examples/pppos_client }, { app: sim800_cmux, path: examples/simple_cmux_client } ] needs: build_esp_modem_tests runs-on: - self-hosted diff --git a/README.md b/README.md index 940e8fef8..06ffba689 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## How to use The [ESP-Protocols](https://github.com/espressif/esp-protocols) repository contains a collection of protocol components for [ESP-IDF](https://github.com/espressif/esp-idf). -Additionally, each component is available in [IDF Component Registry](https://components.espressif.com). +Additionally, each component is available in [IDF Component Registry](https://components.espressif.com). Please refer to instructions in [ESP-IDF](https://github.com/espressif/esp-idf) ## Components diff --git a/components/esp_modem/examples/simple_cmux_client/pytest_cmux.py b/components/esp_modem/examples/simple_cmux_client/pytest_cmux.py new file mode 100644 index 000000000..208212838 --- /dev/null +++ b/components/esp_modem/examples/simple_cmux_client/pytest_cmux.py @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD +# SPDX-License-Identifier: Unlicense OR CC0-1.0 +from __future__ import print_function, unicode_literals + + +def test_cmux_connection(dut): + """ + steps: + 1. initializes connection with SIM800 + 2. checks we get an IP + 3. checks for the MQTT events + """ + # Check the sequence of connecting, publishing, disconnecting + dut.expect('Modem has correctly entered multiplexed') + # Check for MQTT connection and the data event + dut.expect('TOPIC: /topic/esp-modem') + dut.expect('DATA: Hello modem') diff --git a/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux b/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux new file mode 100644 index 000000000..dcdb2f029 --- /dev/null +++ b/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux @@ -0,0 +1,17 @@ +CONFIG_IDF_TARGET="esp32c3" +# Override some defaults to enable PPP +CONFIG_LWIP_PPP_SUPPORT=y +CONFIG_LWIP_PPP_NOTIFY_PHASE_SUPPORT=y +CONFIG_LWIP_PPP_PAP_SUPPORT=y +CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=4096 +CONFIG_LWIP_PPP_ENABLE_IPV6=n +CONFIG_EXAMPLE_MODEM_UART_TX_PIN=4 +CONFIG_EXAMPLE_MODEM_UART_RX_PIN=5 +CONFIG_EXAMPLE_MODEM_DEVICE_SIM800=y +CONFIG_EXAMPLE_MODEM_DEVICE_BG96=n +CONFIG_EXAMPLE_MODEM_PPP_APN="lpwa.vodafone.com" +CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +CONFIG_ESP32_PANIC_PRINT_HALT=y +CONFIG_COMPILER_CXX_EXCEPTIONS=y +CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 +CONFIG_EXAMPLE_CLOSE_CMUX_AT_END=y From 8d5947e5f19e78607890a0541134f04ad133ead0 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 26 Sep 2023 15:14:53 +0200 Subject: [PATCH 2/3] fix(modem): Fix to allow MSC frame (SIM800 CMUX) after v1.0.2 Fixes the regression from 8edbac69 that added more strict conditions for CMUX protocol, but didn't allow MSC frames that might be sent during initializaiton by SIM800. Closes https://github.com/espressif/esp-protocols/issues/366 --- components/esp_modem/src/esp_modem_cmux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_modem/src/esp_modem_cmux.cpp b/components/esp_modem/src/esp_modem_cmux.cpp index 1ce67a61f..a04c1808d 100644 --- a/components/esp_modem/src/esp_modem_cmux.cpp +++ b/components/esp_modem/src/esp_modem_cmux.cpp @@ -144,7 +144,7 @@ bool CMux::data_available(uint8_t *data, size_t len) return false; } } else if ((type & FT_UIH) == FT_UIH && dlci == 0) { // notify the internal DISC command - if (len > 0 && (data[0] & 0xE1) == 0xE1) { + if ((len > 0 && (data[0] & 0xE1) == 0xE1) || (data == nullptr)) { // Not a DISC, ignore (MSC frame) return true; } From 4e178735cd4c4bcd3d1e309151d8f80da3112a3e Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 26 Sep 2023 15:50:42 +0200 Subject: [PATCH 3/3] bump(modem): 1.0.2 -> 1.0.3 1.0.3 Bug Fixes - Fix to allow MSC frame (SIM800 CMUX) after v1.0.2 (8d5947e, #366) - Add CMUX example to target tests (4f2ebaa) --- components/esp_modem/.cz.yaml | 2 +- components/esp_modem/CHANGELOG.md | 7 +++++++ components/esp_modem/idf_component.yml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/components/esp_modem/.cz.yaml b/components/esp_modem/.cz.yaml index d9ff1b8c4..ea48ef1c9 100644 --- a/components/esp_modem/.cz.yaml +++ b/components/esp_modem/.cz.yaml @@ -3,6 +3,6 @@ commitizen: bump_message: 'bump(modem): $current_version -> $new_version' pre_bump_hooks: python ../../ci/changelog.py esp_modem tag_format: modem-v$version - version: 1.0.2 + version: 1.0.3 version_files: - idf_component.yml diff --git a/components/esp_modem/CHANGELOG.md b/components/esp_modem/CHANGELOG.md index 61ffdf945..4f1655577 100644 --- a/components/esp_modem/CHANGELOG.md +++ b/components/esp_modem/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.0.3](https://github.com/espressif/esp-protocols/commits/modem-v1.0.3) + +### Bug Fixes + +- Fix to allow MSC frame (SIM800 CMUX) after v1.0.2 ([8d5947e](https://github.com/espressif/esp-protocols/commit/8d5947e), [#366](https://github.com/espressif/esp-protocols/issues/366)) +- Add CMUX example to target tests ([4f2ebaa](https://github.com/espressif/esp-protocols/commit/4f2ebaa)) + ## [1.0.2](https://github.com/espressif/esp-protocols/commits/modem-v1.0.2) ### Features diff --git a/components/esp_modem/idf_component.yml b/components/esp_modem/idf_component.yml index 0fbad8207..11e2e66e8 100644 --- a/components/esp_modem/idf_component.yml +++ b/components/esp_modem/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.0.2" +version: "1.0.3" description: esp modem url: https://github.com/espressif/esp-protocols/tree/master/components/esp_modem dependencies: