diff --git a/components/esp_modem/examples/modem_console/main/Kconfig.projbuild b/components/esp_modem/examples/modem_console/main/Kconfig.projbuild index 1415229f1..f568158c4 100644 --- a/components/esp_modem/examples/modem_console/main/Kconfig.projbuild +++ b/components/esp_modem/examples/modem_console/main/Kconfig.projbuild @@ -16,17 +16,18 @@ menu "Example Configuration" endchoice choice EXAMPLE_MODEM_DEVICE - depends on EXAMPLE_SERIAL_CONFIG_UART prompt "Choose supported modem device (DCE)" default EXAMPLE_MODEM_DEVICE_BG96 help Select modem device connected to the ESP DTE. config EXAMPLE_MODEM_DEVICE_SHINY + depends on EXAMPLE_SERIAL_CONFIG_UART bool "SHINY" help SHINY is a GSM/GPRS module. It supports SHINY. config EXAMPLE_MODEM_DEVICE_SIM800 + depends on EXAMPLE_SERIAL_CONFIG_UART bool "SIM800" help SIMCom SIM800L is a GSM/GPRS module. @@ -36,10 +37,12 @@ menu "Example Configuration" help Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module. config EXAMPLE_MODEM_DEVICE_SIM7000 + depends on EXAMPLE_SERIAL_CONFIG_UART bool "SIM7000" help SIM7000 is a Multi-Band LTE-FDD and GSM/GPRS/EDGE module. config EXAMPLE_MODEM_DEVICE_SIM7070 + depends on EXAMPLE_SERIAL_CONFIG_UART bool "SIM7070" help SIM7070 is Multi-Band CAT M and NB IoT module. @@ -47,6 +50,11 @@ menu "Example Configuration" bool "SIM7600" help SIM7600 is a Multi-Band LTE-TDD/LTE-FDD/HSPA+ and GSM/GPRS/EDGE module. + config EXAMPLE_MODEM_DEVICE_A7670 + depends on EXAMPLE_SERIAL_CONFIG_USB + bool "A7670" + help + A7670X is Multi-Band LTE-FDD/LTE-TDD/GSM/GPRS/EDGE module. endchoice config EXAMPLE_MODEM_PPP_APN diff --git a/components/esp_modem/examples/modem_console/main/idf_component.yml b/components/esp_modem/examples/modem_console/main/idf_component.yml index 4c9e8c885..5db8dadcf 100644 --- a/components/esp_modem/examples/modem_console/main/idf_component.yml +++ b/components/esp_modem/examples/modem_console/main/idf_component.yml @@ -6,7 +6,7 @@ dependencies: version: "^0.1.20" override_path: "../../../" espressif/esp_modem_usb_dte: - version: "^1.0.0" + version: "^1.1.0" rules: - if: "idf_version >=4.4" - if: "target in [esp32s2, esp32s3]" diff --git a/components/esp_modem/examples/modem_console/main/modem_console_main.cpp b/components/esp_modem/examples/modem_console/main/modem_console_main.cpp index b5e5b7de5..a6ff09635 100644 --- a/components/esp_modem/examples/modem_console/main/modem_console_main.cpp +++ b/components/esp_modem/examples/modem_console/main/modem_console_main.cpp @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -48,9 +48,9 @@ } } while (0) /** - * Please update the default APN name here (this could be updated runtime) + * Default APN name is taken from Kconfig (this could be updated runtime) */ -#define DEFAULT_APN "my_apn" +#define DEFAULT_APN CONFIG_EXAMPLE_MODEM_PPP_APN #define GPIO_OUTPUT_PWRKEY (gpio_num_t)CONFIG_EXAMPLE_MODEM_PWRKEY_PIN #define GPIO_OUTPUT_PIN_SEL (1ULL< dce = create_BG96_dce(&dce_config, dte, esp_netif); +#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1 || CONFIG_EXAMPLE_MODEM_DEVICE_A7670 == 1 + std::unique_ptr dce = create_SIM7600_dce(&dce_config, dte, esp_netif); +#else +#error USB modem not selected +#endif #else #error Invalid serial connection to modem. diff --git a/components/esp_modem/examples/pppos_client/main/Kconfig.projbuild b/components/esp_modem/examples/pppos_client/main/Kconfig.projbuild index 0c61114fd..07a61d59f 100644 --- a/components/esp_modem/examples/pppos_client/main/Kconfig.projbuild +++ b/components/esp_modem/examples/pppos_client/main/Kconfig.projbuild @@ -15,12 +15,12 @@ menu "Example Configuration" endchoice choice EXAMPLE_MODEM_DEVICE - depends on EXAMPLE_SERIAL_CONFIG_UART prompt "Choose supported modem device (DCE)" default EXAMPLE_MODEM_DEVICE_BG96 help Select modem device connected to the ESP DTE. config EXAMPLE_MODEM_DEVICE_SIM800 + depends on EXAMPLE_SERIAL_CONFIG_UART bool "SIM800" help SIMCom SIM800L is a GSM/GPRS module. @@ -30,10 +30,12 @@ menu "Example Configuration" help Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module. config EXAMPLE_MODEM_DEVICE_SIM7000 + depends on EXAMPLE_SERIAL_CONFIG_UART bool "SIM7000" help SIM7000 is a Multi-Band LTE-FDD and GSM/GPRS/EDGE module. config EXAMPLE_MODEM_DEVICE_SIM7070 + depends on EXAMPLE_SERIAL_CONFIG_UART bool "SIM7070" help SIM7070 is Multi-Band CAT M and NB IoT module. @@ -41,6 +43,11 @@ menu "Example Configuration" bool "SIM7600" help SIM7600 is a Multi-Band LTE-TDD/LTE-FDD/HSPA+ and GSM/GPRS/EDGE module. + config EXAMPLE_MODEM_DEVICE_A7670 + depends on EXAMPLE_SERIAL_CONFIG_USB + bool "A7670" + help + A7670X is Multi-Band LTE-FDD/LTE-TDD/GSM/GPRS/EDGE module. endchoice config EXAMPLE_MODEM_PPP_APN diff --git a/components/esp_modem/examples/pppos_client/main/idf_component.yml b/components/esp_modem/examples/pppos_client/main/idf_component.yml index dd06b5100..79f5a6a70 100644 --- a/components/esp_modem/examples/pppos_client/main/idf_component.yml +++ b/components/esp_modem/examples/pppos_client/main/idf_component.yml @@ -6,7 +6,7 @@ dependencies: version: "^0.1.23" override_path: "../../../" espressif/esp_modem_usb_dte: - version: "^1.0.0" + version: "^1.1.0" rules: - if: "idf_version >=4.4" - if: "target in [esp32s2, esp32s3]" diff --git a/components/esp_modem/examples/pppos_client/main/pppos_client_main.c b/components/esp_modem/examples/pppos_client/main/pppos_client_main.c index b073847b9..1b0132776 100644 --- a/components/esp_modem/examples/pppos_client/main/pppos_client_main.c +++ b/components/esp_modem/examples/pppos_client/main/pppos_client_main.c @@ -208,14 +208,28 @@ void app_main(void) #elif defined(CONFIG_EXAMPLE_SERIAL_CONFIG_USB) while (1) { +#if CONFIG_EXAMPLE_MODEM_DEVICE_BG96 == 1 ESP_LOGI(TAG, "Initializing esp_modem for the BG96 module..."); - struct esp_modem_usb_term_config usb_config = ESP_MODEM_DEFAULT_USB_CONFIG(0x2C7C, 0x0296, 2); // VID, PID and interface num of BG96 modem + struct esp_modem_usb_term_config usb_config = ESP_MODEM_BG96_USB_CONFIG(); + esp_modem_dce_device_t usb_dev_type = ESP_MODEM_DCE_BG96; +#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1 + ESP_LOGI(TAG, "Initializing esp_modem for the SIM7600 module..."); + struct esp_modem_usb_term_config usb_config = ESP_MODEM_SIM7600_USB_CONFIG(); + esp_modem_dce_device_t usb_dev_type = ESP_MODEM_DCE_SIM7600; +#elif CONFIG_EXAMPLE_MODEM_DEVICE_A7670 == 1 + ESP_LOGI(TAG, "Initializing esp_modem for the A7670 module..."); + struct esp_modem_usb_term_config usb_config = ESP_MODEM_A7670_USB_CONFIG(); + esp_modem_dce_device_t usb_dev_type = ESP_MODEM_DCE_SIM7600; +#else +#error USB modem not selected +#endif const esp_modem_dte_config_t dte_usb_config = ESP_MODEM_DTE_DEFAULT_USB_CONFIG(usb_config); ESP_LOGI(TAG, "Waiting for USB device connection..."); - esp_modem_dce_t *dce = esp_modem_new_dev_usb(ESP_MODEM_DCE_BG96, &dte_usb_config, &dce_config, esp_netif); + esp_modem_dce_t *dce = esp_modem_new_dev_usb(usb_dev_type, &dte_usb_config, &dce_config, esp_netif); assert(dce); esp_modem_set_error_cb(dce, usb_terminal_error_handler); - vTaskDelay(pdMS_TO_TICKS(1000)); // Although the DTE should be ready after USB enumeration, sometimes it fails to respond without this delay + ESP_LOGI(TAG, "Modem connected, waiting 10 seconds for boot..."); + vTaskDelay(pdMS_TO_TICKS(10000)); // Give DTE some time to boot #else #error Invalid serial connection to modem.