esp-arduino-libs / ESP32_USB_Stream

Arduino library of driving USB stream for the ESP32-S2 and ESP32-S3
Apache License 2.0
34 stars 3 forks source link

Runtime Error - "HCD DWC: EP MPS (192) exceeds supported limit (128)" #4

Open BoltSwith opened 4 hours ago

BoltSwith commented 4 hours ago

Greetings,

I successfully compiled and run the library base on the given example - Getting started with a UAC . I'm trying to test Streaming of Audio data to my USB loud Speaker.

The program successfully detects the USB Speaker when I plug it to the USB interface of my Esp32s3 board and carry out necessary initializations, however the program gives the following runtime error:

I (754) app_init: App version: v1.1.0 I (758) app_init: Compile time: Sep 28 2024 08:56:55 I (764) app_init: ELF file SHA256: 9169c317e... I (770) app_init: ESP-IDF: v5.3.1 I (775) efuse_init: Min chip rev: v0.0 I (779) efuse_init: Max chip rev: v0.99 I (784) efuse_init: Chip rev: v0.2 I (789) heap_init: Initializing. RAM available for dynamic allocation: I (796) heap_init: At 3FC97EC8 len 00051848 (326 KiB): RAM I (802) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM I (809) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM I (815) heap_init: At 600FE100 len 00001EE8 (7 KiB): RTCRAM I (821) esp_psram: Adding pool of 8192K of PSRAM memory to heap allocator I (829) spi_flash: detected chip: gd I (833) spi_flash: flash io: qio I (837) sleep: Configure to isolate all GPIO pins in sleep state I (843) sleep: Enable automatic switching of GPIO sleep configuration I (850) coexist: coex firmware version: 4482466 I (871) coexist: coexist rom version e7ae62f I (872) main_task: Started on CPU0 I (873) esp_psram: Reserving pool of 32K of internal memory for DMA I (887) USB_STREAM: UAC Streaming Config Succeed, Version: 1.4.0 I (888) USB_STREAM: Pre-alloc ctrl urb succeed, size = 1024 I (890) USB_STREAM: USB stream task start I (920) USB_STREAM: USB Streaming Start Succeed I (920) USB_STREAM: Waiting USB Device Connection W (1920) USB_STREAM: Waiting Device Connection, timeout I (1920) USB_STREAM: Waiting USB Device Connection W (2920) USB_STREAM: Waiting Device Connection, timeout E (1920) arduino-usb: connectWait(154): USB streaming wait fail, Error Code: 263 I (7803) USB_STREAM: line 151 HCD_PORT_EVENT_CONNECTION I (7803) USB_STREAM: Action: ACTION_DEVICE_CONNECT I (7853) USB_STREAM: Resetting Port E (7913) USB_STREAM: Port Reset failed, retry = 3 W (8013) USB_STREAM: line 155 HCD_PORT_EVENT_DISCONNECTION I (8013) USB_STREAM: Recover Stream Task I (8095) USB_STREAM: Action: ACTION_PIPE_DFLT_DISABLE I (8095) USB_STREAM: Action: ACTION_PORT_RECOVER I (8095) USB_STREAM: Action: ACTION_DEVICE_DISCONN I (8100) USB_STREAM: Waiting USB Connection I (8355) USB_STREAM: line 151 HCD_PORT_EVENT_CONNECTION I (8355) USB_STREAM: Action: ACTION_DEVICE_CONNECT I (8405) USB_STREAM: Resetting Port I (8465) USB_STREAM: Setting Port FIFO, 0 I (8465) USB_STREAM: USB Speed: full-speed I (8465) USB_STREAM: ENUM Stage START, Succeed I (8470) USB_STREAM: ENUM Stage GET_SHORT_DEV_DESC, Succeed I (8476) USB_STREAM: Default pipe endpoint MPS update to 64 I (8481) USB_STREAM: ENUM Stage CHECK_SHORT_DEV_DESC, Succeed I (8489) USB_STREAM: ENUM Stage SET_ADDR, Succeed I (8504) USB_STREAM: ENUM Stage CHECK_ADDR, Succeed I (8505) USB_STREAM: ENUM Stage GET_FULL_DEV_DESC, Succeed Device descriptor bcdUSB 1.10 bDeviceClass 0x0 bDeviceSubClass 0x0 bDeviceProtocol 0x0 bMaxPacketSize0 64 idVendor 0x4c4a idProduct 0x4155 bNumConfigurations 1 I (8520) USB_STREAM: ENUM Stage CHECK_FULL_DEV_DESC, Succeed I (8527) USB_STREAM: ENUM Stage GET_SHORT_CONFIG_DESC, Succeed I (8534) USB_STREAM: ENUM Stage CHECK_SHORT_CONFIG_DESC, Succeed I (8541) USB_STREAM: ENUM Stage GET_FULL_CONFIG_DESC, Succeed Configuration descriptor wTotalLength 135 bNumInterfaces 3 bConfigurationValue 1 Interface descriptor bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 0x1 (Audio) bInterfaceSubClass 0x1 Audio control header descriptor bcdADC 0x100 wTotalLength 40 bInCollection 1 Interface number[0] = 1 Audio control input terminal descriptor bTerminalID 1 wTerminalType 0x101 bAssocTerminal 0 bNrChannels 2 wChannelConfig 0x0003 Audio control feature unit descriptor bUnitID 2 bSourceID 1 bControlSize 1 bmaControls[ch0] 0x1 bmaControls[ch1] 0x2 bmaControls[ch2] 0x2 Audio control output terminal descriptor bTerminalID 3 wTerminalType 0x301 bAssocTerminal 0 Interface descriptor bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 0x1 (Audio) bInterfaceSubClass 0x2 Interface descriptor bInterfaceNumber 1 bAlternateSetting 1 bNumEndpoints 1 bInterfaceClass 0x1 (Audio) bInterfaceSubClass 0x2 Audio stream general descriptor bTerminalLink 1 bDelay 1 wFormatTag 1 Audio control header descriptor bFormatType 1 bNrChannels 2 bSubframeSize 2 bBitResolution 16 bSamFreqType 1 tSamFreq[0] 48000 Endpoint descriptor bEndpointAddress 0x3 EP 3 OUT bmAttributes 0x9 ISOC wMaxPacketSize 196 bInterval 1 Interface descriptor bInterfaceNumber 2 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 0x3 (Unknown) bInterfaceSubClass 0x0 Endpoint descriptor bEndpointAddress 0x82 EP 2 IN bmAttributes 0x3 INT wMaxPacketSize 8 bInterval 10 I (8694) USB_STREAM: Audio control interface = 0 I (8699) USB_STREAM: Speaker feature unit = 2 I (8704) USB_STREAM: Support volume control, ch = 6 I (8710) USB_STREAM: Support mute control, ch = 1 I (8715) USB_STREAM: Speaker Interface found, interface = 1 I (8722) USB_STREAM: Endpoint(ISOC) Addr = 0x3, MPS = 196 I (8728) USB_STREAM: Speaker frequency control Not Support I (8734) USB_STREAM: ENUM Stage CHECK_FULL_CONFIG_DESC, Succeed I (8742) USB_STREAM: ENUM Stage SET_CONFIG, Succeed E (8747) HCD DWC: EP MPS (192) exceeds supported limit (128) E (8752) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_host_helpers.c:306 (_usb_pipe_init):pipe alloc failed E (8764) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_stream.c:2737 (_usb_stream_handle_task):pipe init failed I (8776) USB_STREAM: usb stream task wait reset W (9781) USB_STREAM: usb stream task recover, reason: stream error I (9781) USB_STREAM: Resetting SPK pipe I (9781) USB_STREAM: Set Device Interface = 1, Alt = 0 E (9792) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_host_helpers.c:355 (_usb_pipe_deinit):invalid args E (9799) HCD DWC: EP MPS (192) exceeds supported limit (128) E (9805) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_host_helpers.c:306 (_usb_pipe_init):pipe alloc failed E (9816) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_stream.c:2737 (_usb_stream_handle_task):pipe init failed I (9828) USB_STREAM: usb stream task wait reset W (10834) USB_STREAM: usb stream task recover, reason: stream error I (10834) USB_STREAM: Resetting SPK pipe I (10835) USB_STREAM: Set Device Interface = 1, Alt = 0 E (10848) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_host_helpers.c:355 (_usb_pipe_deinit):invalid args E (10852) HCD DWC: EP MPS (192) exceeds supported limit (128) E (10858) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_host_helpers.c:306 (_usb_pipe_init):pipe alloc failed E (10870) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_stream.c:2737 (_usb_stream_handle_task):pipe init failed I (10882) USB_STREAM: usb stream task wait reset W (11887) USB_STREAM: usb stream task recover, reason: stream error I (11887) USB_STREAM: Resetting SPK pipe I (11888) USB_STREAM: Set Device Interface = 1, Alt = 0 E (11894) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_host_helpers.c:355 (_usb_pipe_deinit):invalid args E (11905) HCD DWC: EP MPS (192) exceeds supported limit (128) E (11911) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_host_helpers.c:306 (_usb_pipe_init):pipe alloc failed E (11923) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_stream.c:2737 (_usb_stream_handle_task):pipe init failed I (11935) USB_STREAM: usb stream task wait reset W (12940) USB_STREAM: usb stream task recover, reason: stream error I (12940) USB_STREAM: Resetting SPK pipe I (12941) USB_STREAM: Set Device Interface = 1, Alt = 0 E (12950) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_host_helpers.c:355 (_usb_pipe_deinit):invalid args E (12958) HCD DWC: EP MPS (192) exceeds supported limit (128) E (12964) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_host_helpers.c:306 (_usb_pipe_init):pipe alloc failed E (12976) USB_STREAM: ./components/ESP32_USB_Stream/src/original/usb_stream.c:2737 (_usb_stream_handle_task):pipe init failed I (12988) USB_STREAM: usb stream task wait reset

