Skip to content

[BUG] ESP32C3 BLE shuts CDC down (and kills USB until next power cycle)  #6374

Closed
@0x0fe

Description

@0x0fe

Board

ESP32-C3 dev module

Device Description

ESP32C3 Dev module

Hardware Configuration

no

Version

latest master

IDE Name

arduino IDE

Operating System

windows 10

Flash frequency

80M

PSRAM enabled

no

Upload speed

CDC

Description

As soon as the BLE is initialized, the CDC port is shut down, and it cannot be revived by CDC reset (aka opening and closing the serial monitor), in fact to revive USB the esp32c3 has to be power cycled and booted with GPIO9 to force bootlader then reprogrammed with a working firmware.
The windows descriptor error, and CDC parameters errors after flashing a firmware with BLE enable lead me to think the CDC state machine and/or the whole USB stack is not served anymore after the BLE is initialized.

I tested on two different designs to make sure the problem was not hardware related, also i used a fresh download of the master branch from few hours ago (with wifi CDC fix).

Sketch

#include "BLEDevice.h"

uint32_t chipId = 0;

void setup() {

  //BLEDevice::init("");// tried to init here, same issue
  
  Serial.begin(115200);
  while(!Serial)delay(10);
  Serial.println("\nSystem ready\n");
  for(int i=0;i<17;i=i+8){chipId|=((ESP.getEfuseMac()>>(40-i))&0xff)<<i;}
   
  BLEDevice::init("");
}

void loop() {
  
  Serial.printf("id:%d\n",chipId);
  delay(3000);
}

Debug Message

when we try to open serial console after programming we got nothing shown, if we unplug and replug USB then try to open the serial console we get "port parameters definition error" from the CDC (since it doesnt reply to the host). We also get error message from windows most of time since the USB is no longer recognized.

Other Steps to Reproduce

just flash the firmware as is, it shoudl reproduce the issue right away, after testing comment BLEDevice::init(""); and power cycle with GPIO9 to GND then flash, the USB CDC will then behave normally and the esp32c3 can be reflashed without unpluging USB or forcing bootloader.

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

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions