分享-ESP32S3 USB外挂EC20CE/EC200U

目标

希望PC或者手机可以直接使用ESP32和移远模组当作一个路由器使用。

硬件连接

这个板子是合肥墨子号的ESP32的开发板。

代码下载和修改

我在Ubuntu 上使用IDF。相关环境略。

git clone https://github.com/espressif/esp-iot-solution.git
cd esp-iot-solution/examples/usb/host/usb_cdc_4g_module
idf.py menuconfig


其实修改的就是
sdkconfig 里的这些配置

编译下载到ESP32里。

// 使用普通用户是没有/dev/ttyUSB0 的读写权限的
sudo chmod 777 /dev/ttyUSB0
编译 下载 和监视串口
 idf.py -p /dev/ttyUSB0 build flash monitor

验证和测试

PPP 拨号成功

ESP32 使能了softAP ,创建热点

PC 和手机验证

默认创建的热点是esp_4g_router,密码是12345678


PC 上的地址

ESP32 的WEBUI

相关的log

I (392) main_task: Calling app_main()
I (392) led_indicator: LED Indicator Version: 0.3.0
I (392) gpio: GPIO[15]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (398) led_indicator: blink_lists is null, use default blink list
W (404) led_indicator: /IDF/esp-iot-solution/examples/usb/host/usb_cdc_4g_module/managed_components/espressif__led_indicator/src/led_indicator.c:280 (_led_indicator_create_com):LED indicator does not have the hal_indicator_set_brightness function
I (425) led_indicator: Indicator create successfully. type:GPIO mode, hardware_data:0xf, is_active_level_high:1, blink_lists:default
I (436) led_indicator: LED Indicator Version: 0.3.0
I (441) gpio: GPIO[17]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (450) led_indicator: blink_lists is null, use default blink list
W (455) led_indicator: /IDF/esp-iot-solution/examples/usb/host/usb_cdc_4g_module/managed_components/espressif__led_indicator/src/led_indicator.c:280 (_led_indicator_create_com):LED indicator does not have the hal_indicator_set_brightness function
I (477) led_indicator: Indicator create successfully. type:GPIO mode, hardware_data:0x11, is_active_level_high:1, blink_lists:default
I (489) led_indicator: LED Indicator Version: 0.3.0
I (493) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (502) led_indicator: blink_lists is null, use default blink list
W (507) led_indicator: /IDF/esp-iot-solution/examples/usb/host/usb_cdc_4g_module/managed_components/espressif__led_indicator/src/led_indicator.c:280 (_led_indicator_create_com):LED indicator does not have the hal_indicator_set_brightness function
I (529) led_indicator: Indicator create successfully. type:GPIO mode, hardware_data:0x10, is_active_level_high:1, blink_lists:default
I (557) 4g_main: ====================================
I (558) 4g_main:      ESP 4G Cat.1 Wi-Fi Router
I (558) 4g_main: ====================================
I (560) modem_board: iot_usbh_modem, version: 1.1.0
I (565) modem_board: Force reset modem board....
I (569) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (578) modem_board: Resetting modem using io=13, level=0
I (783) modem_board: Waiting for modem initialize ready
I (5783) USBH_CDC: iot usbh cdc version: 1.0.0
I (5813) esp-modem: --------- Modem PreDefined Info ------------------
I (5814) esp-modem: Model: EC20_CE
I (5814) esp-modem: Modem itf 2
I (5815) esp-modem: ----------------------------------------------------
I (5821) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (5830) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
Found IN endpoint: 132
Found OUT endpoint: 3
*** Device descriptor ***
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0xef
bDeviceSubClass 0x2
bDeviceProtocol 0x1
bMaxPacketSize0 64
idVendor 0x2c7c
idProduct 0x125
bcdDevice 3.10
iManufacturer 1
iProduct 2
iSerialNumber 0
bNumConfigurations 1
*** Configuration descriptor ***
bLength 9
bDescriptorType 2
wTotalLength 382
bNumInterfaces 8
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
bMaxPower 500mA
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 0
        bAlternateSetting 0
        bNumEndpoints 2
        bInterfaceClass 0xff
        bInterfaceSubClass 0xff
        bInterfaceProtocol 0xff
        iInterface 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x81   EP 1 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x1    EP 1 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 1
        bAlternateSetting 0
        bNumEndpoints 3
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x83   EP 3 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 10
                bInterval 32
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x82   EP 2 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x2    EP 2 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 2
        bAlternateSetting 0
        bNumEndpoints 3
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x85   EP 5 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 10
                bInterval 32
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x84   EP 4 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x3    EP 3 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 3
        bAlternateSetting 0
        bNumEndpoints 3
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x87   EP 7 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 10
                bInterval 32
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x86   EP 6 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x4    EP 4 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 4
        bAlternateSetting 0
        bNumEndpoints 3
        bInterfaceClass 0xff
        bInterfaceSubClass 0xff
        bInterfaceProtocol 0xff
        iInterface 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x89   EP 9 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 8
                bInterval 32
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x88   EP 8 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x5    EP 5 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
*** Interface Association Descriptor ***
bLength 8
bDescriptorType 11
bFirstInterface 5
bInterfaceCount 3
bFunctionClass 0x1
bFunctionSubClass 0x0
bFunctionProtocol 0x0
iFunction 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 5
        bAlternateSetting 0
        bNumEndpoints 0
        bInterfaceClass 0x1
        bInterfaceSubClass 0x1
        bInterfaceProtocol 0x0
        iInterface 7
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 6
        bAlternateSetting 0
        bNumEndpoints 0
        bInterfaceClass 0x1
        bInterfaceSubClass 0x2
        bInterfaceProtocol 0x0
        iInterface 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 6
        bAlternateSetting 1
        bNumEndpoints 1
        bInterfaceClass 0x1
        bInterfaceSubClass 0x2
        bInterfaceProtocol 0x0
        iInterface 0
                *** Endpoint descriptor ***
                bLength 9
                bDescriptorType 5
                bEndpointAddress 0x8a   EP 10 IN
                bmAttributes 0x5        ISOC
                wMaxPacketSize 16
                bInterval 4
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 7
        bAlternateSetting 0
        bNumEndpoints 0
        bInterfaceClass 0x1
        bInterfaceSubClass 0x2
        bInterfaceProtocol 0x0
        iInterface 12
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 7
        bAlternateSetting 1
        bNumEndpoints 1
        bInterfaceClass 0x1
        bInterfaceSubClass 0x2
        bInterfaceProtocol 0x0
        iInterface 13
                *** Endpoint descriptor ***
                bLength 9
                bDescriptorType 5
                bEndpointAddress 0x6    EP 6 OUT
                bmAttributes 0x9        ISOC
                wMaxPacketSize 16
                bInterval 4
