Skip to content

Commit

Permalink
feat(esp_modem): example add esp32p4 usb support
Browse files Browse the repository at this point in the history
1. support ec20 cat.4 module in example modem_console and pppos_client
2. support esp32p4 in example modem_console and pppos_client
  • Loading branch information
leeebo committed Jun 24, 2024
1 parent 1c5a149 commit adafeae
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 11 deletions.
4 changes: 2 additions & 2 deletions components/esp_modem/examples/modem_console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class.

### USB DTE support

For USB enabled targets (ESP32-S2 and ESP32-S3), it is possible to connect to the modem device via USB.
For USB enabled targets (ESP32-S2, ESP32-S3, or ESP32-P4), it is possible to connect to the modem device via USB.
1. In menuconfig, navigate to `Example Configuration->Type of serial connection to the modem` and choose `USB`.
2. Connect the modem USB signals to pin 19 (DATA-) and 20 (DATA+) on your ESP chip.
2. Connect the modem USB signals to your ESP chip (pin 19 (DATA-) and 20 (DATA+) for ESP32-S2/S3).

USB example uses Quactel BG96 modem device. BG96 needs a positive pulse on its PWK pin to boot-up.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ menu "Example Configuration"
Connect to modem via UART.
config EXAMPLE_SERIAL_CONFIG_USB
bool "USB"
depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4
help
Connect to modem via USB (CDC-ACM class). For IDF version >= 4.4.
endchoice
Expand All @@ -36,6 +36,11 @@ menu "Example Configuration"
bool "BG96"
help
Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module.
config EXAMPLE_MODEM_DEVICE_EC20
depends on EXAMPLE_SERIAL_CONFIG_USB
bool "EC20"
help
Quectel EC20 is a series of LTE Cat M4 module.
config EXAMPLE_MODEM_DEVICE_SIM7000
depends on EXAMPLE_SERIAL_CONFIG_UART
bool "SIM7000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
version: "^1.0.0"
override_path: "../../../"
espressif/esp_modem_usb_dte:
version: "^1.1.0"
version: "^1.2.0"
rules:
- if: "idf_version >=4.4"
- if: "target in [esp32s2, esp32s3]"
- if: "target in [esp32s2, esp32s3, esp32p4]"
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ extern "C" void app_main(void)
#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_BG96_USB_CONFIG();
#elif CONFIG_EXAMPLE_MODEM_DEVICE_EC20 == 1
ESP_LOGI(TAG, "Initializing esp_modem for the EC20 module...");
struct esp_modem_usb_term_config usb_config = ESP_MODEM_EC20_USB_CONFIG();
#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();
Expand All @@ -180,7 +183,7 @@ extern "C" void app_main(void)
});
#if CONFIG_EXAMPLE_MODEM_DEVICE_BG96 == 1
std::unique_ptr<DCE> dce = create_BG96_dce(&dce_config, dte, esp_netif);
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1 || CONFIG_EXAMPLE_MODEM_DEVICE_A7670 == 1
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1 || CONFIG_EXAMPLE_MODEM_DEVICE_A7670 == 1 || CONFIG_EXAMPLE_MODEM_DEVICE_EC20 == 1
std::unique_ptr<DCE> dce = create_SIM7600_dce(&dce_config, dte, esp_netif);
#else
#error USB modem not selected
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_IDF_TARGET="esp32p4"
CONFIG_EXAMPLE_SERIAL_CONFIG_USB=y
4 changes: 2 additions & 2 deletions components/esp_modem/examples/pppos_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ See the README.md file in the upper level `pppos` directory for more information

### USB DTE support

For USB enabled targets (ESP32-S2 and ESP32-S3), it is possible to connect to the modem device via USB.
For USB enabled targets (ESP32-S2, ESP32-S3, or ESP32-P4), it is possible to connect to the modem device via USB.
1. In menuconfig, navigate to `Example Configuration->Type of serial connection to the modem` and choose `USB`.
2. Connect the modem USB signals to pin 19 (DATA-) and 20 (DATA+) on your ESP chip.
2. Connect the modem USB signals to your ESP chip (pin 19 (DATA-) and 20 (DATA+) for ESP32-S2/S3).

USB example uses Quactel BG96 modem device. BG96 needs a positive pulse on its PWK pin to boot-up.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ menu "Example Configuration"
Connect to modem via UART.
config EXAMPLE_SERIAL_CONFIG_USB
bool "USB"
depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4
help
Connect to modem via USB (CDC-ACM class). For IDF version >= 4.4.
endchoice
Expand All @@ -29,6 +29,11 @@ menu "Example Configuration"
bool "BG96"
help
Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module.
config EXAMPLE_MODEM_DEVICE_EC20
depends on EXAMPLE_SERIAL_CONFIG_USB
bool "EC20"
help
Quectel EC20 is a series of LTE Cat M4 module.
config EXAMPLE_MODEM_DEVICE_SIM7000
depends on EXAMPLE_SERIAL_CONFIG_UART
bool "SIM7000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
version: "^1.0.0"
override_path: "../../../"
espressif/esp_modem_usb_dte:
version: "^1.1.0"
version: "^1.2.0"
rules:
- if: "idf_version >=4.4"
- if: "target in [esp32s2, esp32s3]"
- if: "target in [esp32s2, esp32s3, esp32p4]"
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ void app_main(void)
ESP_LOGI(TAG, "Initializing esp_modem for the BG96 module...");
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_EC20 == 1
ESP_LOGI(TAG, "Initializing esp_modem for the EC20 module...");
struct esp_modem_usb_term_config usb_config = ESP_MODEM_EC20_USB_CONFIG();
esp_modem_dce_device_t usb_dev_type = ESP_MODEM_DCE_EC20;
#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();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_IDF_TARGET="esp32p4"
CONFIG_EXAMPLE_SERIAL_CONFIG_USB=y
1 change: 1 addition & 0 deletions components/esp_modem/include/esp_modem_c_api_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ typedef enum esp_modem_dce_device {
ESP_MODEM_DCE_SIM7070,
ESP_MODEM_DCE_SIM7000,
ESP_MODEM_DCE_BG96,
ESP_MODEM_DCE_EC20,
ESP_MODEM_DCE_SIM800,
ESP_MODEM_DCE_CUSTOM
} esp_modem_dce_device_t;
Expand Down

0 comments on commit adafeae

Please sign in to comment.