USB Communication


#61

Quick question for you, do you perhaps have the source code for the git repo https://github.com/jmajer/tinyFPGA_testing ](https://github.com/jmajer/tinyFPGA_testing
I noticed that repo is no long available and would like to work with it since so far it is the only one that has worked so far.


#62

Hi,

The tinyFPGA_testing in the posts above is gone. I am trying to get usb serial working based on @lawrie.griffiths’s work https://github.com/lawrie/tiny_usb_examples . Actually I started a few times already looking into it but there seems to be a small problem in the code.

Under Linux at least the hello world example fails to output hello world. It is only when I plug out the device that all of a sudden I will get a few hello_world instances displayed on my screen. I suspect there is a small problem in the implementation that perhaps does not fully follow the specs.

any clue?


#63

David Williams’s version is an improvement on mine - https://github.com/davidthings/tinyfpga_bx_usbserial


#64

Unfortunately that version doesn’t seem to work for me either, having the same problem as @MartyMacGyver. Enumeration on Windows 10 seems to fail with either:

This device cannot start. (Code 10)

{Operation Failed}
The requested operation was unsuccessful.

or

Windows has stopped this device because it has reported problems. (Code 43)

A request for the USB device descriptor failed.

I’m building the firmware from inside a docker image and then flashing it from Windows with tinyprog.


#65

Follow up! I think I’ve fixed the UART on Windows! https://twitter.com/NvrCast/status/1273614583211520004

For whatever reason, Windows requests a very large descriptor size, greater than a byte, and the bit fiddling that the usb_serial_ctrl_ep module does causes this to wrap over.


#66

Excellent work!

I read your thread on twitter, I have a question …
I am not an expert in USB protocol, but … host request a 265 bytes descriptor, do you give it a 67 bytes descriptor and does it work? :roll_eyes:
Why? And why does Win10 request 265 bytes? Or is it just that driver? :thinking:


#67

Hi,

I am also now spending some time on this project. I am porting the examples from @lawrie.griffiths to the newer usb stack and making modifications to allow for more emulation.

At the same time I think that running test benches would be a nice idea. The idea here is to use usbmon on linux / windows and capture the usb packets in wireshark. this should give us a “definitive guide” on making it work on all platforms :stuck_out_tongue:


#68

Hi,
I am trying to send data as fast I can can from the FPGA to the host. I was/am expecting that I am free to write data to the UART as long as uart_in_ready is true but this is not what I am experiencing.

From looking at the code (digging into usb_uart_bridge_ep I find the following line https://github.com/davidthings/tinyfpga_bx_usbserial/blob/master/usb/usb_uart_bridge_ep.v#L231

  // connect the pipeline register to the outgoing port
  assign uart_in_ready = ( pipeline_in_state == PipelineInState_CycleData ) && in_ep_data_free;

is appears that the ready state can only be valid while in the cycleData state. is this intentional? and if so how do i determine if I am allowed to push write data to the host?