Closed mithro closed 5 years ago
@xobs can you dump some extra info here so I can implement it?
Maybe we should implement software emulation using tinyusb first and then I can do a hardware version?
That should work, unless you want to debug the CPU. It'll be a great way to prototype, though.
The basic idea is that we use a SETUP
packet on EP0 to drive the communication.
We ought to be able to specify a bmRequestType
with a Type
of Vendor
and a Recipient
of Device
. We then specify wLength
of 8.
We can define some requests that we support:
bRequest = 0: Set/get address register
bRequest = 1: Set/get value
bRequest = 2: Set value + address
Ordinarily you'd write a value by doing a "Set value + address" request.
To read a value, you'd set the internal "address" register with a bRequest 0, then read the current register's contents with a bRequest 1.
If the top bit of bmRequestType
is 1, then we read from the specified address. Otherwise we write to it.
Your state machine should look for a SETUP packet of c1 f0 00 00 00 00 04 00
This is done now!
Congratulations!
@xobs, sounds great that it's done.
Out of curiosity, where is the implementation? Last changes I can see on this repo seem to be 2018-12-23 (on master), and 2019-02-11 (on usb12), and the last commit I can see upstream is 2018-10-15.
Somewhere in https://github.com/xobs/valentyusb/commits/master maybe? Or in https://github.com/xobs/valentyusb/commits/wishbone-debug maybe? (Possibly we need an upstream that'll take merged in code like this? Maybe something in https://github.com/im-tomu/? Which AFAICT doesn't have a valentyusb
repo at present...)
Anyway I'm curious how it got implemented / how it might be possible to use it :-)
Ewen
GitHubUSB Full-Speed core written in migen/LiteX. Contribute to xobs/valentyusb development by creating an account on GitHub.
GitHubUSB Full-Speed core written in migen/LiteX. Contribute to xobs/valentyusb development by creating an account on GitHub.
GitHubTim's Open Micro USB. I'm Tomu has 19 repositories available. Follow their code on GitHub.
Yes, it's in my github repo. I can create a repo in this organization and push it there. That would be most canonical.
I do need to document the protocol in the valentyusb repo somewhere. For now, the best documentation is at https://github.com/enjoy-digital/litex/blob/master/litex/tools/remote/comm_usb.py
GitHubBuild your hardware, easily! Contribute to enjoy-digital/litex development by creating an account on GitHub.
Thanks for the pointers!
FWIW, this particular issue is on Mithro's personal GitHub account, hence my puzzlement about where to find the code, and the suggestion maybe to create an integration repo in the im-tomu
organisation... :-)
Ewen
The repository is up now at https://github.com/im-tomu/valentyusb
GitHubFPGA USB stack written in LiteX. Contribute to im-tomu/valentyusb development by creating an account on GitHub.
@xobs came up with the idea of using Etherbone over the USB SETUP packets using a vendor extension.