Repository navigation
feat(usb_host): Fix hw fifo sizing with bias for periodic OUT - #613
Merged
peter-marcisovsky merged 1 commit intoOct 7, 2026
Merged
Conversation
- Fixing RXFIFO extra lines for status quadlest when the bias is set to periodic OUT
- DWC Guide specifies +2 FIFO lines for status quadlest
- This was tested not to be enough and +3 lines are required istead
- A device with 512 byte IN EP never completes it's transfer otherwise
- fixing espressif/esp-idf#19143
tore-espressif
approved these changes
Oct 7, 2026
peter-marcisovsky
deleted the
fix/usb_host_hw_fifo_sizing_status_quadlets
branch
October 7, 2026 08:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related
Testing
Testing esp-idf HID Host and Device examples, with a custom TinyUSB Device with following descriptor:
Device descriptor
CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUTbiaspipe_alloc_hcd_support_verification()but the IN transfer wold never complete.Buffer DMA formula
The DWC Programming guide specifies a formula for Buffer DMA only, in chapter
2.1.2.1which is roughly the:2 * ((Largest Packet size / 4) + 1 + 1) + n, where the n is number of non periodic channels used.FYI: For SG DMA, there is the same formula but the
+ nparameter is missing.Applying this formula in SG DMA mode was proven not to be valid. More Non perodic channels in use did not require any extra RXFIFO lines. Which prove the formula is really Buffer DMA only.
Checklist
Before submitting a Pull Request, please ensure the following:
Note
Medium Risk
Changes DWC2 host FIFO layout for one menuconfig bias; wrong sizing can break IN traffic, but other bias modes and custom FIFO configs are unchanged.
Overview
Fixes interrupt-IN transfers that never complete when the host uses
CONFIG_USB_HOST_HW_BUFFER_BIAS_PERIODIC_OUT, by reserving three RX FIFO lines for GRXSTSP status quadlets instead of two.In
_calculate_fifo_from_bias(), the periodic-OUT bias now setsrx_fifo_linestoD/8 + 3(default 3, overridable viaUSB_DWC_HAL_RX_FIFO_STATUS_LINES), and shrinks the periodic TX FIFO by one line accordingly. Kconfig help for “Bias Periodic OUT” documents the +3 requirement and the 512-byte interrupt-IN failure seen with +2.Reviewed by Cursor Bugbot for commit 2b4ca06. Bugbot is set up for automated code reviews on this repo. Configure here.