-
Notifications
You must be signed in to change notification settings - Fork 7.6k
ESP32S3 - HID USBHID SendReport error and USB Replug #6922
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
Comments
This will be triage by @SuGlider, in next 2 weeks we will specify next steps. |
@RichardsATcn - It seems that the code you posted is some modified version of "official" USBHID.cpp - Not sure how to help you. Please confirm. Can you try the sketch using Arduino Core 2.0.4? Thanks. |
@RichardsATcn any updates? |
I will try with sdk 2.0.6,thank you。 |
same issue with esps3 wroom 1U. Use lastest version 2.0.7 [ 7621][E][USBHID.cpp�ESP-ROM:esp32s3-20210327 |
@hoantv - I have tested it with Win11. The problem is that Win doesn't know what is BUTTON_START. I tested it with an ESP32-S3 and when pressing the BOOT button on the board, the Joystick moves to the right bottom corner and returns back to the center. This is the code that I have tested: #if ARDUINO_USB_MODE
#warning This sketch should be used when USB is in OTG mode
void setup() {}
void loop() {}
#else
#include "USB.h"
#include "USBHIDGamepad.h"
USBHIDGamepad Gamepad;
const int buttonPin = 0;
int previousButtonState = HIGH;
void setup() {
Serial.begin(115200);
pinMode(buttonPin, INPUT_PULLUP);
Gamepad.begin();
USB.begin();
}
void loop() {
int buttonState = digitalRead(buttonPin);
if ((buttonState != previousButtonState) && (buttonState == LOW)) {
Gamepad.leftStick(100, 100);
delay(500);
Gamepad.leftStick(0, 0);
Serial.println("Button Pressed - gamePad should have sent event.");
}
previousButtonState = buttonState;
}
#endif /* ARDUINO_USB_MODE */ |
@RichardsATcn - I used Arduino Core 2.0.7 and it works fine also when USB is unplugged and plugged back. This issue is solved. |
Board
ESP32-S3-WROOM-1 Moudle
Device Description
ESP32-S3-WROOM-1
Hardware Configuration
only use USB ;
Version
v2.0.3
IDE Name
Arduino 1.8.19
Operating System
Windows 10
Flash frequency
QIO 80
PSRAM enabled
no
Upload speed
115200
Description
ESP32-S3-USB.zip
src.zip
USB device will appear error after using for a while.
If the CDC serial port is enabled, it will be easier to send at fixed time.
Devices will be re enumerated repeatedly
The error code segment is as follows
` bool res = ready();
if (!res)
{
log_e("not ready");
}
else
{
res = tud_hid_n_report(0, id, data, len);
if (!res)
{
log_e("report %u failed", id);
}
else
{
xSemaphoreTake(tinyusb_hid_device_input_sem, 0);
if (xSemaphoreTake(tinyusb_hid_device_input_sem, timeout_ms / portTICK_PERIOD_MS) != pdTRUE)
{
log_e("report %u wait failed", id);
res = false;
}
}
}
xSemaphoreGive(tinyusb_hid_device_input_mutex);
//Added code snippet
if (tinyusb_hid_device_input_sem)
{
xSemaphoreGive(tinyusb_hid_device_input_sem);
}
log_d("report %u wait over %s", id, res == true ? "true" : "false");
//Added code snippet
usb设备使用一会儿会出现错误。
如果cdc串口开启定时发送时候会更容易出现。
设备会反复的 重新枚举
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: