tobozo / ESP32-USB-Soft-Host

An Arduino wrapper to @sdima1357's usb_soft_host esp-idf example
GNU Affero General Public License v3.0
265 stars 42 forks source link

ESP32-CAM Does not detect any USB device being attached #15

Closed ugurbor closed 1 year ago

ugurbor commented 2 years ago

I couldn't get "New device detected on USB" at all. I have an ESP32-CAM. Here's the pinout: https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2020/03/ESP32-CAM-pinout-new.png?quality=100&strip=all&ssl=1

I have tried with multiple PIN configurations and only for DP_P0 and DM_P0 which I believe means Data Plus USB0 and Data Minus USB0. Last one I tried is 13 and 12.

I had a USB extension cable and removed data pins (green and white) coming from female (host) part and connected to GPIO pins of the board. Power cables (red and black) is connected normally so I can power the device via a USB port.

What am I doing wrong? Do I need to share the power or at least ground between them or something?

tobozo commented 2 years ago

hey thanks for your feedback :+1:

yes sharing GND is recommended.

however It probably won't work given the nature of the product, most pins are shared with the camera, and you need unshared pins to get it working.

ugurbor commented 2 years ago

I have tried with common 5v and GND and still doesn't work.

I have used this pinout guide to determine which pins to use: https://github.com/raphaelbs/esp32-cam-ai-thinker/blob/master/docs/esp32cam-pin-notes.md

Used 1-bit mode and 12-13, used 15-16 etc but nothing worked. It "should" work since all needed is simple GPIO pins but maybe I am missing something.

tobozo commented 2 years ago

All those pins are already shared with the SD or the Camera (some have pullups), so it's probably never going to work.

It doesn't mean your effort was useless though, the espcam is a neat product and it was worth a try.

Now your best shot is either to go with an ESP32-Wrover and use its extra pins or go with an ESP32-S2 and use its native USB support.

image

ugurbor commented 2 years ago

So PINs being shared or having "pull ups" (I am really a noob here) won't work? Maybe I can try to get unexposed PINs directly from ESP32 module. I may just buy a Lolin32 clone for this but I really don't need one more tiny computer.

tobozo commented 2 years ago

The esp32cam schema shows that all pins are already assigned indeed, but please don't purchase anything on the assumption that ESP32-USB-Soft-Host library will work.

This library only exists to provide a proof of concept and a playground, but is not suitable in real life projects.

If you're on to buy a new toy to support the pinout for camera+sd+usb, I'd recommend choosing an ESP32-S2 instead e.g. this one has modular pinout setup, psram, and many pins available for the parallel camera.

pros/cons: ESP32-S2 has a single cpu core and can't do BLE but the SPI is much faster, and you get native USB support along with esp32-arduino-core official library.

ugurbor commented 2 years ago

I actually bought ESP32-CAM for toying with it for another project. But now my idea is to build a BLE HID Relay and this was what I have in hand. So ESP32-S2 is not suitable for my current idea but something like Lolin32 Lite or WeMoS with Battery holder would be awesome since they both have many unused GPIO pins and battery support if BLE HID Relay can become something usable. Thanks for the help though! If you want you can close the issue and I can write later if I got it working somehow with ESP32-CAM.