I (6694) modem_board: DTE reconnect, reconnecting ...

I (6699) 4g_main: Modem Board Event: USB connected
I (6704) USBH_CDC: Opened cdc device: 1
I (6707) USBH_CDC: New device connected, address: 1
I (7699) modem_board: reconnect after 5s...
I (8699) modem_board: reconnect after 4s...
I (9699) modem_board: reconnect after 3s...
I (10699) modem_board: reconnect after 2s...
I (11699) modem_board: reconnect after 1s...
I (11699) modem_board: Modem state STAGE_SYNC, Start
I (11713) modem_board: Network Auto reconnecting ...
I (11713) modem_board: Modem state STAGE_SYNC, Success!
W (11713) 4g_main: Modem Board Event: Network disconnected
I (11813) modem_board: Modem state STAGE_CHECK_SIM, Start
I (11815) modem_board: SIM Card Ready
I (11816) modem_board: Modem state STAGE_CHECK_SIM, Success!
I (11816) 4g_main: Modem Board Event: SIM Card Connected
I (11916) modem_board: Modem state STAGE_CHECK_SIGNAL, Start
I (11918) modem_board: Signal quality: rssi=31, ber=99
I (11918) modem_board: Modem state STAGE_CHECK_SIGNAL, Success!
I (12020) modem_board: Modem state STAGE_CHECK_REGIST, Start
I (12023) modem_board: Network registered, Operator: "CHN-CT"
I (12024) modem_board: Modem state STAGE_CHECK_REGIST, Success!
I (12125) modem_board: Modem state STAGE_START_PPP, Start
E (12133) esp-modem-dte: esp_dte_handle_line(79): handle line failed
E (22129) esp-modem-dte: esp_modem_dte_send_cmd(278): process command timeout
 response timeoutem_dce: esp_modem_dce_generic_command(26): Command:ATD*99***1#
