cherry-embedded / CherryUSB

CherryUSB is a tiny, beautiful and portable USB host and device stack for embedded system with USB IP
https://cherryusb.cherry-embedded.org
Apache License 2.0
1.24k stars 264 forks source link

Can't run in ESP32-S3 V0.2 #197

Closed bhxxwx closed 5 months ago

bhxxwx commented 5 months ago

Hi, I transplanted the program to the ESP32-S3 chip, and an error occurred when running: [E/USB] This dwc2 version does not support dma, so stop working Above this message, I found that the information of dwc2 hcd could not be obtained normally, output below:

[I/USB] ========== dwc2 hcd params ==========
[I/USB] CID:00000000
[I/USB] GSNPSID:00000000
[I/USB] GHWCFG1:00000000
[I/USB] GHWCFG2:00000000
[I/USB] GHWCFG3:00000000
[I/USB] GHWCFG4:00000000
[I/USB] dwc2 has 1 channels

My esp32-S3 chip version is V0.2, build in ESP-IDF V5.2.1 I'm wondering if the ESP changes the address of the USB peripheral? In this program: #define USB_BASE 0x60080000

sakumisu commented 5 months ago

Your usb low level init is incorrect, thanks.

sakumisu commented 5 months ago

Do you think all of usb registers are all zero? No.

sakumisu commented 5 months ago

Refer to https://github.com/CherryUSB/cherryusb_esp32/tree/latest

bhxxwx commented 5 months ago

Thank you for your reminder. The usb_glue_esp.c file is missing from the component I downloaded. Now the program can recognize the USB insertion, but fails to obtain the descriptor, prompting -116 which is TimeOut, how can i fix this? thank you very much again.

[I/USB] cherryusb, version: 0x001001
[I/USB] ========== dwc2 hcd params ==========
[I/USB] CID:00000000
[I/USB] GSNPSID:4f54400a
[I/USB] GHWCFG1:00000000
[I/USB] GHWCFG2:224dd930
[I/USB] GHWCFG3:00c804b5
[I/USB] GHWCFG4:d3f0a030
[I/USB] dwc2 has 8 channels
[I/USB] New full-speed device on Hub 1, Port 1 connected
[E/USB] Failed to get device descriptor,errorcode:-116
[E/USB] Port 1 enumerate fail
sakumisu commented 5 months ago

I have said, use my demo repo, thanks.

sakumisu commented 5 months ago

-116 is very normal because of incorrect dwc2 config.

sakumisu commented 5 months ago

If you do not use my demo repo, do not reply for this.

bhxxwx commented 5 months ago

ok, thanks again

sakumisu commented 5 months ago

Default dwc2 config need 4K fifo, but esp32 only has 1K, so it cannot work.Do not use old version.