You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello friends,
I'm using VSCode + ESP-IDF v5.5.
I want to create a USB device that functions as USB CDC and USB HID.
I have a function that looks like this: CommunicationUSBClass.Initialize("CompanyName", "ProductName", SerialNumber, PID, VID, *reportDescriptor, reportDescriptorLeght).
However, when I plug my ESP32-S3 into Windows, Windows USB device installing pops up and tells me "Device Descriptor Request Failed".
What am doing wrong please?
How to reproduce ?
Here is my code. I couldn't use the <> code function. So here it is in plain text:
#include "tusb.h"
#include "esp_log.h"
#include "tinyusb.h"
#include "tusb_cdc_acm.h"
while(true)
{
DebugTest = false;
tud_task();
DebugTest = true;
// Do some stuff with CDC like read incoming data
// Do some stuff with HID like send keyboard data.
vTaskDelay(pdMS_TO_TICKS(1));
}
This discussion was converted from issue #3214 on August 14, 2025 15:13.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Operating System
Windows 11
Commit SHA
None
Board
ESp32-S3
Firmware
I'm using: "espressif/esp_tinyusb^1.7.6~1"
From: https://components.espressif.com/components/espressif/esp_tinyusb/versions/1.7.6~1/changelog?language=en
What happened ?
Hello friends,
I'm using VSCode + ESP-IDF v5.5.
I want to create a USB device that functions as USB CDC and USB HID.
I have a function that looks like this:
CommunicationUSBClass.Initialize("CompanyName", "ProductName", SerialNumber, PID, VID, *reportDescriptor, reportDescriptorLeght).
However, when I plug my ESP32-S3 into Windows, Windows USB device installing pops up and tells me "Device Descriptor Request Failed".
What am doing wrong please?
How to reproduce ?
Here is my code. I couldn't use the <> code function. So here it is in plain text:
#include "tusb.h"
#include "esp_log.h"
#include "tinyusb.h"
#include "tusb_cdc_acm.h"
// Declare static variables
std::atomic CommunicationUSBClass::IsUSBConnectionActive;
std::atomic CommunicationUSBClass::DebugTest;
tusb_desc_device_t CommunicationUSBClass::DescriptorDevice;
uint8_t CommunicationUSBClass::HIDDeviceReport[512];
uint16_t CommunicationUSBClass::DescriptorString[32];
std::string CommunicationUSBClass::CompanyName;
std::string CommunicationUSBClass::ProductName;
std::string CommunicationUSBClass::ProductSerialNumber;
uint16_t CommunicationUSBClass::ProductVID;
uint16_t CommunicationUSBClass::ProductPID;
uint8_t CommunicationUSBClass::DescriptorConfiguration[] =
{
// ----- Configuration Descriptor -----
0x09, // bLength
0x02, // bDescriptorType = CONFIGURATION
0x00, 0x00, // wTotalLength (LSB, MSB) — will be set later
0x03, // bNumInterfaces (CDC Control, CDC Data, HID)
0x01, // bConfigurationValue
0x00, // iConfiguration
0xC0, // bmAttributes: self-powered
0x32, // bMaxPower: 100 mA
};
CommunicationUSBClass::CommunicationUSBClass()
:
Initialized(false)
{
}
CommunicationUSBClass::~CommunicationUSBClass()
{
}
bool CommunicationUSBClass::Initialize(std::string companyName, std::string productName,
std::string productSerialNumber,uint16_t productVID, uint16_t productPID,
const uint8_t* hidDeviceReport, uint16_t hidDeviceReportLength)
{
if(!Initialized)
{
}
void CommunicationUSBClass::InitializeThreadTask(void *pvParameters)
{
CommunicationUSBClass *thisInstance = static_cast<CommunicationUSBClass *>(pvParameters);
thisInstance->LoopTask();
}
void CommunicationUSBClass::LoopTask()
{
tusb_init();
}
/**-- TinyUSB callbacks -- /
uint8_t const * CommunicationUSBClass::tud_descriptor_device_cb()
{
DebugTest = true;
return (uint8_t const) &DescriptorDevice;
}
uint8_t const * CommunicationUSBClass::tud_descriptor_configuration_cb(uint8_t index)
{
(void) index;
return DescriptorConfiguration;
}
uint16_t const * CommunicationUSBClass::tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
(void) langid;
}
void CommunicationUSBClass::tud_mount_cb(void)
{
IsUSBConnectionActive.store(true, std::memory_order_relaxed);
}
void CommunicationUSBClass::tud_umount_cb(void)
{
IsUSBConnectionActive.store(false, std::memory_order_relaxed);
}
void CommunicationUSBClass::tud_resume_cb(void)
{
IsUSBConnectionActive.store(true, std::memory_order_relaxed);
}
void CommunicationUSBClass::tud_suspend_cb(bool remote_wakeup_en)
{
IsUSBConnectionActive.store(false, std::memory_order_relaxed);
}
void CommunicationUSBClass::tud_cdc_rx_cb(uint8_t itf)
{
}
uint8_t const * CommunicationUSBClass::tud_hid_descriptor_report_cb(uint8_t instance)
{
(void) instance;
return HIDDeviceReport;
}
// Called when Host PC requests for a report.
uint16_t CommunicationUSBClass::tud_hid_get_report_cb(uint8_t itf, uint8_t report_id,
hid_report_type_t report_type,
uint8_t* buffer, uint16_t reqlen)
{
(void) itf;
(void) report_id;
(void) report_type;
}
// Called when we receive a report from the Host PC.
void CommunicationUSBClass::tud_hid_set_report_cb(uint8_t itf, uint8_t report_id,
hid_report_type_t report_type,
uint8_t const* buffer, uint16_t bufsize)
{
(void) itf;
(void) report_id;
(void) report_type;
(void) buffer;
(void) bufsize;
}
/* C functions for TinyUSB */
extern "C"
{
// Device descriptor callback
uint8_t const * tud_descriptor_device_cb(void)
{
} // extern
/**
*/
bool CommunicationUSBClass::IsUSBConnected(void)
{
return true;
}
Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)
"Device Descriptor Request Failed"
Screenshots
No response
I have checked existing issues, discussion and documentation
Beta Was this translation helpful? Give feedback.
All reactions