- =========================== USB Port13 ===========================
- Connection Status : 0x00 (No device is connected)
- Port Chain : 2-13
- Properties : 0x01
- IsUserConnectable : yes
- PortIsDebugCapable : no
- PortHasMultiCompanions : no
- PortConnectorIsTypeC : no
- ConnectionIndex : 0x0D (Port 13)
- CompanionIndex : 0
- CompanionHubSymLnk : USB#ROOT_HUB30#5&178f6c5f&0&0#{f18a0e88-c30c-11d0-8815-00a0c906bed8}
- CompanionPortNumber : 0x05 (Port 5)
- -> CompanionPortChain : 2-5
- ========================== Summary =========================
- Vendor ID : 0x1234 (Micro Science Co., Ltd.)
- Product ID : 0x5678
- USB Version : 2.0 -> but Device is Full-Speed only
- Port maximum Speed : High-Speed (Companion Port 2-5 supports SuperSpeed)
- Device maximum Speed : Full-Speed
- Device Connection Speed : Full-Speed
- Device Manager Problem : 10 (CM_PROB_FAILED_START)
- Used Endpoints : 1
- ======================== USB Device ========================
- +++++++++++++++++ Device Information ++++++++++++++++++
- Device Description : USB Composite Device
- Device ID : USB\VID_1234&PID_5678\123456
- Hardware IDs : USB\VID_1234&PID_5678&REV_0101 USB\VID_1234&PID_5678
- Driver KeyName : {36fc9e60-c465-11cf-8056-444553540000}\0011 (GUID_DEVCLASS_USB)
- Driver : \SystemRoot\System32\drivers\usbccgp.sys (Version: 10.0.22000.1 Date: 2021-06-05)
- Driver Inf : C:\WINDOWS\inf\usb.inf
- Legacy BusType : PNPBus
- Class : USB
- Class GUID : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
- Service : usbccgp
- Enumerator : USB
- PDO : \Device\USBPDO-3
- Location Info : Port_#0013.Hub_#0001
- Manufacturer Info : (Standard USB Host Controller)
- Capabilities : 0x14 (Removable, UniqueID)
- Status : 0x01806400 (DN_HAS_PROBLEM, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
- Problem Code : 10 (CM_PROB_FAILED_START)
- Address : 13
- HcDisableSelectiveSuspend: 0
- EnableSelectiveSuspend : 0
- SelectiveSuspendEnabled : 0
- EnhancedPowerMgmtEnabled : 0
- IdleInWorkingState : 0
- WakeFromSleepState : 0
- Power State : D3 (supported: D0, D3, wake from D0)
- +++++++++++++++++ Registry USB Flags +++++++++++++++++
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\123456780101
- osvc : REG_BINARY 00 00
- ---------------- Connection Information ---------------
- Connection Index : 0x0D (Port 13)
- Connection Status : 0x00 (NoDeviceConnected)
- Current Config Value : 0x00 (Configuration 0)
- Device Address : 0x30 (48)
- Is Hub : 0x00 (no)
- Device Bus Speed : 0x01 (Full-Speed)
- Number Of Open Pipes : 0x00 (0 pipes to data endpoints)
- Data (HexDump) : 0D 00 00 00 12 01 00 02 EF 02 01 40 34 12 78 56 ...........@4.xV
- 01 01 01 02 03 01 00 01 00 30 00 00 00 00 00 00 .........0......
- 00 00 00 ...
- --------------- Connection Information V2 -------------
- Connection Index : 0x0D (13)
- 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) -> but Companion Port 2-5 does
- 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) : 0D 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.0) -> but device is Full-Speed only
- bDeviceClass : 0xEF (Miscellaneous)
- bDeviceSubClass : 0x02
- bDeviceProtocol : 0x01 (IAD - Interface Association Descriptor)
- bMaxPacketSize0 : 0x40 (64 bytes)
- idVendor : 0x1234 (Micro Science Co., Ltd.)
- idProduct : 0x5678
- bcdDevice : 0x0101
- iManufacturer : 0x01 (String Descriptor 1)
- iProduct : 0x02 (String Descriptor 2)
- iSerialNumber : 0x03 (String Descriptor 3)
- bNumConfigurations : 0x01 (1 Configuration)
- Data (HexDump) : 12 01 00 02 EF 02 01 40 34 12 78 56 01 01 01 02 .......@4.xV....
- 03 01 ..
- ----------------- Device Qualifier Descriptor -----------------
- Error : ERROR_GEN_FAILURE (because the device has problem code CM_PROB_FAILED_START)
- -------------------- String Descriptors -------------------
- String descriptors are not available (because the device has problem code CM_PROB_FAILED_START)
I am trying to implement Ethernet over USB so I can control my board with TCP/IP
I am going to connect from Windows machine so I thought RNDIS or NCM will be suitable.
I followed lots of Tinyusb example as well as ESP-IDF's implementation.
So, I created following code for to create USB Ethernet first but Windows is saying that its "This device cannot start. (Code 10)"
I also did pretty same implementation for ECM, just changing define and configuration_descriptor but no good
I am using VSCode + ESP-IDF v5.0-beta1
Can someone tell me what am I doing wrong?
Thank you.
- #define CFG_TUD_ECM_RNDIS 1
- #include <stdlib.h>
- #include "esp_log.h"
- #include "driver/gpio.h"
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "tinyusb.h"
- #include "sdkconfig.h"
- #include "class/net/net_device.h"
- static const char *TAG = "example";
- #define MAIN_CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_RNDIS_DESC_LEN)
- #define ALT_CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_ECM_DESC_LEN)
- #define NCM_CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_NCM_DESC_LEN)
- #define EPNUM_NET_NOTIF 0x81
- #define EPNUM_NET_OUT 0x02
- #define EPNUM_NET_IN 0x82
- // String Descriptor Index
- enum
- {
- STRID_LANGID = 0,
- STRID_MANUFACTURER,
- STRID_PRODUCT,
- STRID_SERIAL,
- STRID_INTERFACE,
- STRID_MAC
- };
- enum
- {
- ITF_NUM_CDC = 0,
- ITF_NUM_CDC_DATA,
- ITF_NUM_TOTAL
- };
- enum
- {
- CONFIG_ID_RNDIS = 0,
- CONFIG_ID_COUNT
- };
- tusb_desc_device_t const desc_device =
- {
- .bLength = sizeof(tusb_desc_device_t),
- .bDescriptorType = TUSB_DESC_DEVICE,
- .bcdUSB = 0x0200,
- // Use Interface Association Descriptor (IAD) device class
- .bDeviceClass = TUSB_CLASS_MISC,
- .bDeviceSubClass = MISC_SUBCLASS_COMMON,
- .bDeviceProtocol = MISC_PROTOCOL_IAD,
- .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
- .idVendor = 0x1234,
- .idProduct = 0x5678,
- .bcdDevice = 0x0101,
- .iManufacturer = STRID_MANUFACTURER,
- .iProduct = STRID_PRODUCT,
- .iSerialNumber = STRID_SERIAL,
- .bNumConfigurations = CONFIG_ID_COUNT // multiple configurations
- };
- tusb_desc_strarray_device_t my_string_descriptor = {
- [STRID_LANGID] = (const char[]) { 0x09, 0x04 }, // supported language is English (0x0409)
- [STRID_MANUFACTURER] = "TinyUSB", // Manufacturer
- [STRID_PRODUCT] = "TinyUSB Device", // Product
- [STRID_SERIAL] = "123456", // Serial
- [STRID_INTERFACE] = "TinyUSB Network Interface" // Interface Description
- };
- uint8_t const * tud_rndis_descriptor_device_cb(void)
- {
- return (uint8_t const *) &desc_device;
- }
- static uint8_t const rndis_configuration[] =
- {
- // Config number (index+1), interface count, string index, total length, attribute, power in mA
- TUD_CONFIG_DESCRIPTOR(CONFIG_ID_RNDIS+1, ITF_NUM_TOTAL, 0, MAIN_CONFIG_TOTAL_LEN, 0, 100),
- // Interface number, string index, EP notification address and size, EP data address (out, in) and size.
- TUD_RNDIS_DESCRIPTOR(ITF_NUM_CDC, STRID_INTERFACE, EPNUM_NET_NOTIF, 8, EPNUM_NET_OUT, EPNUM_NET_IN, CFG_TUD_NET_ENDPOINT_SIZE),
- };
- void app_main(void)
- {
- ESP_LOGI(TAG, "USB initialization");
- const tinyusb_config_t tusb_cfg = {
- .descriptor = &desc_device,
- .string_descriptor = my_string_descriptor,
- .external_phy = false,
- .configuration_descriptor = rndis_configuration,
- };
- ESP_ERROR_CHECK(tinyusb_driver_install(&tusb_cfg));
- ESP_LOGI(TAG, "USB initialization DONE");
- }