Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp32s2 USB CDC not working (without tinyusb) (IDFGH-14212) #15009

Open
3 tasks done
jjoakim opened this issue Dec 10, 2024 · 2 comments
Open
3 tasks done

esp32s2 USB CDC not working (without tinyusb) (IDFGH-14212) #15009

jjoakim opened this issue Dec 10, 2024 · 2 comments
Labels
Status: Opened Issue is new

Comments

@jjoakim
Copy link

jjoakim commented Dec 10, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

I tried to make a new project using a esp32s2. I enabled USB CDC but it is not working. In my old project from two years ago, as far as I remember, this was working without problems.

  • I copied the hello word example.
  • Configured it for esp32s2.
  • Since my esp32s2 only uses usb for console output I went ahead and enabled in menuconfig:
    (Top) → Component config → ESP System Settings → Channel for console output → USB CDC

When I reboot the device it's no longer available to the system and thus I cannon use idf.py monitor.

dmesg output gives me the following recurring messages.

[32198.950492] usb 3-3: new full-speed USB device number 30 using xhci_hcd
[32210.279669] usb 3-3: Device not responding to setup address.
[32210.482356] usb 3-3: Device not responding to setup address.
[32210.690001] usb 3-3: device not accepting address 30, error -71
[32210.690042] usb 3-3: WARN: invalid context state for evaluate context command.
[32210.690083] usb usb3-port3: attempt power cycle
[32211.070353] usb 3-3: new full-speed USB device number 31 using xhci_hcd
[32216.498284] xhci_hcd 0000:0c:00.3: Timeout while waiting for setup device command
[32216.705943] usb 3-3: Device not responding to setup address.
[32216.914262] usb 3-3: device not accepting address 31, error -71

I found a workaround for this problem by adding tinyusb to the project.

  • idf.py add-dependency esp_tinyusb

I want to preserve as much battery power as possible so I am also curious if enabling tinyusb effects power consumption.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 10, 2024
@github-actions github-actions bot changed the title esp32s2 USB CDC not working (without tinyusb) esp32s2 USB CDC not working (without tinyusb) (IDFGH-14212) Dec 10, 2024
@nopnop2002
Copy link

nopnop2002 commented Dec 11, 2024

If you are using this, you can enable /dev/ttyACM0 by following the steps below.
esp32-s2-mini-1

Since it uses the chip's USB-OTG function, it will not be recognized as a USB device even if you simply connect it to the host with a USB cable.
To write firmware, press ButtonRST while pressing Button0, then release ButtonRST and then Button0.
Now the device will enter DFU mode, the USB device (/dev/ttyACM0) will appear, and you can upload the firmware.
Once the firmware upload is complete, press ButtonRST again.
The firmware will now start.
If you press ButtonRST without pressing Button0, the USB device will disappear.

To use STDOUT, you need to change Channel for console output to USB CDC in menuconfig.
esp32-s2-mini-4

After changing Channel for console output to USB CDC in menuconfig, upload the firmware again.
Once the firmware has been uploaded, the following display will appear.
esp32-s2-mini-5

Now press ButtonRST.
The firmware with USB CDC enabled will now start running.
From now on, you will be able to write and monitor the firmware without pressing Button0 or ButtonRST.

esp32-s2-mini-7

This board has 4MB of FLASH and 2MB of PSRAM.
ESP32S2's RAM is very small.
You can avoid running out of memory by enabling PSRAM.
esp32-s2-mini-6

@jjoakim
Copy link
Author

jjoakim commented Dec 11, 2024

I did indeed follow this exact procedure and I can only reach as far as this point.

The firmware with USB CDC enabled will now start running.
From now on, you will be able to write and monitor the firmware without pressing Button0 or ButtonRST.

Since the system cannot recognize it as a proper usb device, as seen from the output of the dmesg command in my initial post, idf.py monitor will never work nor will flashing the device without entering DFU mode.

My device is similar to a Espressif ESP32-Saola-1 and I know USB CDC used to work previously with a version 4 of the sdk from a couple of years ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

3 participants