USB Flash Disk with HTTP file server example demonstrates file serving with both upload and download capability.
**The demo is only used for function preview , only tested on Windows 10 now, don't be surprised if you find bug **
- Board:ESP32-S2-Saola-1_v1.2
- MCU:ESP32-S2
- Flash:4MB NOR Flash
- Hardware Connection:
GPIO19/20 to D-/D+ respectively for an ESP32-S2 board
- USB MSC supported, you can read-write onboard flash from host;
- Download-upload data through WLAN, ESP32-S2 can act as a Wi-Fi AP or STA;
- USB CDC supported for communication with host over USB .
- for general uart download
- input
idf.py build
to build the example - enter or autoswitch to downloader mode
- input
idf.py flash
to download the bin to esp32s2
- input
- only have usb port?
- input
idf.py dfu
to build the example - pulldown
boot
io to enterUSB DFU
downloader mode - input
idf.py dfu-flash
to download the bin to esp32s2
- input
- Plug-in with a micro USB cable to host USB port directly;
- You can find a
1.5MB
disk in yourfiles resource manager
; - Connect with ESP32S2 through Wi-Fi, SSID:
ESP32S2_XXXXXX
with no password by default; - Input
192.168.4.1
in your browser, you can find a file list of the disk; - Everything you drag to the disk will be displayed in web page (file size must < 200KB in this demo);
- Everything you upload from web page will be displayed in the disk too (file size must < 200KB in this demo).
- Files uploaded through web can not be aware by host , so Windows
files resource manager
can not update the files list automatically. Please remount the disk to update the files list (弹出重新加载) . This bug will be fixed later. - Files added or removed through USB disk, sometimes can not be found by web refresh, this bug will be fixed soon.
- Speed limitation and capacity limitation, because of the NOR flash we use in this demo;
- Bug fix;
- Support SD card ;
- Support USB host to read from external disk ;
- Support USB host to control external device.
ESP32-S2 family features a full-speed USB OTG interface which is compliant with the USB 1.1 specification. It has the following features:
- software-configurable endpoint settings and suspend/resume
- support for dynamic FIFO sizing
- support for session request protocol (SRP) and host negotiation protocol (HNP)
- a full-speed USB PHY integrated in the chip
TinyUSB is integrating with ESP-IDF to provide USB features of the framework. TinyUSB is an open-source cross-platform USB Host/Device stack for embedded system, designed to be memory-safe with no dynamic allocation and thread-safe with all interrupt events are deferred then handled in the non-ISR task function.
Supports multiple device configurations by dynamically changing usb descriptors. Low power functions such like suspend, resume, and remote wakeup. Following device classes are supported:
- Communication Class (CDC)
- Human Interface Device (HID): Generic (In & Out), Keyboard, Mouse, Gamepad etc ...
- Mass Storage Class (MSC): with multiple LUNs
- Musical Instrument Digital Interface (MIDI)
- Network with RNDIS, CDC-ECM (work in progress)
- USB Test and Measurement Class (USBTMC)
- Vendor-specific class support with generic In & Out endpoints. Can be used with MS OS 2.0 compatible descriptor to load winUSB driver without INF file.
- WebUSB with vendor-specific class
Host Stack(will support soon)
Most active development is on the Device stack. The Host stack is under rework
- Human Interface Device (HID): Keyboard, Mouse, Generic
- Mass Storage Class (MSC)
- Hub currently only supports 1 level of hub (due to my laziness)