I (22136) modem_board: Modem state STAGE_START_PPP, Success!
W (22137) modem_board: Modem event! 0
I (22238) modem_board: Modem state STAGE_WAIT_IP, Start
I (25682) esp-netif_lwip-ppp: Connected
I (25683) modem_board: IP event! 6
I (25683) modem_board: Modem Connected to PPP Server
I (25683) modem_board: ppp ip: 100.131.201.206, mask: 255.255.255.255, gw: 10.64.64.64
I (25690) modem_board: Main DNS: 202.102.213.68
I (25695) modem_board: Backup DNS: 61.132.163.68
I (25699) esp-modem-netif: PPP state changed event 0: (NETIF_PPP_ERRORNONE)
I (25699) modem_board: Modem state STAGE_WAIT_IP, Success!
I (25706) 4g_main: Modem Board Event: Network connected
I (25706) 4g_router_server: ssid : Can't find in NVS!
I (25721) 4g_router_server: password : Can't find in NVS!
I (25726) 4g_router_server: auth_mode : Can't find in NVS!
I (25731) 4g_router_server: channel : Can't find in NVS!
I (25736) 4g_router_server: hide_ssid : Can't find in NVS!
I (25741) 4g_router_server: bandwidth : Can't find in NVS!
I (25746) 4g_router_server: max_connection : Can't find in NVS!
I (25791) 4g_router_server: Partition size: total: 956561, used: 182477
I (25791) 4g_router_server: Starting server on port: '80'
I (25793) 4g_router_server: Registering URI handlers
I (25796) 4g_router_server: Starting webserver
I (25801) pp: pp rom version: e7ae62f
I (25804) net80211: net80211 rom version: e7ae62f
I (25809) wifi:wifi driver task: 3fcc68cc, prio:23, stack:6656, core=0
I (25823) wifi:wifi firmware version: 48ea317a7
I (25823) wifi:wifi certification version: v7.0
I (25823) wifi:config NVS flash: enabled
I (25826) wifi:config nano formatting: disabled
I (25831) wifi:Init data frame dynamic rx buffer num: 32
I (25836) wifi:Init static rx mgmt buffer num: 5
I (25840) wifi:Init management short buffer num: 32
I (25845) wifi:Init dynamic tx buffer num: 32
I (25849) wifi:Init static tx FG buffer num: 2
I (25853) wifi:Init static rx buffer size: 1600
I (25857) wifi:Init static rx buffer num: 10
I (25861) wifi:Init dynamic rx buffer num: 32
I (25866) wifi_init: accept mbox: 6
I (25868) wifi_init: tcpip mbox: 32
I (25872) wifi_init: udp mbox: 6
I (25875) wifi_init: tcp mbox: 6
I (25877) wifi_init: tcp tx win: 5760
I (25881) wifi_init: tcp rx win: 5760
I (25884) wifi_init: tcp mss: 1440
I (25887) wifi_init: WiFi IRAM OP enabled
I (25891) wifi_init: WiFi RX IRAM OP enabled
I (25895) wifi_init: LWIP IRAM OP enabled
I (25899) phy_init: phy_version 680,a6008b2,Jun  4 2024,16:41:10
I (25936) wifi:mode : softAP (f4:12:fa:cb:a9:8d)
I (25939) wifi:Total power save buffer number: 16
I (25939) wifi:Init max length of beacon: 752/752
I (25939) wifi:Init max length of beacon: 752/752
I (25943) modem_wifi: Wi-Fi AP started
I (25944) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.4.1
I (25959) wifi:Total power save buffer number: 16
I (25960) modem_wifi: softap ssid: esp_4g_router password: 12345678
I (25961) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.4.1
I (25973) modem_wifi: ap dns addr(default): 8.8.8.8
I (25978) 4g_main: changed: ap dns addr (auto): 202.102.213.68
I (25983) 4g_main: Ping addr 8.8.8.8 Restart..
I (26111) 4g_main: 64 bytes from 8.8.8.8 icmp_seq=1 ttl=54 time=123 ms

