TRANSFER_ERROR hid-host: Transfer failed, status 1 (IDFGH-15326)
Answers checklist.
- [x] I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- [x] I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- [x] I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
Problem. Macro 3 button plus dial keyboard disconnects at roughly 30-seconds. Unplug and reconnect works. Full keyboard does NOT do this. 3 Button keyboard is fine on windows etc. Issue will occur without any interaction.
Setup I have a generic esp32-s3 with soldered USB-OTG pads for VBUS power and am running generic hide_host_example.c
Error output ccccccccce is keyboard testing to prove working
Keyboard
ccccccccE (19944) hid-host: Transfer failed, status 1
E (19944) example: Transfer Error at 19 seconds, after 34 reports
E (19944) example: HID Device, protocol 'KEYBOARD' TRANSFER_ERROR
E (19954) hid-host: hid_host_interface_release_and_free_transfer(604): Unable to release HID Interface
E (19964) hid-host: hid_host_device_close(1213): Unable to release HID Interface
E (19964) hid-host: Transfer failed, status 1
E (19974) example: Transfer Error at 19 seconds, after 34 reports
E (19974) example: HID Device, protocol 'NONE' TRANSFER_ERROR
E (19984) hid-host: hid_host_interface_release_and_free_transfer(604): Unable to release HID Interface
E (19994) hid-host: hid_host_device_close(1213): Unable to release HID Interface
E (19994) hid-host: Transfer failed, status 1
E (20004) example: Transfer Error at 19 seconds, after 34 reports
E (20004) example: HID Device, protocol 'MOUSE' TRANSFER_ERROR
E (20014) hid-host: hid_host_interface_release_and_free_transfer(604): Unable to release HID Interface
E (20024) hid-host: hid_host_device_close(1213): Unable to release HID Interface
Solution
I am not sure if there is a solution but this seems a strange issue. I am hoping these is something basic I am missing.
The code is fundamentally the generic code - I have tested all manner of error catching only.
Hi @audas sorry for a late reply.
- Are you using an esp32s3 dev board, or any custom board? I am wondering if it could be caused by loose contacts of either power lines or D+/D- linens.
- Could you provide a device descriptor of the keyboard you are using usb_hos_lib example? Just build and flash the example, connect the keyboard and get the output log
-
Macro 3 button plus dial keyboard disconnects at roughly 30-seconds. Unplug and reconnect works
- Once you reconnect the keyboard, does the keyboard work for another 30-seconds, or does it work correctly for long period of time?
- What is the IDF version and HID Host version you are using? You can get this information for build log of the HID Host example, something like:
NOTICE: Processing 2 dependencies:
NOTICE: [1/2] espressif/usb_host_hid (1.0.3)
NOTICE: [2/2] idf (6.0.0)
Thanks Peter,
- I am using a generic cheap esp32s3 dev board from ali. As mentioned I had soldered the pads.
- Tomorrow.
- The same issue of disconnecting happens each time I unplug-replug in. The time frame feels very consistent. I tried reducing power draw from keyboard via LED off. I feel like the keyboard sleeps, stops responding etc. But it could be a power, memory thing - I have no idea.
- Tomorrow
I am a very inexperienced ESP-IDF user and amateur with only a few projects completed, so I am hesitant to take up anyones time (most likely user error somewhere). But this might be a good edge case as I can see USB HID is something being worked on more generally.
End of day here in OZ, I will follow up AM with your requests and post back. Thanks for following up.
Edit: My current solution is that this is a remote control for 3x lights with brightness colour with a battery pack. I sleep the ESP which cuts power which causes battery to cut power. Battery has a push button on off which restarts and reconnects the devices. Very hacky.
Peter - Here is the full output from a serial monitor of the device after pressing reset. After this it simply goes to sleep. I pressed the keyboard to show the responsiveness and eventual failure.
host and idf - formatting failed. Flash is further down at paragraph break between code blocks
NOTICE: [3/3] idf (5.4.1)```
**Reboot**
```ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2810,len:0x15a0
load:0x403c8700,len:0x4
load:0x403c8704,len:0xd20
load:0x403cb700,len:0x2f00
entry 0x403c8928
I (27) boot: ESP-IDF v5.4.1 2nd stage bootloader
I (27) boot: compile time May 21 2025 14:32:48
I (27) boot: Multicore bootloader
I (27) boot: chip revision: v0.2
I (30) boot: efuse block revision: v1.3
I (33) boot.esp32s3: Boot SPI Speed : 80MHz
I (37) boot.esp32s3: SPI Mode : DIO
I (41) boot.esp32s3: SPI Flash Size : 2MB
I (45) boot: Enabling RNG early entropy source...
I (49) boot: Partition Table:
I (52) boot: ## Label Usage Type ST Offset Length
I (58) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (65) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (71) boot: 2 factory factory app 00 00 00010000 00100000
I (78) boot: End of partition table
I (81) esp_image: segment 0: paddr=00010020 vaddr=3c0c0020 size=24ad4h (150228) map
I (115) esp_image: segment 1: paddr=00034afc vaddr=3fc9bb00 size=04a84h ( 19076) load
I (119) esp_image: segment 2: paddr=00039588 vaddr=40374000 size=06a90h ( 27280) load
I (125) esp_image: segment 3: paddr=00040020 vaddr=42000020 size=b1788h (726920) map
I (254) esp_image: segment 4: paddr=000f17b0 vaddr=4037aa90 size=10f98h ( 69528) load
I (270) esp_image: segment 5: paddr=00102750 vaddr=50000000 size=00018h ( 24) load
I (270) esp_image: segment 6: paddr=00102770 vaddr=600fe000 size=00100h ( 256) load
I (274) esp_image: segment 7: paddr=00102878 vaddr=600fe100 size=00020h ( 32) load
I (290) boot: Loaded app from partition at offset 0x10000
I (291) boot: Disabling RNG early entropy source...
I (303) cpu_start: Multicore app
I (312) cpu_start: Pro cpu start user code
I (312) cpu_start: cpu freq: 160000000 Hz
I (312) app_init: Application information:
I (312) app_init: Project name: Keyboard_lights_2
I (317) app_init: App version: 40f8561
I (321) app_init: Compile time: May 21 2025 14:27:23
I (326) app_init: ELF file SHA256: 514a8f0c1...
I (330) app_init: ESP-IDF: v5.4.1
I (334) efuse_init: Min chip rev: v0.0
I (338) efuse_init: Max chip rev: v0.99
I (342) efuse_init: Chip rev: v0.2
I (345) heap_init: Initializing. RAM available for dynamic allocation:
I (352) heap_init: At 3FCA4980 len 00044D90 (275 KiB): RAM
I (357) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (362) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (367) heap_init: At 600FE120 len 00001EC8 (7 KiB): RTCRAM
I (374) spi_flash: detected chip: boya
I (376) spi_flash: flash io: dio
W (379) spi_flash: Detected size(16384k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (392) sleep_gpio: Configure to isolate all GPIO pins in sleep state
I (398) sleep_gpio: Enable automatic switching of GPIO sleep configuration
I (405) main_task: Started on CPU0
I (425) main_task: Calling app_main()
I (445) hid_mqtt_light: Fresh boot or invalid RTC data. Initializing defaults.
I (445) hid_mqtt_light: Initial/Restored state: Target 0 (sams_bed_lamp), Mode Brightness
I (445) hid_mqtt_light: Light 0 (sams_bed_lamp): On=0, Bright=5, HueIdx=0
I (455) hid_mqtt_light: Light 1 (joanna_red_reading_light_light): On=0, Bright=5, HueIdx=0
I (465) hid_mqtt_light: Light 2 (bed_sam_jo_chandelier_1): On=0, Bright=5, HueIdx=0
I (465) pp: pp rom version: e7ae62f
I (475) net80211: net80211 rom version: e7ae62f
I (485) wifi:wifi driver task: 3fcaf594, prio:23, stack:6656, core=0
I (495) wifi:wifi firmware version: 79fa3f41ba
I (495) wifi:wifi certification version: v7.0
I (495) wifi:config NVS flash: enabled
I (495) wifi:config nano formatting: disabled
I (495) wifi:Init data frame dynamic rx buffer num: 32
I (505) wifi:Init static rx mgmt buffer num: 5
I (505) wifi:Init management short buffer num: 32
I (515) wifi:Init dynamic tx buffer num: 32
I (515) wifi:Init static tx FG buffer num: 2
I (515) wifi:Init static rx buffer size: 1600
I (525) wifi:Init static rx buffer num: 10
I (525) wifi:Init dynamic rx buffer num: 32
I (535) wifi_init: rx ba win: 6
I (535) wifi_init: accept mbox: 6
I (535) wifi_init: tcpip mbox: 32
I (535) wifi_init: udp mbox: 6
I (545) wifi_init: tcp mbox: 6
I (545) wifi_init: tcp tx win: 5760
I (545) wifi_init: tcp rx win: 5760
I (555) wifi_init: tcp mss: 1440
I (555) wifi_init: WiFi IRAM OP enabled
I (555) wifi_init: WiFi RX IRAM OP enabled
W (565) wifi:Password length matches WPA2 standards, authmode threshold changes from OPEN to WPA2
I (575) phy_init: phy_version 700,8582a7fd,Feb 10 2025,20:13:11
I (615) phy_init: Saving new calibration data due to checksum failure or outdated calibration data, mode(0)
I (635) wifi:mode : sta (30:ed:a0:1f:0d:d4)
I (635) wifi:enable tsf
I (635) hid_mqtt_light: wifi_init_sta finished. Connecting to AP...
I (635) hid_mqtt_light: WIFI_EVENT_STA_START, connecting...
I (645) hid_mqtt_light: Installing USB Host...
I (645) wifi:new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1, snd_ch_cfg:0x0
I (655) wifi:state: init -> auth (0xb0)
I (675) hid_mqtt_light: USB Host installed.
I (675) hid_mqtt_light: Installing HID Host driver...
I (675) hid_mqtt_light: HID Host driver installed.
I (675) wifi:state: auth -> assoc (0x0)
I (675) hid_mqtt_light: Application started. Waiting for HID Device connection or events...
I (685) wifi:state: assoc -> run (0x10)
I (755) wifi:connected with Aussie Broadband 8729, aid = 48, channel 6, BW20, bssid = d0:db:b7:9f:56:a8
I (755) wifi:security: WPA2-PSK, phy: bgn, rssi: -50
I (765) wifi:pm start, type: 1
I (765) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (775) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (785) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (815) wifi:<ba-add>idx:0 (ifx:0, d0:db:b7:9f:56:a8), tid:0, ssn:0, winSize:64
I (1055) hid_mqtt_light: HID Device CONNECTED (Driver Event): Protocol 1 Subclass 1
I (1055) hid_mqtt_light: HID device started successfully.
I (1055) hid_mqtt_light: HID Device CONNECTED (Driver Event): Protocol 0 Subclass 0
W (1065) hid_mqtt_light: Keyboard report too short (0 bytes)
W (1065) hid_mqtt_light: Ignoring connected HID device - not a Boot Protocol Keyboard.
I (1075) hid_mqtt_light: HID Device CONNECTED (Driver Event): Protocol 2 Subclass 1
W (1085) hid_mqtt_light: Ignoring connected HID device - not a Boot Protocol Keyboard.
I (1855) esp_netif_handlers: sta ip
I (1855) hid_mqtt_light: Got IP:
I (1855) hid_mqtt_light: Other event id:7
I (1915) hid_mqtt_light: MQTT_EVENT_CONNECTED
I (4235) hid_mqtt_light: Key pressed: c
I (4235) hid_mqtt_light: Light bed_sam_jo_chandelier_1 turned ON.
I (4235) hid_mqtt_light: publish_light_state: WiFi has IP: YES, MQTT Globally Connected: YES
I (4245) hid_mqtt_light: Publishing to homeassistant/light/remote: {"target_light":"bed_sam_jo_chandelier_1","state":"ON","brightness":128,"color_temp":2200,"xy_color":[0.53032141923904419,0.41342452168464661]}
I (4265) hid_mqtt_light: Current Target: bed_sam_jo_chandelier_1
I (4315) hid_mqtt_light: MQTT_EVENT_PUBLISHED, msg_id=10240
I (8865) hid_mqtt_light: Key pressed: c
I (8865) hid_mqtt_light: Light bed_sam_jo_chandelier_1 turned OFF.
I (8865) hid_mqtt_light: publish_light_state: WiFi has IP: YES, MQTT Globally Connected: YES
I (8875) hid_mqtt_light: Publishing to homeassistant/light/remote: {"target_light":"bed_sam_jo_chandelier_1","state":"OFF"}
I (8885) hid_mqtt_light: Current Target: bed_sam_jo_chandelier_1
I (8925) hid_mqtt_light: MQTT_EVENT_PUBLISHED, msg_id=13249
I (11895) hid_mqtt_light: Key pressed: c
I (11895) hid_mqtt_light: Light bed_sam_jo_chandelier_1 turned ON.
I (11895) hid_mqtt_light: publish_light_state: WiFi has IP: YES, MQTT Globally Connected: YES
I (11905) hid_mqtt_light: Publishing to homeassistant/light/remote: {"target_light":"bed_sam_jo_chandelier_1","state":"ON","brightness":128,"color_temp":2200,"xy_color":[0.53032141923904419,0.41342452168464661]}
I (11925) hid_mqtt_light: Current Target: bed_sam_jo_chandelier_1
I (11955) hid_mqtt_light: MQTT_EVENT_PUBLISHED, msg_id=21585
I (15175) hid_mqtt_light: Key pressed: c
I (15175) hid_mqtt_light: Light bed_sam_jo_chandelier_1 turned OFF.
I (15175) hid_mqtt_light: publish_light_state: WiFi has IP: YES, MQTT Globally Connected: YES
I (15185) hid_mqtt_light: Publishing to homeassistant/light/remote: {"target_light":"bed_sam_jo_chandelier_1","state":"OFF"}
I (15195) hid_mqtt_light: Current Target: bed_sam_jo_chandelier_1
I (15215) hid_mqtt_light: MQTT_EVENT_PUBLISHED, msg_id=9400
I (17685) hid_mqtt_light: Key pressed: c
I (17685) hid_mqtt_light: Light bed_sam_jo_chandelier_1 turned ON.
I (17685) hid_mqtt_light: publish_light_state: WiFi has IP: YES, MQTT Globally Connected: YES
I (17695) hid_mqtt_light: Publishing to homeassistant/light/remote: {"target_light":"bed_sam_jo_chandelier_1","state":"ON","brightness":128,"color_temp":2200,"xy_color":[0.53032141923904419,0.41342452168464661]}
I (17715) hid_mqtt_light: Current Target: bed_sam_jo_chandelier_1
I (17735) hid_mqtt_light: MQTT_EVENT_PUBLISHED, msg_id=40016
I (20825) hid_mqtt_light: Key pressed: c
I (20825) hid_mqtt_light: Light bed_sam_jo_chandelier_1 turned OFF.
I (20825) hid_mqtt_light: publish_light_state: WiFi has IP: YES, MQTT Globally Connected: YES
I (20825) hid_mqtt_light: Publishing to homeassistant/light/remote: {"target_light":"bed_sam_jo_chandelier_1","state":"OFF"}
I (20845) hid_mqtt_light: Current Target: bed_sam_jo_chandelier_1
I (20855) hid_mqtt_light: MQTT_EVENT_PUBLISHED, msg_id=42843
I (23735) hid_mqtt_light: Key pressed: c
I (23735) hid_mqtt_light: Light bed_sam_jo_chandelier_1 turned ON.
I (23735) hid_mqtt_light: publish_light_state: WiFi has IP: YES, MQTT Globally Connected: YES
I (23745) hid_mqtt_light: Publishing to homeassistant/light/remote: {"target_light":"bed_sam_jo_chandelier_1","state":"ON","brightness":128,"color_temp":2200,"xy_color":[0.53032141923904419,0.41342452168464661]}
I (23765) hid_mqtt_light: Current Target: bed_sam_jo_chandelier_1
I (23775) hid_mqtt_light: MQTT_EVENT_PUBLISHED, msg_id=7310
E (24995) hid-host: Transfer failed, status 1
W (24995) hid_mqtt_light: HID Device, Protocol '1' TRANSFER_ERROR
E (25045) hid-host: hid_host_interface_release_and_free_transfer(604): Unable to release HID Interface
E (25045) hid-host: hid_host_device_close(1213): Unable to release HID Interface
E (25045) hid_mqtt_light: Failed to close device on transfer error: ESP_ERR_INVALID_STATE````
**Flash - anything I found relevant. I am unsure of the " device descriptor " and think I may have failed to provide it here.**
```I (685) hid_mqtt_light: Installing USB Host...
I (725) hid_mqtt_light: USB Host installed.
I (725) hid_mqtt_light: Installing HID Host driver...
I (725) hid_mqtt_light: HID Host driver installed.
I (725) hid_mqtt_light: Application started. Waiting for HID Device connection or events...
I (755) wifi:new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1, snd_ch_cfg:0x0
I (755) wifi:state: init -> auth (0xb0)
I (765) wifi:state: auth -> assoc (0x0)
I (795) wifi:state: assoc -> run (0x10)
I (1045) wifi:connected with Aussie Broadband 8729, aid = 47, channel 6, BW20, bssid = d0:db:b7:9f:56:a8
I (1055) wifi:security: WPA2-PSK, phy: bgn, rssi: -62
I (1055) wifi:pm start, type: 1
I (1055) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (1065) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (1075) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (1115) hid_mqtt_light: HID Device CONNECTED (Driver Event): Protocol 1 Subclass 1
I (1115) hid_mqtt_light: HID device started successfully.
I (1115) hid_mqtt_light: HID Device CONNECTED (Driver Event): Protocol 0 Subclass 0
I (1115) wifi:<ba-add>idx:0 (ifx:0, d0:db:b7:9f:56:a8), tid:0, ssn:0, winSize:64
I (1125) hid_mqtt_light: Key pressed: d
I (1135) hid_mqtt_light: Light 0 (sams_bed_lamp): Brightness 4, Hue Index 0
W (1135) hid_mqtt_light: Ignoring connected HID device - not a Boot Protocol Keyboard.
I (1145) hid_mqtt_light: HID Device CONNECTED (Driver Event): Protocol 2 Subclass 1
W (1155) hid_mqtt_light: Ignoring connected HID device - not a Boot Protocol Keyboard.
I (2195) esp_netif_handlers: sta ip:
I (2195) hid_mqtt_light: Got IP:
I (2195) hid_mqtt_light: Other event id:7
I (4005) hid_mqtt_light: MQTT_EVENT_CONNECTED
E (11785) hid-host: Transfer failed, status 1
W (11785) hid_mqtt_light: HID Device, Protocol '1' TRANSFER_ERROR
E (11835) hid-host: hid_host_interface_release_and_free_transfer(604): Unable to release HID Interface
E (11835) hid-host: hid_host_device_close(1213): Unable to release HID Interface
E (11835) hid_mqtt_light: Failed to close device on transfer error: ESP_ERR_INVALID_STATE```
I am using a generic cheap esp32s3 dev board from ali. As mentioned I had soldered the pads.
Can you please provide the board you are using? It might be possible, that the keyboard is drawing too much power but the dev board can't deliver the current.
How are you powering the dev board? You mentioned battery powered solution. Does the board work when powered from a stable power supply (a USB power from a PC)
From where is the Keyboard powered, directly from the voltage coming to the doev board, or is there any LDO or DC-DC in between?
Do you have a possibility to connect a powered external hub in between the dev board and the Keyboard? So we can eliminate power related issues?
Thanks for providing the log, but it's a log from you app, which is unfortunately not very helpful. I wanted to have a look at the device descritptor, which is obtained using the usb_host_lib example I provided earlier. Or you can get the device decritptor by connecting the keyboard to a PC using lsusb command on Linux.
Hi @audas any update on this issue?
Away from desk ATM. But will get that info. I have tried the board/keyboard powered from computer, USB, and USB hub self powered. Spent most time focused on this. I will get your requested info tomorrow.
@audas could you share your application code so we can have a better look?
Closing this issue due to inactivity and difficulty in reproducing it. Please feel free to reopen if you have additional details or further questions.