Skip to content

Commit c6e2eb2

Browse files
authored
Merge pull request #556 from leeebo/master
feat(esp_modem): example add esp32p4 usb support (IDFGH-12673)
2 parents d7eaa77 + adafeae commit c6e2eb2

File tree

11 files changed

+33
-11
lines changed

11 files changed

+33
-11
lines changed

Diff for: components/esp_modem/examples/modem_console/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class.
1616

1717
### USB DTE support
1818

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

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

Diff for: components/esp_modem/examples/modem_console/main/Kconfig.projbuild

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ menu "Example Configuration"
1010
Connect to modem via UART.
1111
config EXAMPLE_SERIAL_CONFIG_USB
1212
bool "USB"
13-
depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
13+
depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4
1414
help
1515
Connect to modem via USB (CDC-ACM class). For IDF version >= 4.4.
1616
endchoice
@@ -36,6 +36,11 @@ menu "Example Configuration"
3636
bool "BG96"
3737
help
3838
Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module.
39+
config EXAMPLE_MODEM_DEVICE_EC20
40+
depends on EXAMPLE_SERIAL_CONFIG_USB
41+
bool "EC20"
42+
help
43+
Quectel EC20 is a series of LTE Cat M4 module.
3944
config EXAMPLE_MODEM_DEVICE_SIM7000
4045
depends on EXAMPLE_SERIAL_CONFIG_UART
4146
bool "SIM7000"

Diff for: components/esp_modem/examples/modem_console/main/idf_component.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
version: "^1.0.0"
77
override_path: "../../../"
88
espressif/esp_modem_usb_dte:
9-
version: "^1.1.0"
9+
version: "^1.2.0"
1010
rules:
1111
- if: "idf_version >=4.4"
12-
- if: "target in [esp32s2, esp32s3]"
12+
- if: "target in [esp32s2, esp32s3, esp32p4]"

Diff for: components/esp_modem/examples/modem_console/main/modem_console_main.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ extern "C" void app_main(void)
160160
#if CONFIG_EXAMPLE_MODEM_DEVICE_BG96 == 1
161161
ESP_LOGI(TAG, "Initializing esp_modem for the BG96 module...");
162162
struct esp_modem_usb_term_config usb_config = ESP_MODEM_BG96_USB_CONFIG();
163+
#elif CONFIG_EXAMPLE_MODEM_DEVICE_EC20 == 1
164+
ESP_LOGI(TAG, "Initializing esp_modem for the EC20 module...");
165+
struct esp_modem_usb_term_config usb_config = ESP_MODEM_EC20_USB_CONFIG();
163166
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1
164167
ESP_LOGI(TAG, "Initializing esp_modem for the SIM7600 module...");
165168
struct esp_modem_usb_term_config usb_config = ESP_MODEM_SIM7600_USB_CONFIG();
@@ -180,7 +183,7 @@ extern "C" void app_main(void)
180183
});
181184
#if CONFIG_EXAMPLE_MODEM_DEVICE_BG96 == 1
182185
std::unique_ptr<DCE> dce = create_BG96_dce(&dce_config, dte, esp_netif);
183-
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1 || CONFIG_EXAMPLE_MODEM_DEVICE_A7670 == 1
186+
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1 || CONFIG_EXAMPLE_MODEM_DEVICE_A7670 == 1 || CONFIG_EXAMPLE_MODEM_DEVICE_EC20 == 1
184187
std::unique_ptr<DCE> dce = create_SIM7600_dce(&dce_config, dte, esp_netif);
185188
#else
186189
#error USB modem not selected
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_IDF_TARGET="esp32p4"
2+
CONFIG_EXAMPLE_SERIAL_CONFIG_USB=y

Diff for: components/esp_modem/examples/pppos_client/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ See the README.md file in the upper level `pppos` directory for more information
1111

1212
### USB DTE support
1313

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

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

Diff for: components/esp_modem/examples/pppos_client/main/Kconfig.projbuild

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ menu "Example Configuration"
99
Connect to modem via UART.
1010
config EXAMPLE_SERIAL_CONFIG_USB
1111
bool "USB"
12-
depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
12+
depends on IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4
1313
help
1414
Connect to modem via USB (CDC-ACM class). For IDF version >= 4.4.
1515
endchoice
@@ -29,6 +29,11 @@ menu "Example Configuration"
2929
bool "BG96"
3030
help
3131
Quectel BG96 is a series of LTE Cat M1/Cat NB1/EGPRS module.
32+
config EXAMPLE_MODEM_DEVICE_EC20
33+
depends on EXAMPLE_SERIAL_CONFIG_USB
34+
bool "EC20"
35+
help
36+
Quectel EC20 is a series of LTE Cat M4 module.
3237
config EXAMPLE_MODEM_DEVICE_SIM7000
3338
depends on EXAMPLE_SERIAL_CONFIG_UART
3439
bool "SIM7000"

Diff for: components/esp_modem/examples/pppos_client/main/idf_component.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
version: "^1.0.0"
77
override_path: "../../../"
88
espressif/esp_modem_usb_dte:
9-
version: "^1.1.0"
9+
version: "^1.2.0"
1010
rules:
1111
- if: "idf_version >=4.4"
12-
- if: "target in [esp32s2, esp32s3]"
12+
- if: "target in [esp32s2, esp32s3, esp32p4]"

Diff for: components/esp_modem/examples/pppos_client/main/pppos_client_main.c

+4
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ void app_main(void)
219219
ESP_LOGI(TAG, "Initializing esp_modem for the BG96 module...");
220220
struct esp_modem_usb_term_config usb_config = ESP_MODEM_BG96_USB_CONFIG();
221221
esp_modem_dce_device_t usb_dev_type = ESP_MODEM_DCE_BG96;
222+
#elif CONFIG_EXAMPLE_MODEM_DEVICE_EC20 == 1
223+
ESP_LOGI(TAG, "Initializing esp_modem for the EC20 module...");
224+
struct esp_modem_usb_term_config usb_config = ESP_MODEM_EC20_USB_CONFIG();
225+
esp_modem_dce_device_t usb_dev_type = ESP_MODEM_DCE_EC20;
222226
#elif CONFIG_EXAMPLE_MODEM_DEVICE_SIM7600 == 1
223227
ESP_LOGI(TAG, "Initializing esp_modem for the SIM7600 module...");
224228
struct esp_modem_usb_term_config usb_config = ESP_MODEM_SIM7600_USB_CONFIG();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_IDF_TARGET="esp32p4"
2+
CONFIG_EXAMPLE_SERIAL_CONFIG_USB=y

Diff for: components/esp_modem/include/esp_modem_c_api_types.h

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ typedef enum esp_modem_dce_device {
5252
ESP_MODEM_DCE_SIM7070,
5353
ESP_MODEM_DCE_SIM7000,
5454
ESP_MODEM_DCE_BG96,
55+
ESP_MODEM_DCE_EC20,
5556
ESP_MODEM_DCE_SIM800,
5657
ESP_MODEM_DCE_CUSTOM
5758
} esp_modem_dce_device_t;

0 commit comments

Comments
 (0)