An Arduino wrapper to @sdima1357's usb_soft_host esp-idf example

Overview

ESP32 USB Soft Host library for Arduino IDE

This is mainly a wrapper around the excellent work of Dmitry Samsonov (@sdima1357) with esp32_usb_soft_host

Some parts of the code (e.g. the timer group isr calls) have been regressed to fit esp-idf 3.3 needs.

esp32 USB-LS is a pure software implementation of USB host thru general IO pins.

It supports up to 4 HID devices simultaneously.

Works on ESP32-Wroom and Wrover as long as the pins aren't shared (beware of the psram pins!), untested yet on S2, can't compile on C3.

[] []

Issues
  • Is it possible to translate the device to another?

    Is it possible to translate the device to another?

    to keep it simple, let's say i have a mouse but i won't to fool my computer into thinking it as a keyboard(sorry for a lame example), is that possible??

    The real world application can be, sometimes we don't have the exact device on the place to test. We can get the device's usb info, duplicate it and use or the test the software temporarily!!

    Is this possible somehow?!

    opened by harshilishere 4
  • Won't compile

    Won't compile

    I couldn't get the example code to compile without removing all the "inline" tags (on the function declarations). Do these serve a purpose that will cause problems later down the road, or are they safe to remove?

    opened by code32123 3
  • Can't compile

    Can't compile "fatal error: hal/cpu_hal.h: No such file or directory"

    Feeling kinda dumb, but I'm getting this error trying to compile the usb_test.ino. There is no such file in this library, but the "usb_host.c" is referencing it. What am I missing? This is the exact error message: "/home/user/Arduino/libraries/ESP32-USB-Soft-Host-main/src/usb_host.c:18:25: fatal error: hal/cpu_hal.h: No such file or directory compilation terminated."

    opened by Fredkopp 3
  • Connection issue

    Connection issue

    Hello.

    I want to ask for schematic.

    Do you put +5V on USB connector, and connect D+/D- directly to ESP32 pis (without voltage level shifter)?

    I have tried connect some devices to ESP32 thru cheap 5V<->3.3V level shifter and have no success. Keyboard and one mouse with long cable (~1.4m) is not recognized, and another mouse with shorter cable (~0.8m) is unstable recognized .

    Unfortunately i'm not sure about ESP32's pins 5V toolerance and i affraid to burn out microcontroller.

    Thanks for your time.

    opened by zbx-sadman 3
  • invalid conversion from 'int' to 'timer_autoreload_t'

    invalid conversion from 'int' to 'timer_autoreload_t'

    small conversion problem

    instead config.auto_reload = 1 better config.auto_reload = (timer_autoreload_t) 1;

    suggestion: https://github.com/tobozo/ESP32-USB-Soft-Host/pull/2

    opened by ESP32DE 2
  • Can it forward the data somehow?

    Can it forward the data somehow?

    This may be a duplicate question. I am trying to identify from your git repo if it is possible to read the usb device details(which it does) and then also forward the data as it is to computer? i.e.: I connect a mouse to esp32(via usb) and then get the data coming from the mouse in esp and forward it serially to let's say my computer? or why not forward the data to computer via mqtt!?

    So in one line the question is "Can it send and receive the data from and to the usb device connected??"

    opened by harshilishere 1
  • support for wireless keyboards?

    support for wireless keyboards?

    the library successfully worked for wired keyboards but can we make it work out for wireless keyboards as well? i'm using logitech mk215 wireless keyboard and it's not working.

    opened by jayesh312001 1
  • reference to wrong buffer

    reference to wrong buffer

    Copy paste problem :)

    https://github.com/tobozo/ESP32-USB-Soft-Host/blob/608ecc9e35d078155ab310e48c7b3651cf5cbe5c/src/usb_host.c#L1374

    instead of printCB( pcurrent->Resp0, pcurrent->R0Bytes ); must be: printCB( pcurrent->Resp1, pcurrent->R1Bytes );

    Descfription: In Resp0 response from ep0 (end point 0) In Resp1 response from ep1 (end point 1) Several HID devices have 2 end points . For example - combined mouse keyboard device

    opened by sdima1357 1
  • Trying to connect a QuickScan qd2430

    Trying to connect a QuickScan qd2430

    The Lib works fine with an apple mouse (desc.idVendor = 0x05acdesc.idProduct = 0x0304). I need to connect a USB QuickScan. Any idea? Any other usb scanner? Thankyou

    opened by silentrain23 8
  • ESP32-CAM Does not detect any USB device being attached

    ESP32-CAM Does not detect any USB device being attached

    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?

    opened by ugurbor 6
  • Crashes when using Bluetooth

    Crashes when using Bluetooth

    Base on the example here, I added ESP32 BLE Keyboard library to it.

    #include <BleKeyboard.h>
    BleKeyboard bleKeyboard;
    
    void setup()
    {
      //...
      Serial.println("Starting BLE work!");
      bleKeyboard.begin();
      return;
    }
    

    I found that it crashes at whatever execute later, bleKeyboard.begin() or USH.init().

    The ESP32 I am using is ESP32-DevkitC (ESP32­WROOM­32D).

    ble.begin() before USH.init()

    Starting BLE work!
    USB Soft Host Test for Default Wroom
    USB#0 (pins 16 17) is OK!
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    cpu freq = 240 MHz
    TIME_MULT = 51 
    ets Jun  8 2016 00:22:57
    
    rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0030,len:1240
    load:0x40078000,len:13012
    load:0x40080400,len:3648
    entry 0x400805f8
    Starting BLE work!
    USB Soft Host Test for Default Wroom
    USB#0 (pins 16 17) is OK!
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    cpu freq = 240 MHz
    TIME_MULT = 51 
    ets Jun  8 2016 00:22:57
    
    rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0030,len:1240
    load:0x40078000,len:13012
    load:0x40080400,len:3648
    entry 0x400805f8
    

    ble.begin() after USH.init()

    USB Soft Host Test for Default Wroom
    USB#0 (pins 16 17) is OK!
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    cpu freq = 240 MHz
    TIME_MULT = 51 
    D=   0 4800 bits in 1157.000000 uSec 4.148660 MHz  6 ticks in 1.446250 uS
    D= 127 4800 bits in 3672.000000 uSec 1.307190 MHz  6 ticks in 4.590000 uS
    D=  63 4800 bits in 2411.000000 uSec 1.990875 MHz  6 ticks in 3.013750 uS
    D=  95 4800 bits in 3011.000000 uSec 1.594155 MHz  6 ticks in 3.763750 uS
    D= 111 4800 bits in 3378.000000 uSec 1.420959 MHz  6 ticks in 4.222500 uS
    D= 103 4800 bits in 3192.000000 uSec 1.503759 MHz  6 ticks in 3.990000 uS
    D= 107 4800 bits in 3257.000000 uSec 1.473749 MHz  6 ticks in 4.071250 uS
    D= 105 4800 bits in 3251.000000 uSec 1.476469 MHz  6 ticks in 4.063750 uS
    D= 104 4800 bits in 3198.000000 uSec 1.500938 MHz  6 ticks in 3.997500 uS
    D= 104 4800 bits in 3191.000000 uSec 1.504231 MHz  6 ticks in 3.988750 uS
    TRANSMIT_TIME_DELAY = 106 time = 3.997500 error = -0.062501% 
    USB#1 is disabled by user configuration
    USB#2 is disabled by user configuration
    USB#3 is disabled by user configuration
    USB Soft Host init successfully
    Starting BLE work!
    Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
    Memory dump at 0x400d398c: 0000f01d 91004136 8230f1e6
    Core  1 register dump:
    PC      : 0x400d3992  PS      : 0x00060031  A0      : 0x80081216  A1      : 0x3ffbeea0  
    A2      : 0x3ffc2d80  A3      : 0x3ffc3b70  A4      : 0x0000037c  A5      : 0x3ffc2b6c  
    A6      : 0xfffffff7  A7      : 0x3ffc1464  A8      : 0x800813b1  A9      : 0x3ff00040  
    A10     : 0x00000011  A11     : 0x00000011  A12     : 0x8008286c  A13     : 0x3ffcfa60  
    A14     : 0x00000020  A15     : 0x13000054  SAR     : 0x00000020  EXCCAUSE: 0x00000000  
    EXCVADDR: 0x00000000  LBEG    : 0x4008fbb8  LEND    : 0x4008fbc3  LCOUNT  : 0x00000000  
    
    
    Backtrace:0x400d398f:0x3ffbeea00x40081213:0x3ffbeec0 0x40084af1:0x3ffbeee0 0x4009635b:0x3ffcfa40 0x400960ed:0x3ffcfa60 0x40098aa9:0x3ffcfaa0 0x40082251:0x3ffcfb20 0x400e188a:0x3ffcfb60 0x400e344e:0x3ffcfb90 0x400e3f79:0x3ffcfbb0 0x400e44dd:0x3ffcfbd0 0x400e2881:0x3ffcfc60 0x400e2f2a:0x3ffcfce0 0x400e32e3:0x3ffcfd50 0x400e1b03:0x3ffcfd70 0x400e1f85:0x3ffcfda0 0x40165dd7:0x3ffcfdc0 0x40165fbf:0x3ffcfe30 0x401660a4:0x3ffcfe60 0x400eb010:0x3ffcfe80 0x400db95a:0x3ffcfea0 0x400d74dd:0x3ffcfef0 0x400d453a:0x3ffcff20 0x400d1f4a:0x3ffcff60 0x400dc33f:0x3ffcffb0 
    
    
    
    
    ELF file SHA256: 0000000000000000
    
    Rebooting...
    ets Jun  8 2016 00:22:57
    
    rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0030,len:1240
    load:0x40078000,len:13012
    load:0x40080400,len:3648
    entry 0x400805f8
    USB Soft Host Test for Default Wroom
    USB#0 (pins 16 17) is OK!
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    READ_BOTH_PINS = 0000
    cpu freq = 240 MHz
    TIME_MULT = 51 
    D=   0 4800 bits in 1157.000000 uSec 4.148660 MHz  6 ticks in 1.446250 uS
    D= 127 4800 bits in 3672.000000 uSec 1.307190 MHz  6 ticks in 4.590000 uS
    D=  63 4800 bits in 2411.000000 uSec 1.990875 MHz  6 ticks in 3.013750 uS
    D=  95 4800 bits in 3011.000000 uSec 1.594155 MHz  6 ticks in 3.763750 uS
    D= 111 4800 bits in 3378.000000 uSec 1.420959 MHz  6 ticks in 4.222500 uS
    D= 103 4800 bits in 3192.000000 uSec 1.503759 MHz  6 ticks in 3.990000 uS
    D= 107 4800 bits in 3258.000000 uSec 1.473297 MHz  6 ticks in 4.072500 uS
    D= 105 4800 bits in 3251.000000 uSec 1.476469 MHz  6 ticks in 4.063750 uS
    D= 104 4800 bits in 3198.000000 uSec 1.500938 MHz  6 ticks in 3.997500 uS
    D= 104 4800 bits in 3191.000000 uSec 1.504231 MHz  6 ticks in 3.988750 uS
    TRANSMIT_TIME_DELAY = 106 time = 3.997500 error = -0.062501% 
    USB#1 is disabled by user configuration
    USB#2 is disabled by user configuration
    USB#3 is disabled by user configuration
    USB Soft Host init successfully
    Starting BLE work!
    Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
    Memory dump at 0x400d398c: 0000f01d 91004136 8230f1e6
    Core  1 register dump:
    PC      : 0x400d3992  PS      : 0x00060031  A0      : 0x80081216  A1      : 0x3ffbeea0  
    A2      : 0x3ffc2d80  A3      : 0x3ffc3b70  A4      : 0x0000037c  A5      : 0x3ffc2b6c  
    A6      : 0xfffffff7  A7      : 0x3ffc1464  A8      : 0x800813b1  A9      : 0x3ff00040  
    A10     : 0x00000011  A11     : 0x00000011  A12     : 0x8008286c  A13     : 0x3ffcfa60  
    A14     : 0x00000020  A15     : 0x13000054  SAR     : 0x00000020  EXCCAUSE: 0x00000000  
    EXCVADDR: 0x00000000  LBEG    : 0x4008fbb8  LEND    : 0x4008fbc3  LCOUNT  : 0x00000000  
    
    
    Backtrace:0x400d398f:0x3ffbeea00x40081213:0x3ffbeec0 0x40084af1:0x3ffbeee0 0x40096356:0x3ffcfa40 0x400960ed:0x3ffcfa60 0x40098aa9:0x3ffcfaa0 0x40082251:0x3ffcfb20 0x400e188a:0x3ffcfb60 0x400e344e:0x3ffcfb90 0x400e3f79:0x3ffcfbb0 0x400e44dd:0x3ffcfbd0 0x400e2881:0x3ffcfc60 0x400e2f2a:0x3ffcfce0 0x400e32e3:0x3ffcfd50 0x400e1b03:0x3ffcfd70 0x400e1f85:0x3ffcfda0 0x40165dd7:0x3ffcfdc0 0x40165fbf:0x3ffcfe30 0x401660a4:0x3ffcfe60 0x400eb010:0x3ffcfe80 0x400db95a:0x3ffcfea0 0x400d74dd:0x3ffcfef0 0x400d453a:0x3ffcff20 0x400d1f4a:0x3ffcff60 0x400dc33f:0x3ffcffb0 
    
    
    
    
    ELF file SHA256: 0000000000000000
    
    Rebooting...
    
    opened by kice 6
  • Not an Issue: Possible to add support to send data?

    Not an Issue: Possible to add support to send data?

    Hi,

    I appreciate this isn't an issue, but just wondering if it's possible to add support to send data?

    I have a universal HID device I created that I'd like to talk to via USB Soft Host, would it be difficult to implement?

    opened by cpriest-gc 2