I (35988) 4g_main: Ping addr 8.8.8.8 Restart..
I (36060) 4g_main: 64 bytes from 8.8.8.8 icmp_seq=1 ttl=54 time=72 ms

换成EC200U

log

Found IN endpoint: 138
Found OUT endpoint: 7
I (6232) USBH_CDC: Opened cdc device: 1
Found IN endpoint: 132
Found OUT endpoint: 2
*** Device descriptor ***
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0x0
bDeviceSubClass 0x0
bDeviceProtocol 0x0
bMaxPacketSize0 64
idVendor 0x2c7c
idProduct 0x901
bcdDevice 3.10
iManufacturer 1
iProduct 2
iSerialNumber 3
bNumConfigurations 1
*** Configuration descriptor ***
bLength 9
bDescriptorType 2
wTotalLength 263
bNumInterfaces 9
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
bMaxPower 400mA
*** Interface Association Descriptor ***
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 0x2
bFunctionSubClass 0x6
bFunctionProtocol 0x0
iFunction 4
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 0
        bAlternateSetting 0
        bNumEndpoints 1
        bInterfaceClass 0x2
        bInterfaceSubClass 0x6
        bInterfaceProtocol 0x0
        iInterface 6
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x81   EP 1 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 16
                bInterval 32
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 1
        bAlternateSetting 0
        bNumEndpoints 0
        bInterfaceClass 0xa
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 1
        bAlternateSetting 1
        bNumEndpoints 2
        bInterfaceClass 0xa
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 5
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x82   EP 2 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x1    EP 1 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 2
        bAlternateSetting 0
        bNumEndpoints 3
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 8
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x84   EP 4 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x2    EP 2 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x83   EP 3 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 64
                bInterval 32
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 3
        bAlternateSetting 0
        bNumEndpoints 2
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 8
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x85   EP 5 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x3    EP 3 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 4
        bAlternateSetting 0
        bNumEndpoints 2
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 8
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x86   EP 6 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x4    EP 4 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 5
        bAlternateSetting 0
        bNumEndpoints 2
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 8
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x87   EP 7 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x5    EP 5 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 6
        bAlternateSetting 0
        bNumEndpoints 2
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 8
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x88   EP 8 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x6    EP 6 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 7
        bAlternateSetting 0
        bNumEndpoints 3
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 8
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x8a   EP 10 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x7    EP 7 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x89   EP 9 IN
                bmAttributes 0x3        INT
                wMaxPacketSize 64
                bInterval 32
        *** Interface descriptor ***
        bLength 9
        bDescriptorType 4
        bInterfaceNumber 8
        bAlternateSetting 0
        bNumEndpoints 2
        bInterfaceClass 0xff
        bInterfaceSubClass 0x0
        bInterfaceProtocol 0x0
        iInterface 8
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x8b   EP 11 IN
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
                *** Endpoint descriptor ***
                bLength 7
                bDescriptorType 5
                bEndpointAddress 0x8    EP 8 OUT
                bmAttributes 0x2        BULK
                wMaxPacketSize 64
                bInterval 0
I (6736) modem_board: DTE reconnect, reconnecting ...

