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

da146xx usb complience #1146

Merged
merged 2 commits into from
Oct 17, 2021
Merged

Conversation

kasjer
Copy link
Collaborator

@kasjer kasjer commented Oct 15, 2021

Describe the PR
This resolves to problems that prevent USB3CV compliance test to pass for DA146xx devices.

  • interrupt for EP IN STALL send notification was filling TXFIFO with ZLP that resulted in first command
    wrong response after endpoint was un-stalled.
  • If more data arrived in RX FIFO then were scheduled for reception in dcd_edpt_xfer(), extra bytes were
    left for next read. It resulted in compliance test failure for MSC device.

Now TX FIFO is not filled for stalled endpoint and extra (unexpected) bytes from RX FIFO are dropped.

Additional context
Follow up on #1101 and #1059

Normal TX handler for IN non-0 endpoints is called during
outgoing transfer or just after it was finished.
It may need to fill TX fifo with same data if TX_DONE is present
but ACK_STAT is not.
It may need to fill more data when called during transfer.
But it may also be called when STALL was sent.
In this case TX_DONE is set ACK_STAT is not, just like for packets
that were sent but no ACK was received.
Code was trying to send something again. There was nothing to send
so empty ZLP was scheduled for stalled endpoint.
This ZLP was later send to host where valid response was required.

This change checks if notification was for STALL endpoint and
does not try to fill TX FIFO in that case.
USB3CV tool verifies MSC device by sending too short or
too long packets.
In case of too long packets (msc_device requested 31 bytes
but incoming data had 32 bytes) extra byte(s) were left in
FIFO resulting in some data mismatch later on.

Now if more data is received in packet that expected extra
bytes are just dropped.
@kasjer
Copy link
Collaborator Author

kasjer commented Oct 15, 2021

Here are test results:
This time Chapter 9 tests were run on HID with remote wake up tested.
USB3CV.zip

For reference behavior I used STM32F407 board that was working as test expected.
For some reason when MSC tests were run on PCA10056 it was failing almost all tests I'm not sure if this was just my board or some regression snicked in. I used Preview DK which does not have final chip version. With DK all works well.

Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are test results: This time Chapter 9 tests were run on HID with remote wake up tested. USB3CV.zip

Superb !! great effort to get DA146xx fully passed the USBCV.

For reference behavior I used STM32F407 board that was working as test expected. For some reason when MSC tests were run on PCA10056 it was failing almost all tests I'm not sure if this was just my board or some regression snicked in. I used Preview DK which does not have final chip version. With DK all works well.

yeah, the PDK USB is unusable.

@hathach hathach merged commit 4cecd4e into hathach:master Oct 17, 2021
@kasjer kasjer deleted the kasjer/da146xx-usb-complience branch October 17, 2021 20:32
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.

None yet

2 participants