Releases(v0.1.1)
Owner
tobozo
I'm the Bozo ෴ bit in your Bogon. DIY IoT/WoT tinkerer, JS/PHP freestack dev, C/C++ novice and tech lover
tobozo
idf.py.exe, wrapper tool to invoke idf.py on Windows

IDF wrapper tool (idf.py.exe) This tools helps invoke idf.py in Windows CMD shell. In Windows CMD shell, python scripts can be executed directly (by t

Espressif Systems 3 Dec 13, 2021
This FreeRTOS example builds a simple Timer application for Linux using the ESP-IDF

Supported Targets Linux This FreeRTOS example builds a simple Timer application for Linux using the ESP-IDF. Build Source the IDF environment as usual

null 13 Apr 4, 2022
ESP32 S2 C++ host library compatible with arduino, esp-idf.

Info I would like to announce USB host library for esp32 S2 compatible with arduino, esp-idf and PIO (when pio will be updated to most recent esp-idf)

null 15 Jun 2, 2022
GFX Demo for the ESP-IDF

Display Drivers and Demo for GFX This is a Demo of GFX With Several Display Drivers This is not GFX itself, but it includes it. GFX Documentation is b

honey the codewitch 61 May 17, 2022
To simplify the development of ESP32 in ESP-IDF, Easyio provides a complete driver library

Easyio 开源驱动库 Easyio 是一款适配于ESP-IDF框架的开源驱动库,以支持ESP32的简便开发。目的是简化乐鑫ESP-IDF开发框架的使用难度。(真要方便的话,有现成的Arduino和Platform可以用,不过实在迫于工作要求,有的开源东西不让用,同时便于对接FAE,于是就有了 E

null 161 Jun 21, 2022
使用ESP-IDF、ESP-ADF、LVGL等库,基于ESP32S2实现简单的网络收音机和FM收音机功能。

【电子森林项目】网络收音机/FM收音机 这个项目是报名《硬禾“暑期一起练”第3个平台 - 基于ESP32-S2模块的网络收音机和音频信号处理》所做的。 基本功能: 可以连接WiFi收听HLS协议的网络电台节目 收听空中的FM电台88MHz~108MHz OLED0.96寸显示 四个独立按键控制两种模

DaMi 12 Jun 3, 2022
LVGL8 for ESP-IDF

X-UI LVGL8 for ESP-IDF 移植自X-TRACK项目的页面栈框架,新增支持异步通信的订阅发布数据中心 特点 使用C语言重构,方便继承复用 核心文件 ui_page_manager.h、ui_page_manager.c 实现页面栈、订阅发布数据中心 完整页面生命周期 MVC架构 数

Zing 11 Apr 19, 2022
Additional components for ESP-IDF, maintained by Espressif

Espressif IDF Extra Components This repository aims to store ESP-IDF extra components which have been seperated and uploaded into IDF Component Manage

Espressif Systems 15 Jun 6, 2022
Add tensilica esp32 cpu and a board to qemu and dump the rom to learn more about esp-idf

qemu_esp32 Add tensilica esp32 cpu and a board to qemu and dump the rom to learn more about esp-idf ESP32 in QEMU. This documents how to add an esp32

null 333 Jun 22, 2022
SX1276/77/78/79 Low Power Long Range Transceiver driver for esp-idf

esp-idf-sx127x SX1276/77/78/79 Low Power Long Range Transceiver driver for esp-idf. I based on this. Changes from the original Added support for ESP32

null 11 Jun 21, 2022
WireGuard Implementation for ESP-IDF

esp_wireguard, WireGuard Implementation for ESP-IDF This is an implementation of the WireGuard® for ESP-IDF, based on WireGuard Implementation for lwI

Tomoyuki Sakurai 76 Jun 24, 2022
SX1262//68 Low Power Long Range Transceiver driver for esp-idf

esp-idf-sx126x SX1262//68 Low Power Long Range Transceiver driver for esp-idf. I ported from here. Ai-Thinker offers several LoRa modules. You can get

null 3 May 9, 2022
SI4432 ISM Transceiver driver for esp-idf

esp-idf-si4432 SI4432 ISM Transceiver driver for esp-idf. I refered this. Software requirements esp-idf v4.4 or later. This is because this version su

null 3 May 29, 2022
CC2500 Low-Cost Low-Power 2.4 GHz RF Transceiver driver for esp-idf

esp-idf-cc2500 CC2500 Low-Cost Low-Power 2.4 GHz RF Transceiver driver for esp-idf. I ported from this. 2.00mm pitch External Antena 1.27mm pitch PCB

null 3 May 29, 2022
Collection of additional Ethernet drivers for ESP-IDF

Collection of additional Ethernet drivers for ESP-IDF This repository aims to store additional Ethernet drivers which are not available directly in ES

Espressif Systems 3 May 9, 2022
Internet of things created using arduino IoT cloud, consisting of esp and arduino boards

Internet of things created using arduino IoT cloud, consisting of esp and arduino boards. Goal of the project is to create a 3D printed RFID protected (with PIN) lock, including surveillance.

null 2 May 11, 2022
ESP Insights is a remote diagnostics solution that allows users to remotely monitor the health of ESP devices in the field.

ESP Insights is a remote diagnostics solution that allows users to remotely monitor the health of ESP devices in the field.

Espressif Systems 28 Jun 21, 2022
Example-application - Example out-of-tree application that is also a module

Zephyr Example Application This repository contains a Zephyr example application. The main purpose of this repository is to serve as a reference on ho

Zephyr Project 64 Jun 22, 2022
Arduino ve Esp ile oluşturulmuş mobil arama robotu projesi

Arduino-Mobil-Arama-Robotu Arduino ve Esp ile oluşturulmuş mobil arama robotu projesi Proje Adı: Mobil Arama Robotu Projenin Amacı 2x2 mt^2 lik bir al

Serhat Koçhan 0 May 12, 2022