Skip to content

Commit 2eebd55

Browse files
committed
Merge branch 'feat/p4_support_ec20' into 'master'
feat(‎iot_usbh_modem‎): support esp32p4 with cat.4 module See merge request ae_group/esp-iot-solution!1158
2 parents 0ddb3b2 + 1d3983f commit 2eebd55

File tree

13 files changed

+57
-36
lines changed

13 files changed

+57
-36
lines changed

.gitlab/ci/build.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,10 +863,7 @@ build_example_usb_host_usb_cdc_4g_module:
863863
extends:
864864
- .build_examples_template
865865
- .rules:build:example_usb_host_usb_cdc_4g_module
866-
parallel:
867-
matrix:
868-
- IMAGE: espressif/idf:release-v4.4
869-
- IMAGE: espressif/idf:release-v5.1
866+
- .build_idf_version_greater_equal_v5_0
870867
variables:
871868
EXAMPLE_DIR: examples/usb/host/usb_cdc_4g_module
872869

components/usb/iot_usbh_modem/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ChangeLog
22

3+
## v1.1.0 - 2024-11-28
4+
5+
* Support ESP32-P4 with EC20_CE cat.4 module
6+
37
## v1.0.0 - 2024-11-14
48

59
* Use iot_usbh_cdc version 1.0.0
@@ -15,7 +19,6 @@
1519
* Fix concurrency issue in AT command mode
1620
* Fix memory stamp issue in `common_get_operator_after_mode_format`
1721

18-
1922
## v0.1.6 - 2023-04-17
2023

2124
* Fix PPP mode can not exit gracefully

components/usb/iot_usbh_modem/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ menu "IoT USB Host Modem"
2222
bool "BG96MA"
2323
config MODEM_TARGET_MC610_EU
2424
bool "MC610_EU"
25+
config MODEM_TARGET_EC20_CE
26+
bool "EC20_CE"
2527
config MODEM_TARGET_USER
2628
bool "User Defined"
2729
endchoice
@@ -37,6 +39,7 @@ menu "IoT USB Host Modem"
3739
default "BG95M3" if MODEM_TARGET_BG95_M3
3840
default "BG96MA" if MODEM_TARGET_BG96_MA
3941
default "MC610_EU" if MODEM_TARGET_MC610_EU
42+
default "EC20_CE" if MODEM_TARGET_EC20_CE
4043
default "User Defined" if MODEM_TARGET_USER
4144

4245
config MODEM_SUPPORT_SECONDARY_AT_PORT
@@ -52,6 +55,7 @@ menu "IoT USB Host Modem"
5255
default 0x04 if MODEM_TARGET_EC600N_CNLC_N06
5356
default 0x06 if MODEM_TARGET_MC610_EU
5457
default 0x05 if MODEM_TARGET_A7600C1
58+
default 0x02 if MODEM_TARGET_EC20_CE
5559
help
5660
USB CDC interface (eg.0x00) used for send AT/data to device
5761

components/usb/iot_usbh_modem/idf_component.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.0.0"
1+
version: "1.1.0"
22
targets:
33
- esp32s2
44
- esp32s3
@@ -13,6 +13,10 @@ dependencies:
1313
iot_usbh_cdc:
1414
version: "1.*"
1515
override_path: "../iot_usbh_cdc"
16+
espressif/esp_wifi_remote:
17+
version: "0.*"
18+
rules:
19+
- if: "target in [esp32p4]"
1620
examples:
1721
- path: ../../../examples/usb/host/usb_cdc_4g_module
1822
sbom:

components/usb/iot_usbh_modem/src/esp_modem_usb_dte.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ esp_modem_dte_t *esp_modem_dte_new(const esp_modem_dte_config_t *config)
509509
dev_config.cbs.connect = NULL;
510510
dev_config.cbs.disconnect = NULL;
511511
dev_config.cbs.user_data = NULL;
512+
dev_config.cbs.revc_data = NULL;
512513
handle = NULL;
513514
usbh_cdc_create(&dev_config, &handle);
514515
ESP_MODEM_ERR_CHECK(handle != NULL, "usb cdc device create failed", err_usb_config);

examples/usb/host/usb_cdc_4g_module/README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# USB CDC 4G Module
44

5-
This example demonstrates the ESP32-S2, ESP32-S3 series SoC as a USB host to dial-up 4G Cat.1 through PPP to access the Internet, with the help of ESP32-SX Wi-Fi softAP function, share the Internet with IoT devices or mobile devices. Realize low-cost "medium-high-speed" Internet access.It is also equipped with a router management interface, which allows you to configure the router online and view the information of connected devices.
5+
This example demonstrates the **ESP32-S2**, **ESP32-S3** series SoC as a USB host to dial-up 4G Cat.1 through PPP to access the Internet, with the help of ESP32-SX Wi-Fi softAP function, share the Internet with IoT devices or mobile devices. Realize low-cost "medium-high-speed" Internet access.It is also equipped with a router management interface, which allows you to configure the router online and view the information of connected devices.
6+
7+
In addition, the **ESP32-P4** supports the 4G Cat.4 module (EC20) with faster speeds, but it currently only supports internet access for itself.
68

