esp-idf-ssd1306/KeyboardDemo/README.md

57 lines
1.9 KiB
Markdown
Raw Normal View History

2024-08-21 02:49:59 -04:00
# KeyboardDemo for SSD1306
Demo that displays input from the keyboard.
2024-08-21 08:50:16 -04:00
I used [this](https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/host/hid) as a reference.
2024-08-21 02:49:59 -04:00
2024-08-21 02:58:01 -04:00
![usb-keyboard-1](https://github.com/user-attachments/assets/cb108559-4a5a-4df7-9be8-47f9f4c492f3)
2024-08-21 02:50:39 -04:00
2024-08-21 02:49:59 -04:00
# Hardware requirements
- ESP32S2/S3
These have USB-HOST functionality.
- USB Connector
2024-08-21 03:07:20 -04:00
I used this:
2024-08-21 21:25:51 -04:00
![usb-conector-3](https://github.com/user-attachments/assets/05f3f79d-00d1-4d65-ad46-67d2e987bc88)
2024-08-21 02:49:59 -04:00
- USB keyboard
2024-08-21 03:00:49 -04:00
# USB wiring
2024-08-21 19:14:38 -04:00
To stabilize the power supply, I placed a 100uF electrolytic capacitor between 5V and GND.
2024-08-21 03:00:49 -04:00
```
2024-08-21 19:10:13 -04:00
ESP32-S2/S3 BOARD USB CONNECTOR
+--+
[ 5V ] +---------> | || VCC
[GPIO 19] |---------> | || D-
[GPIO 20] |---------> | || D+
[ GND ] |--------+> | || GND
| | +--+
+---||---+
100uF
2024-08-21 03:00:49 -04:00
```
2024-08-21 02:49:59 -04:00
2024-08-21 03:43:40 -04:00
# USB hot socket
2024-08-21 03:41:07 -04:00
There are times when it works correctly and times when it doesn't.
It works more stably if you connect before starting the firmware.
When it works correctly, a log like this will be displayed.
```
I (796) usb_hid: hid_host_device_callback
I (796) usb_hid: HID Device, protocol 'KEYBOARD' CONNECTED
I (806) usb_hid: hid_host_device_callback
I (816) usb_hid: HID Device, protocol 'NONE' CONNECTED
```
# Using USB-HUB
I tried it, but it doesn't work properly via USB-HUB.
2024-08-22 00:00:44 -04:00
2024-08-22 00:11:38 -04:00
# Transfer failed error
2024-08-22 00:10:31 -04:00
For some reason, the following error may occur in rare cases.
2024-08-22 00:03:51 -04:00
This error occurs inside the usb_host_hid component.
2024-08-22 00:28:26 -04:00
It is unclear whether it is a component bug or an effect of electrical noise.
2024-08-22 00:10:31 -04:00
It may come back to life if you unplugging the keyboard and plugging it again.
2024-08-22 00:13:36 -04:00
If you know the cause, please let us know.
2024-08-22 00:00:44 -04:00
```
E (12287696) hid-host: Transfer failed, status 1
E (12287696) usb_hid: HID Device, protocol 'MOUSE' TRANSFER_ERROR
E (15953516) USBH: Device 1 gone
```