I (6741) 4g_main: Modem Board Event: USB connected
I (6746) USBH_CDC: Opened cdc device: 1
I (6749) USBH_CDC: New device connected, address: 1
I (7741) modem_board: reconnect after 5s...
I (8741) modem_board: reconnect after 4s...
I (9741) modem_board: reconnect after 3s...
I (10741) modem_board: reconnect after 2s...
I (11741) modem_board: reconnect after 1s...
I (11741) modem_board: Modem state STAGE_SYNC, Start
I (11773) modem_board: Network Auto reconnecting ...
I (11773) modem_board: Modem state STAGE_SYNC, Success!
W (11773) 4g_main: Modem Board Event: Network disconnected
I (11873) modem_board: Modem state STAGE_CHECK_SIM, Start
I (11884) modem_board: SIM Card Ready
I (11884) modem_board: Modem state STAGE_CHECK_SIM, Success!
I (11884) 4g_main: Modem Board Event: SIM Card Connected
I (11985) modem_board: Modem state STAGE_CHECK_SIGNAL, Start
I (11997) modem_board: Signal quality: rssi=30, ber=99
I (11998) modem_board: Modem state STAGE_CHECK_SIGNAL, Success!
I (12098) modem_board: Modem state STAGE_CHECK_REGIST, Start
I (12111) modem_board: Network registered, Operator: "CHINA MOBILE"
I (12111) modem_board: Modem state STAGE_CHECK_REGIST, Success!
I (12211) modem_board: Modem state STAGE_START_PPP, Start
I (12242) modem_board: Modem state STAGE_START_PPP, Success!
W (12243) modem_board: Modem event! 0
I (12343) modem_board: Modem state STAGE_WAIT_IP, Start
I (18400) esp-netif_lwip-ppp: Connected
I (18400) modem_board: IP event! 6
I (18400) modem_board: Modem Connected to PPP Server
I (18400) modem_board: ppp ip: 10.96.61.137, mask: 255.255.255.255, gw: 192.168.0.1
I (18408) modem_board: Main DNS: 211.138.180.4
I (18412) modem_board: Backup DNS: 211.138.180.5
I (18416) esp-modem-netif: PPP state changed event 0: (NETIF_PPP_ERRORNONE)
I (18416) modem_board: Modem state STAGE_WAIT_IP, Success!
I (18423) 4g_main: Modem Board Event: Network connected
I (18423) 4g_router_server: ssid : Can't find in NVS!
I (18438) 4g_router_server: password : Can't find in NVS!
I (18443) 4g_router_server: auth_mode : Can't find in NVS!
I (18448) 4g_router_server: channel : Can't find in NVS!
I (18453) 4g_router_server: hide_ssid : Can't find in NVS!
I (18458) 4g_router_server: bandwidth : Can't find in NVS!
I (18463) 4g_router_server: max_connection : Can't find in NVS!
I (18508) 4g_router_server: Partition size: total: 956561, used: 182477
I (18508) 4g_router_server: Starting server on port: '80'
I (18510) 4g_router_server: Registering URI handlers
I (18513) 4g_router_server: Starting webserver
I (18518) pp: pp rom version: e7ae62f
I (18521) net80211: net80211 rom version: e7ae62f
I (18526) wifi:wifi driver task: 3fccf974, prio:23, stack:6656, core=0
I (18540) wifi:wifi firmware version: 48ea317a7
I (18540) wifi:wifi certification version: v7.0
I (18540) wifi:config NVS flash: enabled
I (18543) wifi:config nano formatting: disabled
I (18548) wifi:Init data frame dynamic rx buffer num: 32
I (18553) wifi:Init static rx mgmt buffer num: 5
I (18557) wifi:Init management short buffer num: 32
I (18562) wifi:Init dynamic tx buffer num: 32
I (18566) wifi:Init static tx FG buffer num: 2
I (18570) wifi:Init static rx buffer size: 1600
I (18574) wifi:Init static rx buffer num: 10
I (18578) wifi:Init dynamic rx buffer num: 32
I (18583) wifi_init: accept mbox: 6
I (18586) wifi_init: tcpip mbox: 32
I (18589) wifi_init: udp mbox: 6
I (18592) wifi_init: tcp mbox: 6
I (18595) wifi_init: tcp tx win: 5760
I (18598) wifi_init: tcp rx win: 5760
I (18601) wifi_init: tcp mss: 1440
I (18605) wifi_init: WiFi IRAM OP enabled
I (18608) wifi_init: WiFi RX IRAM OP enabled
I (18612) wifi_init: LWIP IRAM OP enabled
I (18617) phy_init: phy_version 680,a6008b2,Jun  4 2024,16:41:10
W (18657) phy_init: saving new calibration data because of checksum failure, mode(0)
I (18670) wifi:mode : softAP (f4:12:fa:cb:a9:8d)
I (18673) wifi:Total power save buffer number: 16
I (18673) wifi:Init max length of beacon: 752/752
I (18673) wifi:Init max length of beacon: 752/752
I (18677) modem_wifi: Wi-Fi AP started
I (18678) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.4.1
I (18693) wifi:Total power save buffer number: 16
I (18694) modem_wifi: softap ssid: esp_4g_router password: 12345678
I (18695) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.4.1
I (18707) modem_wifi: ap dns addr(default): 8.8.8.8
I (18726) 4g_main: rssi=30, ber=99
I (18726) 4g_main: changed: ap dns addr (auto): 211.138.180.4
I (18726) 4g_main: Ping addr 8.8.8.8 Restart..
W (20728) 4g_main: From 8.8.8.8 icmp_seq=1 timeout

