AndresNavarro82 / vt52-fpga

GNU General Public License v3.0
95 stars 9 forks source link

USB interface wiring #3

Closed DavidJRichards closed 3 years ago

DavidJRichards commented 3 years ago

Greetings Andres, I am having a go at running your terminal. Limited results so far as I have only a flashing led and cursor on the VGA output but no sensible results when I connect the USB. I can't tell if the keyboard is working yet.

Please could you describe the USB interface, I see some resistors in the photo? how are these connected and what values are you using?

The platform I'm using is ebaz4205 zynq 7010. Kind regards, David.

AndresNavarro82 commented 3 years ago

Hi David. If you are talking about the keyboard connection, it's an old style ps/2 connector, not a usb keyboard. I'm only using usb for the serial port to the pc.

With that in mind, the keyboard ps/2 connection has 4 wires: gnd, vcc, clk and data.

Vcc is supposed to be 5V, but I was able to use the 3.3v from the fpga without problems on the keyboards I tried so far. clk and data are both open collector outputs (at least according to the standard), If you connect the keyboard VCC to 5V I would measure/scope clk and data before connecting them to an fpga pin, just in case, because some out of spec keyboards have an internall pullup to VCC, and in that case you can damage the pin/fpga. If you connect vcc to 3.3v then you are safe.

In order to connect the clk and data open-collector signals you have to add at least a pullup from 3.3v to each one. While you could try with internal pullups on the fpga (check the specs), if you are not sure, it's safer to use external resistors. I used whatever I had at hand (I think they were like 4k7ohms or so). See the following post for the general idea (and notice that the cap and series resistor are optional, but desirable): https://electronics.stackexchange.com/a/92100

I hope you manage to get it working. Let me know if you can help you further. Regards, Andres Navarro

DavidJRichards commented 3 years ago

Hi Andres, thanks for the reply. My problem was not knowing the value of the resistors on the USB serial port. I tried and guessed some values and managed to make it work. I used 47R plus an existing 10R in series with the D+ and D- data signals. I found a 2k2 or internal pull up was ok for the D+ identification signal.

The PS/2 keyboard I have already been using - I find internal or external pull-ups work. my system has 10K external pull up.

Everything seems to be working as expected. For the ebaz4205 I needed to change the pll to suit the zynq. My system has a 33.333MHz clock which is being used for the main logic with a pll to generate the 48MHz usb clock.

In the future intend to adapt this design to incorporate it into a LVDS panel drive I have working but that shall start later. For now I shall tidy the code changes and publish the results in a fork of your repo. IMG_20210609_202510-COLLAGE

Kind regards, David.

AndresNavarro82 commented 3 years ago

Sorry I misunderstood your question, but I am glad to see you figured it out. I didn't have to deal with that, because the board I am using has the usb onboard: https://github.com/tinyfpga/TinyFPGA-BX/blob/master/board/TinyFPGA-BX-Schematic.pdf

It uses similar values to what you found: 68 ohms in series with d+ and d-, and a 1.5k pullup on d+