Skip to content

ESP32S3 Interface dual CDC not working #10936

@yunyizhi

Description

@yunyizhi

Board

ESP32S3 DeV Module

Device Description

esp32s3 DevKitc N16R8

Hardware Configuration

just board
Image

Version

3.1.1

IDE Name

Arduino IDE

Operating System

Win11

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

921600

Description

I found in the library file USBCDC.cpp that it supports a maximum of two CDC instances, but in reality, only one can be initialized.

Sketch

#include <Arduino.h>
#include "USB.h"
USBCDC cdc0(0);
USBCDC cdc1(1);

void setup()
{
    Serial.begin(115200);
    log_i("init uart");
    cdc0.begin(115200);
    log_i("init cdc0");
    cdc1.begin(115200);
    log_i("init cdc1");
    USB.begin();
    // write your initialization code here
}

void loop()
{
    cdc0.println("Hello World cdc0 ");
    cdc1.println("Hello World cdc1");
    Serial.println("Hello World uart ");
    delay(1000);
}

Debug Message

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x28 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2820,len:0x1188
load:0x403c8700,len:0x4
load:0x403c8704,len:0xbf0
load:0x403cb700,len:0x30e4
entry 0x403c88ac
[     1][D][esp32-hal-tinyusb.c:807] tinyusb_enable_interface2(): Interface CDC enabled
[     9][E][esp32-hal-tinyusb.c:788] tinyusb_enable_interface2(): Interface CDC invalid or already enabled
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32-S3
  Package           : 0
  Revision          : 0.02
  Cores             : 2
  CPU Frequency     : 240 MHz
  XTAL Frequency    : 40 MHz
  Features Bitfield : 0x00000012
  Embedded Flash    : No
  Embedded PSRAM    : No
  2.4GHz WiFi       : Yes
  Classic BT        : No
  BT Low Energy     : Yes
  IEEE 802.15.4     : No
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   372244 B ( 363.5 KB)
  Free Bytes        :   332292 B ( 324.5 KB)
  Allocated Bytes   :    34728 B (  33.9 KB)
  Minimum Free Bytes:   327564 B ( 319.9 KB)
  Largest Free Block:   262132 B ( 256.0 KB)
------------------------------------------
Flash Info:
------------------------------------------
  Chip Size         : 16777216 B (16 MB)
  Block Size        :    65536 B (  64.0 KB)
  Sector Size       :     4096 B (   4.0 KB)
  Page Size         :      256 B (   0.2 KB)
  Bus Speed         : 80 MHz
  Bus Mode          : QIO
------------------------------------------
Partitions Info:
------------------------------------------
                nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
            otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
               app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
               app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
             spiffs : addr: 0x00290000, size:  1408.0 KB, type: DATA, subtype: SPIFFS
           coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
  Compile Date/Time : Feb  5 2025 18:08:27
  Compile Host OS   : windows
  ESP-IDF Version   : v5.3.2-282-gcfea4f7c98-dirty
  Arduino Version   : 3.1.1
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : ESP32S3_DEV
  Arduino Variant   : esp32s3
  Arduino FQBN      : esp32:esp32:esp32s3:UploadSpeed=921600,USBMode=default,CDCOnBoot=default,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,CPUFreq=240,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=debug,PSRAM=disabled,LoopCore=1,EventsCore=1,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default
============ Before Setup End ============
[   369][I][sketch_dec24a.ino:9] setup(): init uart
[   374][I][sketch_dec24a.ino:11] setup(): init cdc0
[   379][I][sketch_dec24a.ino:13] setup(): init cdc1
[   384][D][esp32-hal-tinyusb.c:685] tinyusb_load_enabled_interfaces(): Load Done: if_num: 2, descr_len: 75, if_mask: 0x10
=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   372244 B ( 363.5 KB)
  Free Bytes        :   324264 B ( 316.7 KB)
  Allocated Bytes   :    42292 B (  41.3 KB)
  Minimum Free Bytes:   324264 B ( 316.7 KB)
  Largest Free Block:   262132 B ( 256.0 KB)
------------------------------------------
GPIO Info:
------------------------------------------
  GPIO : BUS_TYPE[bus/unit][chan]
  --------------------------------------  
    43 : UART_TX[0]
    44 : UART_RX[0]
============ After Setup End =============
Hello World uart 
Hello World uart

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Labels

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions