usb_cdc_4g_module进入低功耗模式,唤醒后,连接不了网络

Moderator: ESP_Bob

linshc
Posts: 59
Joined: Mon Feb 21, 2022 2:06 am

usb_cdc_4g_module进入低功耗模式,唤醒后,连接不了网络

Postby linshc » Mon May 16, 2022 1:45 pm

描述:我使用ESP32s2+EC600N_CNLA_N05模块进行联网。在我的应用中,需要每5分钟向网络上报一次数据,其他时间在休眠状态。我使用light_sleep模式,并在进入该模式之前,将wifi主动关闭,并让4G模组处于PPP模式,经过一段时间后,再次唤醒,打开wifi,联网上报数据。在测试过程中,将通过定时器唤醒更改为gpio引脚唤醒,并通过一个按键控制。
问题1:在唤醒后,Pipe报了这个错误:W (53056) USB_HCDC: line 1030 Pipe: bulk_out HCD_PIPE_EVENT_ERROR_XFER。之后再进行联网,一直连接不上。
问题2:在进入休眠时,需要对USB进行什么操作吗?

代码:

Code: Select all

#ifdef CONFIG_DUMP_SYSTEM_STATUS
    /* Configure the button GPIO as input, enable wakeup */
    const int button_gpio_num = 0;
    const int button_enter_low_power_gpio_num = 41;
    const int wakeup_level = 0;
    gpio_config_t config = {
            .pin_bit_mask = BIT64(button_gpio_num)|BIT64(button_enter_low_power_gpio_num),
            .mode = GPIO_MODE_INPUT
    };
    ESP_ERROR_CHECK(gpio_config(&config));
    gpio_wakeup_enable(button_gpio_num, wakeup_level == 0 ? GPIO_INTR_LOW_LEVEL : GPIO_INTR_HIGH_LEVEL);

    while (1) {
        //_system_dump();
        esp_sleep_enable_gpio_wakeup();
        if(gpio_get_level(button_enter_low_power_gpio_num) == 1){
            ESP_LOGI(TAG, "Waiting for GPIO%d to go high...", button_enter_low_power_gpio_num);
            do{
                vTaskDelay(pdMS_TO_TICKS(10));
            }while(gpio_get_level(button_enter_low_power_gpio_num) == 1);
        }

        ESP_LOGW(TAG, "Entering light sleep");
        esp_wifi_stop();
        /* To make sure the complete line is printed before entering sleep mode,
         * need to wait until UART TX FIFO is empty:
         */
        uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
        /* Enter sleep mode */
        esp_light_sleep_start();
        /* Determine wake up reason */
        const char* wakeup_reason;
        switch (esp_sleep_get_wakeup_cause()) {
            case ESP_SLEEP_WAKEUP_TIMER:
                wakeup_reason = "timer";
                break;
            case ESP_SLEEP_WAKEUP_GPIO:
                wakeup_reason = "pin";
                break;
            default:
                wakeup_reason = "other";
                break;
        }
        esp_wifi_start();
        ESP_LOGI(TAG, "Returned from light sleep, reason: %s", wakeup_reason);
    }
#endif
进入低功耗模式

Code: Select all

I (11715) modem_wifi: softap ssid: esp_4g_router password: 12345678
I (11722) modem_wifi: NAT is enabled
I (11726) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (11735) gpio: GPIO[41]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (11745) main: Waiting for GPIO41 to go high...
W (16660) main: Entering light sleep
W (16660) wifi:age timer already deinit
W (16660) modem_wifi: ESP WIFI STOP
I (16661) wifi:flush txq
I (16663) wifi:stop sw txq
I (16665) wifi:lmac stop hw txq
退出低功耗模式

Code: Select all

[color=#FFFF80]W (17684) USB_HCDC: line 1030 Pipe: bulk_out HCD_PIPE_EVENT_ERROR_XFER[/color]
I (24190) wifi:mode : softAP (7c:df:a1:4f:29:79)
I (24192) wifi:Total power save buffer number: 16
W (24196) modem_wifi: ESP WIFI START
I (24199) main: Returned from light sleep, reason: pin
I (24205) main: Waiting for GPIO41 to go high...

ESP_Bob
Posts: 80
Joined: Fri Nov 27, 2020 12:52 pm

Re: usb_cdc_4g_module进入低功耗模式,唤醒后,连接不了网络

Postby ESP_Bob » Wed May 25, 2022 2:08 am

USB Host 低功耗模式还未适配,出现这种情况是意料之中的,

ESP32S3 进入休眠之前,USB Host 协议栈需要向 4G 模块发休眠信号,

需求已经反馈,后续计划将在该问题下同步

Who is online

Users browsing this forum: No registered users and 7 guests