Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The CMUX is not activate in the code #1

Open
danguyensw opened this issue Mar 24, 2021 · 2 comments
Open

The CMUX is not activate in the code #1

danguyensw opened this issue Mar 24, 2021 · 2 comments

Comments

@danguyensw
Copy link

danguyensw commented Mar 24, 2021

I tried to test the CMUX support on TTGO SIM7000G board, and saw the following issues:

  • In current code bg96.c file, the CMUX is not activated by default.
   /* CMUX */
    if (bg96_dce->parent.dte->cmux) {
        ESP_LOGI(DCE_TAG, "CMUX setup");
 //         esp_modem_start_cmux(dte); 
 //       DCE_CHECK(bg96_dce->parent.dte->change_mode(bg96_dce->parent.dte, 2) == ESP_OK, "CMUX failed", err_io);
    }
@danguyensw
Copy link
Author

Need to apply this patch to enable the CMUX setup form modem SIM7600 without exception

diff --git a/components/modem/src/bg96.c b/components/modem/src/bg96.c
index 19eb88c..c346cc7 100644
--- a/components/modem/src/bg96.c
+++ b/components/modem/src/bg96.c
@@ -538,12 +538,14 @@ modem_dce_t *bg96_init(modem_dte_t *dte)
     /* Sync between DTE and DCE */
     DCE_CHECK(esp_modem_dce_sync(&(bg96_dce->parent)) == ESP_OK, "sync failed", err_io);
 
+#ifndef CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600
     /* CMUX */
     if (bg96_dce->parent.dte->cmux) {
         ESP_LOGI(DCE_TAG, "CMUX setup");
- //         esp_modem_start_cmux(dte); 
- //       DCE_CHECK(bg96_dce->parent.dte->change_mode(bg96_dce->parent.dte, 2) == ESP_OK, "CMUX failed", err_io);
+        esp_modem_start_cmux(dte);
+        DCE_CHECK(bg96_dce->parent.dte->change_mode(bg96_dce->parent.dte, 2) == ESP_OK, "CMUX failed", err_io);
     }
+#endif
 
     /* Close echo */
     DCE_CHECK(esp_modem_dce_echo(&(bg96_dce->parent), false) == ESP_OK, "close echo mode failed", err_io);
diff --git a/components/modem/src/sim7600.c b/components/modem/src/sim7600.c
index 84f9821..ecf3561 100644
--- a/components/modem/src/sim7600.c
+++ b/components/modem/src/sim7600.c
@@ -87,5 +87,15 @@ modem_dce_t *sim7600_init(modem_dte_t *dte)
     modem_dce_t *dce = bg96_init(dte);
     dte->dce->get_battery_status = sim7600_get_battery_status;
     dte->dce->setup_cmux = esp_modem_dce_setup_cmux;
+
+    /* CMUX */
+    if (dte->cmux) {
+        ESP_LOGI(DCE_TAG, "CMUX setup");
+        esp_modem_start_cmux(dte);
+        DCE_CHECK(dte->change_mode(dte, 2) == ESP_OK, "CMUX failed", err);
+    }
+
     return dce;
+err:
+    return NULL;
 }

But later in the esp_modem_dce_setup_cmux function, I got timeout

W (26734) pppos_example: Unknow line received: AT+CMUX=0
I (26794) bg96: CMUX command success
I (26794) bg96: enter CMUX mode ok
I (26804) dce_service: setup_cmux
E (28304) esp-modem: esp_modem_dte_send_sabm(447): process command timeout
E (28304) dce_service: esp_modem_dce_setup_cmux(127): send command failed

@olliiiver
Copy link
Owner

Hi. There is a line in pppos_client_main.c which is used to enable CMUX mode right after the modem has been initialised.

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

No branches or pull requests

2 participants