79
**Features Supported:**
810

@@ -20,10 +22,11 @@ This example demonstrates the ESP32-S2, ESP32-S3 series SoC as a USB host to dia
2022

2123
## Hardware requirement
2224

23-
**Supported ESP Soc:**
25+
**Supported ESP Soc:**
2426

2527
* ESP32-S2
2628
* ESP32-S3
29+
* ESP32-P4
2730

2831
> We recommend using ESP modules or chips that integrate 4MB above Flash, and 2MB above PSRAM. The example does not enable PSRAM by default, but users can add to tests by themselves. In theory, increasing the Wi-Fi buffer size can increase the average data throughput rate.
2932
@@ -116,8 +119,8 @@ I (9659) esp-modem: --------- Modem PreDefined Info ------------------
116119
I (9666) esp-modem: Model: ML302-DNLM/CNLM
117120
I (9671) esp-modem: Modem itf: IN Addr:0x81, OUT Addr:0x01
118121
I (9677) esp-modem: ----------------------------------------------------
119-
I (9684) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
120-
I (9694) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
122+
I (9684) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
123+
I (9694) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
121124
W (9704) USB_HCDC: rx0 flush -0 = 0
122125
W (9707) modem_board: DTE reconnect, reconnecting ...
123126
@@ -188,11 +191,11 @@ I (15948) modem_wifi: softap ssid: esp_4g_router password: 12345678
188191
I (15954) modem_wifi: NAT is enabled
189192
```
190193

191-
## Debugging method
194+
## Debugging method
192195

193196
**1. Debugging mode**
194197

195-
Enable the `4G Modem Configuration -> Dump system task status` option in `menuconfig` to print task detailed information, or open the `Component config → USB Host CDC ->Trace internal memory status` option to print usb internal buffer usage information.
198+
Enable the `4G Modem Configuration -> Dump system task status` option in `menuconfig` to print task detailed information.
196199

197200
```
198201
I (79530) main: Task dump
@@ -211,14 +214,6 @@ Enable the `4G Modem Configuration -> Dump system task status` option in `menuco
211214
I (79577) main: 0.00 1092 sys_evt 20
212215
I (79582) main: Free heap=37088 bigst=16384, internal=36968 bigst=16384
213216
I (79589) main: ..............
214-
215-
I (79593) USB_HCDC: USBH CDC Transfer Buffer Dump:
216-
I (79599) USB_HCDC: usb transfer Buffer size, out = 3000, in = 1500
217-
I (79606) USB_HCDC: usb transfer Max packet size, out = 46, in = 48
218-
219-
I (79613) USB_HCDC: USBH CDC Ringbuffer Dump:
220-
I (79618) USB_HCDC: usb ringbuffer size, out = 15360, in = 15360
221-
I (79625) USB_HCDC: usb ringbuffer High water mark, out = 46, in = 48
222217
```
223218

