2026-03-09 3:38 AM
Hi all,
I’m working on porting a firmware from a Microchip PIC18F66J50 to an STM32C071.
The original device communicates successfully with Windows and Android devices over USB, through an app developed in Flutter (Android Studio) using the QuickUsb library.
On the STM32 side, I’m now using the USBX stack. After quite a bit of work, I managed to get the USB communication fully working with Windows — enumeration and protocol exchange both succeed.
However, while the device correctly enumerates on Android, the protocol communication fails.
Since the Android app already works perfectly with the original Microchip-based device, I assume that no changes are needed on the app side. This suggests that the issue lies in how the STM32 presents itself to Android (possibly in the USB descriptors or class/interface setup).
Has anyone experienced similar issues with USBX on Android, or are there known differences in how Android handles vendor-specific protocols compared to Windows?
Thanks for your help!
Bruno R.
2026-03-09 4:35 AM
Hi @BRonc.1
Which USB class are you using? Did you compare PIC18 descriptors with STM32C0 USBX descriptors? If you have a USB analyzer, capture the traffic between Android and PIC18 device then with STM32C0 failing device and share the first few transactions control and bulk to narrow down the issue.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2026-03-09 5:54 AM
Hi FBL,
I'm using Custom HID. Descriptors are quite the same, they differs only in EP type: PIC are both INTERRUPT, STM32C071 are BULK for EPout and INTERRUPT for EPin. Here's PIC66J50 descriptors report:
=========================== USB Port7 ===========================
Connection Status : 0x01 (Device is connected)
Port Chain : 1-1-7
========================== Summary =========================
Vendor ID : 0x04D8 (Microchip Technology Inc.)
Product ID : 0xFC00
USB version : 2.00 -> wrong, device is Full-Speed only
Port maximum Speed : High-Speed
Device maximum Speed : Full-Speed
Device Connection Speed : Full-Speed
Self Powered : yes
Demanded Current : 100 mA
Used Endpoints : 3
======================== USB Device ========================
+++++++++++++++++ Device Information ++++++++++++++++++
Device Description : Dispositivo di input USB
Device Path : \\?\USB#VID_04D8&PID_FC00#6&c2c3bad&1&7#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Kernel Name : \Device\USBPDO-15
Device ID : USB\VID_04D8&PID_FC00\6&C2C3BAD&1&7
Hardware IDs : USB\VID_04D8&PID_FC00&REV_0001 USB\VID_04D8&PID_FC00
Driver KeyName : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0018 (GUID_DEVCLASS_HIDCLASS)
Driver : \SystemRoot\System32\drivers\hidusb.sys (Version: 10.0.22621.4111 Date: 2025-08-25)
Driver Inf : C:\WINDOWS\inf\input.inf
Legacy BusType : PNPBus
Class : HIDClass
Class GUID : {745a17a0-74d3-11d0-b6fe-00a0c90f57da} (GUID_DEVCLASS_HIDCLASS)
Service : HidUsb
Enumerator : USB
Location Info : Port_#0007.Hub_#0003
Location IDs : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(1)#USB(7), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS01)#USB(7)
Container ID : {6e65bcf5-f762-11f0-9e63-00d86140c24c}
Manufacturer Info : (Periferiche standard di sistema)
Capabilities : 0x84 (Removable, SurpriseRemovalOK)
Status : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code : 0
HcDisableSelectiveSuspend: 0
EnableSelectiveSuspend : 0
SelectiveSuspendEnabled : 0
EnhancedPowerMgmtEnabled : 1
IdleInWorkingState : 0
WakeFromSleepState : 0
Power State : D0 (supported: D0, D2, D3, wake from D0, wake from D2)
Child Device 1 : Dispositivo compatibile HID definito da fornitore
Device Path : \\?\HID#VID_04D8&PID_FC00#7&1e243a90&4&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} (GUID_DEVINTERFACE_HID)
Kernel Name : \Device\00000105
Device ID : HID\VID_04D8&PID_FC00\7&1E243A90&4&0000
Class : HIDClass
Driver KeyName : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0019 (GUID_DEVCLASS_HIDCLASS)
+++++++++++++++++ Registry USB Flags +++++++++++++++++
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\04D8FC000001
osvc : REG_BINARY 00 00
---------------- Connection Information ---------------
Connection Index : 0x07 (Port 7)
Connection Status : 0x01 (DeviceConnected)
Current Config Value : 0x01 (Configuration 1)
Device Address : 0x24 (36)
Is Hub : 0x00 (no)
Device Bus Speed : 0x01 (Full-Speed)
Number Of Open Pipes : 0x02 (2 pipes to data endpoints)
Pipe[0] : EndpointID=1 Direction=IN ScheduleOffset=0 Type=Interrupt
Pipe[1] : EndpointID=1 Direction=OUT ScheduleOffset=0 Type=Interrupt
Data (HexDump) : 07 00 00 00 12 01 00 02 00 00 00 08 D8 04 00 FC ................
01 00 01 02 00 01 01 01 00 24 00 02 00 00 00 01 .........$......
00 00 00 07 05 81 03 40 00 01 00 00 00 00 07 05 .......@........
01 03 40 00 01 00 00 00 00 ..@......
--------------- Connection Information V2 -------------
Connection Index : 0x07 (7)
Length : 0x10 (16 bytes)
SupportedUsbProtocols : 0x03
Usb110 : 1 (yes, port supports USB 1.1)
Usb200 : 1 (yes, port supports USB 2.0)
Usb300 : 0 (no, port not supports USB 3.0)
ReservedMBZ : 0x00
Flags : 0x00
DevIsOpAtSsOrHigher : 0 (Device is not operating at SuperSpeed or higher)
DevIsSsCapOrHigher : 0 (Device is not SuperSpeed capable or higher)
DevIsOpAtSsPlusOrHigher : 0 (Device is not operating at SuperSpeedPlus or higher)
DevIsSsPlusCapOrHigher : 0 (Device is not SuperSpeedPlus capable or higher)
ReservedMBZ : 0x00
Data (HexDump) : 07 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 ................
---------------------- Device Descriptor ----------------------
bLength : 0x12 (18 bytes)
bDescriptorType : 0x01 (Device Descriptor)
bcdUSB : 0x200 (USB Version 2.00) -> wrong, device is Full-Speed only
bDeviceClass : 0x00 (defined by the interface descriptors)
bDeviceSubClass : 0x00
bDeviceProtocol : 0x00
bMaxPacketSize0 : 0x08 (8 bytes)
idVendor : 0x04D8 (Microchip Technology Inc.)
idProduct : 0xFC00
bcdDevice : 0x0001
iManufacturer : 0x01 (String Descriptor 1)
Language 0x0409 : "LEM Elettronica °"
iProduct : 0x02 (String Descriptor 2)
Language 0x0409 : "DSP35evo °"
iSerialNumber : 0x00 (No String Descriptor)
bNumConfigurations : 0x01 (1 Configuration)
Data (HexDump) : 12 01 00 02 00 00 00 08 D8 04 00 FC 01 00 01 02 ................
00 01 ..
------------------ Configuration Descriptor -------------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x02 (Configuration Descriptor)
wTotalLength : 0x0029 (41 bytes)
bNumInterfaces : 0x01 (1 Interface)
bConfigurationValue : 0x01 (Configuration 1)
iConfiguration : 0x00 (No String Descriptor)
bmAttributes : 0xC0
D7: Reserved, set 1 : 0x01
D6: Self Powered : 0x01 (yes)
D5: Remote Wakeup : 0x00 (no)
D4..0: Reserved, set 0 : 0x00
MaxPower : 0x32 (100 mA)
Data (HexDump) : 09 02 29 00 01 01 00 C0 32 09 04 00 00 02 03 00 ..).....2.......
00 00 09 21 01 01 00 01 22 21 00 07 05 81 03 40 ...!...."!.....@
00 01 07 05 01 03 40 00 01 ......@..
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x00
bAlternateSetting : 0x00
bNumEndpoints : 0x02 (2 Endpoints)
bInterfaceClass : 0x03 (HID - Human Interface Device)
bInterfaceSubClass : 0x00 (None)
bInterfaceProtocol : 0x00 (None)
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 00 00 02 03 00 00 00 .........
------------------- HID Descriptor --------------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x21 (HID Descriptor)
bcdHID : 0x0101 (HID Version 1.01)
bCountryCode : 0x00 (00 = not localized)
bNumDescriptors : 0x01
Data (HexDump) : 09 21 01 01 00 01 22 21 00 .!...."!.
Descriptor 1:
bDescriptorType : 0x22 (Class=Report)
wDescriptorLength : 0x0021 (33 bytes)
Error reading descriptor : ERROR_INVALID_PARAMETER (due to a obscure limitation of the Win32 USB API, see UsbTreeView.txt)
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x81 (Direction=IN EndpointID=1)
bmAttributes : 0x03 (TransferType=Interrupt)
wMaxPacketSize : 0x0040 (64 bytes)
bInterval : 0x01 (1 ms)
Data (HexDump) : 07 05 81 03 40 00 01 ....@..
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x01 (Direction=OUT EndpointID=1)
bmAttributes : 0x03 (TransferType=Interrupt)
wMaxPacketSize : 0x0040 (64 bytes)
bInterval : 0x01 (1 ms)
Data (HexDump) : 07 05 01 03 40 00 01 ....@..
----------------- Device Qualifier Descriptor -----------------
Error : ERROR_GEN_FAILURE
-------------------- String Descriptors -------------------
------ String Descriptor 0 ------
bLength : 0x04 (4 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language ID[0] : 0x0409 (English - United States)
Data (HexDump) : 04 03 09 04 ....
------ String Descriptor 1 ------
bLength : 0x22 (34 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "LEM Elettronica °" *!*ERROR contains 1 NULL character
Data (HexDump) : 22 03 4C 00 45 00 4D 00 20 00 45 00 6C 00 65 00 ".L.E.M. .E.l.e.
74 00 74 00 72 00 6F 00 6E 00 69 00 63 00 61 00 t.t.r.o.n.i.c.a.
20 00 .
------ String Descriptor 2 ------
bLength : 0x22 (34 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "DSP35evo °" *!*ERROR contains 1 NULL character
Data (HexDump) : 22 03 44 00 53 00 50 00 33 00 35 00 65 00 76 00 ".D.S.P.3.5.e.v.
6F 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 o. . . . . . . .
20 00 .
And here's the STM32 descriptors report:
=========================== USB Port7 ===========================
Connection Status : 0x01 (Device is connected)
Port Chain : 1-1-7
========================== Summary =========================
Vendor ID : 0x04D8 (Microchip Technology Inc.)
Product ID : 0xFC00
USB version : 2.00 -> wrong, device is Full-Speed only
Port maximum Speed : High-Speed
Device maximum Speed : Full-Speed
Device Connection Speed : Full-Speed
Self Powered : yes
Demanded Current : 100 mA
Used Endpoints : 3
======================== USB Device ========================
+++++++++++++++++ Device Information ++++++++++++++++++
Device Description : Dispositivo di input USB
Device Path : \\?\USB#VID_04D8&PID_FC00#6&c2c3bad&1&7#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Kernel Name : \Device\USBPDO-15
Device ID : USB\VID_04D8&PID_FC00\6&C2C3BAD&1&7
Hardware IDs : USB\VID_04D8&PID_FC00&REV_0001 USB\VID_04D8&PID_FC00
Driver KeyName : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0018 (GUID_DEVCLASS_HIDCLASS)
Driver : \SystemRoot\System32\drivers\hidusb.sys (Version: 10.0.22621.4111 Date: 2025-08-25)
Driver Inf : C:\WINDOWS\inf\input.inf
Legacy BusType : PNPBus
Class : HIDClass
Class GUID : {745a17a0-74d3-11d0-b6fe-00a0c90f57da} (GUID_DEVCLASS_HIDCLASS)
Service : HidUsb
Enumerator : USB
Location Info : Port_#0007.Hub_#0003
Location IDs : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(1)#USB(7), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS01)#USB(7)
Container ID : {6e65bcf5-f762-11f0-9e63-00d86140c24c}
Manufacturer Info : (Periferiche standard di sistema)
Capabilities : 0x84 (Removable, SurpriseRemovalOK)
Status : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code : 0
HcDisableSelectiveSuspend: 0
EnableSelectiveSuspend : 0
SelectiveSuspendEnabled : 0
EnhancedPowerMgmtEnabled : 1
IdleInWorkingState : 0
WakeFromSleepState : 0
Power State : D0 (supported: D0, D2, D3, wake from D0, wake from D2)
Child Device 1 : Dispositivo compatibile HID definito da fornitore
Device Path : \\?\HID#VID_04D8&PID_FC00#7&1e243a90&4&0000#{4d1e55b2-f16f-11cf-88cb-001111000030} (GUID_DEVINTERFACE_HID)
Kernel Name : \Device\00000106
Device ID : HID\VID_04D8&PID_FC00\7&1E243A90&4&0000
Class : HIDClass
Driver KeyName : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0019 (GUID_DEVCLASS_HIDCLASS)
+++++++++++++++++ Registry USB Flags +++++++++++++++++
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\04D8FC000001
osvc : REG_BINARY 00 00
---------------- Connection Information ---------------
Connection Index : 0x07 (Port 7)
Connection Status : 0x01 (DeviceConnected)
Current Config Value : 0x01 (Configuration 1)
Device Address : 0x25 (37)
Is Hub : 0x00 (no)
Device Bus Speed : 0x01 (Full-Speed)
Number Of Open Pipes : 0x02 (2 pipes to data endpoints)
Pipe[0] : EndpointID=1 Direction=IN ScheduleOffset=0 Type=Interrupt
Pipe[1] : EndpointID=1 Direction=OUT ScheduleOffset=0 Type=Bulk
Data (HexDump) : 07 00 00 00 12 01 00 02 00 00 00 08 D8 04 00 FC ................
01 00 01 02 00 01 01 01 00 25 00 02 00 00 00 01 .........%......
00 00 00 07 05 81 03 40 00 01 00 00 00 00 07 05 .......@........
01 02 40 00 01 00 00 00 00 ..@......
--------------- Connection Information V2 -------------
Connection Index : 0x07 (7)
Length : 0x10 (16 bytes)
SupportedUsbProtocols : 0x03
Usb110 : 1 (yes, port supports USB 1.1)
Usb200 : 1 (yes, port supports USB 2.0)
Usb300 : 0 (no, port not supports USB 3.0)
ReservedMBZ : 0x00
Flags : 0x00
DevIsOpAtSsOrHigher : 0 (Device is not operating at SuperSpeed or higher)
DevIsSsCapOrHigher : 0 (Device is not SuperSpeed capable or higher)
DevIsOpAtSsPlusOrHigher : 0 (Device is not operating at SuperSpeedPlus or higher)
DevIsSsPlusCapOrHigher : 0 (Device is not SuperSpeedPlus capable or higher)
ReservedMBZ : 0x00
Data (HexDump) : 07 00 00 00 10 00 00 00 03 00 00 00 00 00 00 00 ................
---------------------- Device Descriptor ----------------------
bLength : 0x12 (18 bytes)
bDescriptorType : 0x01 (Device Descriptor)
bcdUSB : 0x200 (USB Version 2.00) -> wrong, device is Full-Speed only
bDeviceClass : 0x00 (defined by the interface descriptors)
bDeviceSubClass : 0x00
bDeviceProtocol : 0x00
bMaxPacketSize0 : 0x08 (8 bytes)
idVendor : 0x04D8 (Microchip Technology Inc.)
idProduct : 0xFC00
bcdDevice : 0x0001
iManufacturer : 0x01 (String Descriptor 1)
Language 0x0409 : "LEM Elettronica °"
iProduct : 0x02 (String Descriptor 2)
Language 0x0409 : "DSP35evo °"
iSerialNumber : 0x00 (No String Descriptor)
bNumConfigurations : 0x01 (1 Configuration)
Data (HexDump) : 12 01 00 02 00 00 00 08 D8 04 00 FC 01 00 01 02 ................
00 01 ..
------------------ Configuration Descriptor -------------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x02 (Configuration Descriptor)
wTotalLength : 0x0029 (41 bytes)
bNumInterfaces : 0x01 (1 Interface)
bConfigurationValue : 0x01 (Configuration 1)
iConfiguration : 0x00 (No String Descriptor)
bmAttributes : 0xC0
D7: Reserved, set 1 : 0x01
D6: Self Powered : 0x01 (yes)
D5: Remote Wakeup : 0x00 (no)
D4..0: Reserved, set 0 : 0x00
MaxPower : 0x32 (100 mA)
Data (HexDump) : 09 02 29 00 01 01 00 C0 32 09 04 00 00 02 03 00 ..).....2.......
00 00 09 21 01 01 00 01 22 21 00 07 05 81 03 40 ...!...."!.....@
00 01 07 05 01 02 40 00 01 ......@..
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x00
bAlternateSetting : 0x00
bNumEndpoints : 0x02 (2 Endpoints)
bInterfaceClass : 0x03 (HID - Human Interface Device)
bInterfaceSubClass : 0x00 (None)
bInterfaceProtocol : 0x00 (None)
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 00 00 02 03 00 00 00 .........
------------------- HID Descriptor --------------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x21 (HID Descriptor)
bcdHID : 0x0101 (HID Version 1.01)
bCountryCode : 0x00 (00 = not localized)
bNumDescriptors : 0x01
Data (HexDump) : 09 21 01 01 00 01 22 21 00 .!...."!.
Descriptor 1:
bDescriptorType : 0x22 (Class=Report)
wDescriptorLength : 0x0021 (33 bytes)
Error reading descriptor : ERROR_GEN_FAILURE (due to a obscure limitation of the Win32 USB API, see UsbTreeView.txt)
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x81 (Direction=IN EndpointID=1)
bmAttributes : 0x03 (TransferType=Interrupt)
wMaxPacketSize : 0x0040 (64 bytes)
bInterval : 0x01 (1 ms)
Data (HexDump) : 07 05 81 03 40 00 01 ....@..
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x01 (Direction=OUT EndpointID=1)
bmAttributes : 0x02 (TransferType=Bulk)
wMaxPacketSize : 0x0040 (64 bytes)
bInterval : 0x01 (ignored)
Data (HexDump) : 07 05 01 02 40 00 01 ....@..
----------------- Device Qualifier Descriptor -----------------
Error : ERROR_GEN_FAILURE
-------------------- String Descriptors -------------------
------ String Descriptor 0 ------
bLength : 0x04 (4 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language ID[0] : 0x0409 (English - United States)
Data (HexDump) : 04 03 09 04 ....
------ String Descriptor 1 ------
bLength : 0x22 (34 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "LEM Elettronica °" *!*ERROR contains 1 NULL character
Data (HexDump) : 22 03 4C 00 45 00 4D 00 20 00 45 00 6C 00 65 00 ".L.E.M. .E.l.e.
74 00 74 00 72 00 6F 00 6E 00 69 00 63 00 61 00 t.t.r.o.n.i.c.a.
20 00 .
------ String Descriptor 2 ------
bLength : 0x22 (34 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "DSP35evo °" *!*ERROR contains 1 NULL character
Data (HexDump) : 22 03 44 00 53 00 50 00 33 00 35 00 65 00 76 00 ".D.S.P.3.5.e.v.
6F 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 o. . . . . . . .
20 00 .Obviously I've tried to set both as INTERRUPT for STM32C071 also, but Windows (and Android too) doesn't work this way (honestly I don't known why).
The flutter app recognizes the STM32C071 device correctly, both Windows and Android. Windows data exchange works correctly, Android doesn't.
Which USB Analyzer do you suggest to check the Android-STM32 traffic? I haven't experience on it :-((