BoltSwith commented 4 hours ago

I suspect the cause of the error the prevents streaming maybe as state in the error log:

Find below the test program I used:


#include <Arduino.h>
#include "USB_STREAM.h"

uint16_t speakerBuffer[1024] = {0};

/* Define the Mic frame callback function implementation */
static void onMicFrameCallback(mic_frame_t *frame, void *ptr)
{
    // We should using higher baudrate here, to reduce the blocking time here
    Serial.printf("mic callback! bit_resolution = %u, samples_frequence = %"PRIu32", data_bytes = %"PRIu32"\n", frame->bit_resolution, frame->samples_frequence, frame->data_bytes);
}

 extern "C" void app_main(){
    Serial.begin(115200);
    // Instantiate a Ustream object
    USB_STREAM *usb = new USB_STREAM();

    // Config the parameter
    usb->uacConfiguration(UAC_CH_ANY, UAC_BITS_ANY, UAC_FREQUENCY_ANY, 6400, UAC_CH_ANY, UAC_BITS_ANY, UAC_FREQUENCY_ANY, 6400);

    //Register the camera frame callback function
    usb->uacMicRegisterCb(&onMicFrameCallback, NULL);

    usb->start();

    usb->connectWait(1000);
    delay(5000);

    // usb->uacMicMute((void *)0);
    // delay(5000);

    // usb->uacMicVolume((void *)60);

    // usb->uacMicSuspend(NULL);
    // delay(5000);

    // usb->uacMicResume(NULL);

while(1){
  //usb->uacWriteSpk(speakerBuffer, 800, 100);
  delay(500);
}

}

NB:

What could be the cause of the error(s)