I (28742) 4g_main: rssi=30, ber=99
I (28742) 4g_main: Ping addr 8.8.8.8 Restart..
I (28975) 4g_main: 64 bytes from 8.8.8.8 icmp_seq=1 ttl=52 time=232 ms

I (38756) 4g_main: rssi=30, ber=99
I (38756) 4g_main: Ping addr 8.8.8.8 Restart..
W (40756) 4g_main: From 8.8.8.8 icmp_seq=1 timeout

I (48769) 4g_main: rssi=31, ber=99
I (48769) 4g_main: Ping addr 8.8.8.8 Restart..
I (48970) 4g_main: 64 bytes from 8.8.8.8 icmp_seq=1 ttl=52 time=200 ms

同样是上面的代码,修改的地方


请问EC800E,怎么修改

1 个赞

EC800K 我应该是设置对了,cdc端口为0
但是他连接ESP32后提示MPS超过了408,这个提示在ESP32S4 ECM的示例中也有

I (5845) esp-modem: ----------------------------------------------------
I (5851) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (5860) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
Found NOTIF endpoint: 136
Found IN endpoint: 129
Found OUT endpoint: 10
I (6251) USBH_CDC: Opened cdc device: 1
Found NOTIF endpoint: 135
Found IN endpoint: 131
Found OUT endpoint: 12
E (6256) HCD DWC: EP MPS (512) exceeds supported limit (408)
E (6261) USBH: EP Alloc error: ESP_ERR_NOT_SUPPORTED
E (6266) USB HOST: EP allocation error ESP_ERR_NOT_SUPPORTED
E (6271) USB HOST: Claiming interface error: ESP_ERR_NOT_SUPPORTED
E (6277) USBH_CDC: _cdc_start(652): Could not claim interface
E (6282) USBH_CDC: _cdc_open(777):
E (6286) USBH_CDC: Failed to open cdc device: 1
I (6290) USBH_CDC: New device connected, address: 1

还想问一下 EC200U的0x02 0x07这些值的来源?
通过USB描述信息能看出来吗?
知其然知其所以然

EC800E的AT口是intf 3 ; intf 4 是modem 口。
image

→ 这里改成0x03 和 0x04.

接口顺序在移远的驱动移植文档里有介绍。

天猫fae说EC800E没有USB描述符,又让买的EC801

一般只要了解一个接口顺序和对应的功能即可,这个USB接口描述符的详细说明除非要做非常底层的USB通信开发才需要。
天猫客户推荐EC801E主要是由于目前主要维护的是EC801E, 方便后续升级。

image
image
image
image
改成0x03 和 0x04也不可以呢!请问是什么原因呢

重新发下完整的日志。看日志是AT不通。
最好抓个usbtreeview看下USB接口顺序,或者接到Linux上,cat /sys/kernel/debug/usb/devices 看看。

EC800E.txt (24.6 KB)

usbtreeview.txt (9.3 KB)

接口还是应该是0x03 和0x04.

试过了还是不行呢,什么原因呢,EC800E-CN

不是论坛上能解决的啦。