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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃[BUG] First RX fails with bits shifted by one. #97

Open
tannewt opened this issue Aug 1, 2023 · 1 comment
Open

馃[BUG] First RX fails with bits shifted by one. #97

tannewt opened this issue Aug 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@tannewt
Copy link
Contributor

tannewt commented Aug 1, 2023

Describe the bug you encountered:

The capture of the response to the very first setup packet fails. I think this is the very first time anything is captured by the RX PIO. Maybe its initial state is incorrect?

What did you expect to happen instead?

The RX PIO should capture the SYNC and ACK packets (0x80 and 0xd2).

What actually happened in your case?

Instead, it errors because it captured 0x01 and 0xa5. Note that this is (0xd2 << 1 | 1).

Additional information

This is using USB Host via CircuitPython for testing. However, this is low level enough that I don't think it's the issue. Subsequent ACKs are captured correctly.

Serial console setup       << Start of CircuitPython
Get 8 byte of Device Descriptor
ctrl xfer 0x20009f58 cb 0x1009b471 << TinyUSB control transfer for getting device desc
setup send 06
pio SETUP error 202 01 a5 delay 0  << Errors due to not matching SYNC and ACK
pio error
Enumeration attempt 1 failed 1 << TinyUSB fails
ctrl xfer 0x20009f58 cb 0x1009b471 << Tries again
setup send 06
pio SETUP ok 33e 80 d2 << Captures ACK correctly
ctrl setup 00 00
[1:0] Control data len 8
Set Address = 1 << Set address works ok too
ctrl xfer 0x0 cb 0x1009b471
setup send 05
pio SETUP ok 3ed 80 d2

This causes issues when using a device running TinyUSB because it can't handle two SETUP packets in a row. It (currently) expects to finish the first control transaction before the second setup packet.

@tannewt tannewt added the bug Something isn't working label Aug 1, 2023
@tannewt
Copy link
Contributor Author

tannewt commented Aug 1, 2023

Also, I've used a Saleae to verify that the data on the wire looks correct. I did have to add a small glitch filter so that could be the problem. However, I'd expect signal integrity to cause other ACK reads to fail too and it doesn't seem to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant