davidthings / tinyfpga_bx_usbserial

USB Serial on the TinyFPGA BX
Apache License 2.0
133 stars 38 forks source link

Strange behavior in Windows. #10

Closed juanmard closed 4 years ago

juanmard commented 4 years ago

I am testing with a TinyFPGA-BX and I get strange behavior regarding the original bootloader. In the current configuration I can access the bootloader (COM6). It reacts correctly by sending you byte (0x00) and loads the user bitstream. In device manager everything is correct (in Spanish... :-)).

imagen

Loading the new "tinyfpga_bx_usbserial" stops accessing the port and Windows 10 reacts with a warning (also happens with the "hello_world" of @nalzok) giving an error 0x0A.

imagen

I have tested it on a GNU/Linux distribution (Debian) and everything works perfectly however. I suppose it is because of the CDC-ACM driver, but I don't understand what difference there is so that with the bootloader it works and with this other bitstream not. Any clues?

nevercast commented 4 years ago

I believe I've resolved it, see chain here: https://twitter.com/NvrCast/status/1273614583211520004 and solution posted here: https://discourse.tinyfpga.com/t/usb-communication/613/65

The issue is that when wLength exceeds 8 bits, it wraps over and usbserial returns less bytes than it should

https://github.com/davidthings/tinyfpga_bx_usbserial/blob/master/usb/usb_serial_ctrl_ep.v#L106-L108

This can happen because Windows (WHY!?) requests a very large Descriptor size, 265 bytes exactly. image

nevercast commented 4 years ago

A fix for this has been merged, are you able to check if the problem is resolved for you @juanmard ?

juanmard commented 4 years ago

Yeeeessss! Now it's ok!

imagen

No error and example "hello_world" running... Thanks! ;)

nevercast commented 4 years ago

Fantastic! Glad to see this is fixed for you!