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

Update README.md #7

Open
pwqw opened this issue Apr 19, 2023 · 2 comments
Open

Update README.md #7

pwqw opened this issue Apr 19, 2023 · 2 comments

Comments

@pwqw
Copy link

pwqw commented Apr 19, 2023

I assume USB/IP is more advanced topic, not for beginners, so it requires at least basic knowledge about esp-idf and using esp32-S2/3 with USB. As i am no longer using windows (at least not for development) there is basic info as a reminder how to use usbip on linux.
Here you can find few links, but uncle google can help you more:
https://usbip.sourceforge.net/
https://docs.kernel.org/usb/usbip_protocol.html
https://github.com/torvalds/linux/tree/master/drivers/usb/usbip

Originally posted by @chegewara in #6 (comment)

Ok, so for example the readme should state:

  1. It is a project tested on Linux.
  2. Requires prior knowledge of usbip

(ok, so far this is a bit obvious. In addition, it is already in the readme, clarified.)

  • How to compile it? (basic command)
  • How to install it on esp32? (basic command)
  • In what versions of boards was it tested?
  • How to simply plug a keyboard into the board? (a basic usage example, drawn outline)
@gitOtonaut
Copy link

Hi,
all this points mentioned for adding to readme are vital,
i started building and 1st issue was patching #include "usb/usb_host.h" which i took from esp-idf repository.
Finally i was not able to compile without build errors.

I'd like to experiment transmitting usb over wifi from astronomy gear to astrophotgraphy computer,
it would be extraordinary if you could provide more details to build and installation process,
even i know how to build and flash via terminal, IDE or VSCode for beginners it would be great support.

cheers,

@pwqw
Copy link
Author

pwqw commented Sep 13, 2024

(Here a proposal)

ESP32 USB/IP PoC Documentation: Connecting USB Devices to an ESP32 or Arduino

Overview

This document provides a detailed explanation of how to connect USB devices (e.g., a keyboard, mouse, or USB drive) to an ESP32 or Arduino using the esp32-usbip-poc project. The goal is to enable access to these USB devices over a network using the USB/IP protocol. It also explains hardware requirements, such as using a USB-to-UART adapter, and alternatives for directly connecting USB devices.

ESP32/Arduino USB Capabilities

The ESP32 and Arduino boards, by default, do not include a native USB Host controller. The USB port available on these boards, often a USB B micro or USB B standard port, serves two main purposes:

  1. Powering the board: This port provides the necessary power to the microcontroller.
  2. Serial communication: It is used to communicate with a computer, allowing the transfer of code from an IDE (like Arduino IDE or PlatformIO) and enabling serial debugging. This port functions as a USB Device (client), meaning the board can only receive commands but cannot control other USB devices directly.

Hardware Requirements for USB Communication

To connect a USB device to an ESP32 or Arduino, you typically need a USB-to-UART adapter. This adapter acts as a bridge between the USB device (which uses the USB protocol) and the ESP32 (which communicates over UART serial protocol).

USB-to-UART Adapter Use Case:
  • USB Devices (e.g., keyboard, mouse) use the USB protocol.
  • ESP32/Arduino uses UART serial communication.
  • A USB-to-UART adapter converts the signals from the USB device to UART signals that the ESP32 or Arduino can process.
Example Connections:
  1. TX (Transmit) from the adapter goes to RX (Receive) on the ESP32.
  2. RX (Receive) from the adapter goes to TX (Transmit) on the ESP32.
  3. GND (Ground) from the adapter connects to GND on the ESP32.

Alternative Options Without a USB-to-UART Adapter

If you want to avoid using a USB-to-UART adapter, there are alternative approaches, though they come with some limitations or require specific hardware:

  1. Using ESP32-S2 or ESP32-S3:

    • The ESP32-S2 and ESP32-S3 chips come with built-in USB Host functionality. These chips can handle USB devices directly, eliminating the need for an external USB-to-UART adapter.
    • With these chips, you can directly connect USB devices and control them via the USB Host API.
  2. Using a USB Host Shield:

    • For boards like Arduino Uno, which do not support USB Host functionality natively, you can use a USB Host Shield. This shield allows the microcontroller to act as a USB Host and communicate with USB devices.

Limitations of the USB B Micro Port on ESP32/Arduino

The USB B micro or USB B standard port on an ESP32 or Arduino is not designed to handle or control USB devices. Instead, it acts purely as a USB Device, meaning:

  • It is used for programming and communication with a host computer.
  • It cannot function as a USB Host, and thus cannot control USB peripherals like a keyboard, mouse, or storage device.

Attempting to connect a USB device (such as a mouse or USB drive) directly to this port will not work, as the microcontroller cannot interpret or manage USB communication without additional hardware or USB Host support.

Conclusion

In summary, to connect USB devices to an ESP32 or Arduino:

  • ESP32 or Arduino (standard): Use a USB-to-UART adapter to enable communication with USB devices over UART.
  • ESP32-S2/S3: These microcontrollers have native USB Host support, allowing direct connection of USB devices.
  • Arduino Uno (or similar): A USB Host Shield is required to interface with USB devices, as these boards lack native USB Host functionality.

For most users working with ESP32 or Arduino boards that do not have native USB Host support, using an adapter or shield is necessary to bridge the gap between USB and UART communication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants