lowRISC / lowRISC/opentitan

[usbdev] prim_cdc_rand_delay induces sampling errors with usb_fs_rx

Open
#23,839 3 comments 0 reactions 2 assignees View on GitHub

@alees24 is already working on this.

Since Jun 27, 2024.

Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

Description

The CDC modeling in prim_cdc_rand_delay has a massive impact upon the ability of the usbdev IP block (specifically the logic in usb_fs_rx) to sample the input data correctly, whether or not the external differential receiver is utilized. Even a small difference between the host and device frequency will lead to long OUT DATA packets being rejected with CRC16 mismatch, and a substantial frequency difference can readily lead to even SOF packets being mis-sampled as the usbdev receiver logic tries to accommodate a frequency mismatch but is actually responding to the variable delay on the DP and DN inputs to the logic.

This impacts non-differential reception too, where there is an external receiver, because the DP/DN lines are still consulted to look for transition states and to attempt to accommodate frequency mismatches.

At the very least this is going to present a problem for V2/3 sign-off, but there is also reason to be concerned if the CDC modeling cannot fairly be considered overly-conservative and/or unrealistic.

With usbdev employing (only?) 4 x oversampling, a cycle delay on just one signal of a DP/DN transition, followed by a cycle delay only on the other signal one bit interval (4 clocks) later, can result in one signal being - say - high for 3 cycles - whilst its counterpart is low for 5 cycles, centred on those 3.

LLLHHHLLL
HHLLLLLHH

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.