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

USB differential benefits #24

Open
TheAnimatrix opened this issue Mar 26, 2024 · 3 comments
Open

USB differential benefits #24

TheAnimatrix opened this issue Mar 26, 2024 · 3 comments

Comments

@TheAnimatrix
Copy link

After reading the source of usb_fs_bitlevel

It is unclear to me why you don't try to merge the P & N lines together for data identification.
Instead you only seem to use dpv and last_dp.

sig = p-n, would actually take advantage of differential characteristics whereas you completely ignore the negative part of the differential for data packets.

Also the naming scheme is really unclear. What is dpv ? dpl ? what is L and V ?

@TheAnimatrix
Copy link
Author

// high when dpl has atleast one pair of 1's - 110,011,111 (101-X) - low when 000,001,100
//but why is it high for 110 and low for 001, we are transitioning to the opposite state
wire dpv = &dpl[3:2] | &dpl[2:1] | dpl[3] & dpl[1];

it's really unclear to me how exactly this works,

@TheAnimatrix
Copy link
Author

After having a better look of the code, dpv looks like an "average" over the shifted in values.
however, this only really makes sense when you look at in tandem with the condition its used in. Separating the signal from the condition is needless to say bad code, atleast if not indicated through comments or some other means.

@churchmice
Copy link

// high when dpl has atleast one pair of 1's - 110,011,111 (101-X) - low when 000,001,100 //but why is it high for 110 and low for 001, we are transitioning to the opposite state wire dpv = &dpl[3:2] | &dpl[2:1] | dpl[3] & dpl[1];

it's really unclear to me how exactly this works,

This is actually a simple voting algorithm. If out of 2 votes for 1, the result is 1.
5 samples are taken for a single usb bit time, and the code uses the middle 3 bits to deduce the value.
As for the diffrential issue, this is a simple digital implementation, there is no point to do dp - dn here.

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

No branches or pull requests

2 participants