224219
**2. Performance optimization**
@@ -249,3 +244,7 @@ Enable the `4G Modem Configuration -> Dump system task status` option in `menuco
249244
250245
> **4G Cat.1 theoretical peak download rate is 10 Mbps, peak upload rate is 5 Mbps**
251246
> The actual communication rate is affected by the operator's network, test software, Wi-Fi interference, and the number of terminal connections, etc.
247+
248+
## Known Issues
249+
250+
* ESP32-P4 currently does not support enabling the softAP function via `esp_wifi_remote`.

examples/usb/host/usb_cdc_4g_module/README_cn.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# USB CDC 4G Module
44

5-
该示例程序可实现 ESP32-S2,ESP32-S3 系列 SoC 作为 USB 主机驱动 4G Cat.1 模组 PPP 拨号上网,同时可开启 ESP32-SX Wi-Fi AP 功能,分享互联网给物联网设备或手持设备,实现低成本 “中高速” 互联网接入。同时配有路由器管理界面,可以在线进行路由器配置和查看已连接设备信息。
5+
该示例程序可实现 **ESP32-S2****ESP32-S3** 系列 SoC 作为 USB 主机驱动 4G Cat.1 模组 PPP 拨号上网,同时可开启 ESP32-SX Wi-Fi AP 功能,分享互联网给物联网设备或手持设备,实现低成本 “中高速” 互联网接入。同时配有路由器管理界面,可以在线进行路由器配置和查看已连接设备信息。
6+
7+
此外对于 **ESP32-P4** 支持了 4G Cat.4 模组(EC20),速率更快,暂时仅支持自身上网功能。
68

79
**已实现功能:**
810

@@ -20,10 +22,11 @@
2022

2123
## 硬件准备
2224

23-
**已支持 ESP 芯片型号:**
25+
**已支持 ESP 芯片型号:**
2426

2527
* ESP32-S2
2628
* ESP32-S3
29+
* ESP32-P4
2730

2831
> 建议使用集成 4MB 及以上 Flash,2MB 及以上 PSRAM 的 ESP 模组或芯片。示例程序默认不开启 PSRAM,用户可自行添加测试,理论上增大缓冲区大小可以提高数据平均吞吐率
2932
@@ -121,8 +124,8 @@ I (9659) esp-modem: --------- Modem PreDefined Info ------------------
121124
I (9666) esp-modem: Model: ML302-DNLM/CNLM
122125
I (9671) esp-modem: Modem itf: IN Addr:0x81, OUT Addr:0x01
123126
I (9677) esp-modem: ----------------------------------------------------
124-
I (9684) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
125-
I (9694) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
127+
I (9684) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
128+
I (9694) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
126129
W (9704) USB_HCDC: rx0 flush -0 = 0
127130
W (9707) modem_board: DTE reconnect, reconnecting ...
128131

@@ -197,7 +200,7 @@ I (15954) modem_wifi: NAT is enabled
197200
198201
**1. 调试模式**
199202
200-
可在 `menuconfig` 打开 `4G Modem Configuration -> Dump system task status` 选项打印 task 详细信息,也可打开 `Component config → USB Host CDC ->Trace internal memory status ` 选项打印 usb 内部 buffer 使用信息
203+
可在 `menuconfig` 打开 `4G Modem Configuration -> Dump system task status` 选项打印 task 详细信息。
201204
202205
```
203206
I (79530) main: Task dump
@@ -216,14 +219,6 @@ I (15954) modem_wifi: NAT is enabled
216219
I (79577) main: 0.00 1092 sys_evt 20
217220
I (79582) main: Free heap=37088 bigst=16384, internal=36968 bigst=16384
218221
I (79589) main: ..............
219-
220-
I (79593) USB_HCDC: USBH CDC Transfer Buffer Dump:
221-
I (79599) USB_HCDC: usb transfer Buffer size, out = 3000, in = 1500
222-
I (79606) USB_HCDC: usb transfer Max packet size, out = 46, in = 48
223-
224-
I (79613) USB_HCDC: USBH CDC Ringbuffer Dump:
225-
I (79618) USB_HCDC: usb ringbuffer size, out = 15360, in = 15360
226-
I (79625) USB_HCDC: usb ringbuffer High water mark, out = 46, in = 48
227222
```
228223
229224
**2. 性能优化**
@@ -255,3 +250,7 @@ I (15954) modem_wifi: NAT is enabled
255250
256251
> **4G Cat.1 理论峰值下载速率 10 Mbps,峰值上传速率 5 Mbps**
257252
> 实际通信速率受运营商网络、测试软件、Wi-Fi 干扰情况、终端连接数影响,以实际使用为准
253+
254+
## 已知问题
255+
256+
* ESP32-P4 暂不支持通过 esp_wifi_remote 开启 softAP 功能。

examples/usb/host/usb_cdc_4g_module/main/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ if(CONFIG_EXAMPLE_ENABLE_WEB_ROUTER)
55
else()
66
idf_component_register(SRC_DIRS "."
77
INCLUDE_DIRS "."
8-
EXCLUDE_SRCS "modem_http_config.c" "modem_http_config.h" )
8+
EXCLUDE_SRCS "modem_http_config.c")
99
endif()

examples/usb/host/usb_cdc_4g_module/main/Kconfig.projbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ menu "4G Modem Example Config"
5757
config EXAMPLE_AUTO_UPDATE_DNS
5858
bool "Auto update Wi-Fi soft ap DNS address"
5959
default y
60+
default n if IDF_TARGET_ESP32P4
6061
help
6162
If true using dns address got from ppp
6263

examples/usb/host/usb_cdc_4g_module/main/app_main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,12 @@ void app_main(void)
247247
modem_http_get_nvs_wifi_config(&s_modem_wifi_config);
248248
modem_http_init(&s_modem_wifi_config);
249249
#endif
250+
251+
#if !CONFIG_IDF_TARGET_ESP32P4
250252
esp_netif_t *ap_netif = modem_wifi_ap_init();
251253
assert(ap_netif != NULL);
252254
ESP_ERROR_CHECK(modem_wifi_set(&s_modem_wifi_config));
255+
#endif
253256

254257
#ifdef CONFIG_EXAMPLE_PING_NETWORK
255258
ip_addr_t target_addr;
@@ -282,7 +285,9 @@ void app_main(void)
282285
esp_ping_new_session(&ping_config, &cbs, &ping);
283286
#endif
284287

288+
#ifdef CONFIG_EXAMPLE_AUTO_UPDATE_DNS
285289
uint32_t ap_dns_addr = 0;
290+
#endif
286291
while (1) {
287292

288293
#if !defined(CONFIG_EXAMPLE_ENTER_PPP_DURING_INIT) || defined(CONFIG_MODEM_SUPPORT_SECONDARY_AT_PORT)

0 commit comments

Comments
 (0)