Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve stress resistance #18

Merged
merged 10 commits into from
Feb 24, 2025
Merged

Improve stress resistance #18

merged 10 commits into from
Feb 24, 2025

Conversation

kauwua
Copy link
Collaborator

@kauwua kauwua commented Feb 24, 2025

Hydradancer sets the endpoints status to NAK while sending data to Facedancer, to avoid buffering packets (which means Facedancer is in sync with the USB2 controller).

I was setting the data toggles in advance (after each successful transfer), thinking the NAK status on the endpoint was enough to prevent the controller from saving data.

Since I was having issues with duplicated data/weird buffers (correct transfer length but wrong data, too much or too little data), I created a test test_usb_stress_test_delayed which reproduces the delayed change of endpoint status to ACK with a timer and was able to reproduce the issue.

Turns out, not setting the toggle in advance worked and seemingly keeps the USB2 controller from messing up its internal FIFO. Setting NAK on the endpoint should have been enough but that's not how it works apparently.

I've been able to delay each OUT transfer in the stress test by 1ms, which confirmed this works and also fixed the issue in Hydradancer.

@kauwua kauwua merged commit 3b056b5 into main Feb 24, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant