Author Topic: Connecting ps/2 keyboard to 3.3 volt fpga  (Read 9893 times)

0 Members and 1 Guest are viewing this topic.

Offline rubenvannTopic starter

  • Newbie
  • Posts: 7
  • Country: nl
Connecting ps/2 keyboard to 3.3 volt fpga
« on: August 02, 2016, 04:31:29 pm »
I have a 3.3V FPGA, and I want to connect a PS/2 port to the GPIO. However, the keyboard needs 5.0 volt and 0.50 mA.
I tried hooking it up to the GPIO directly, but the keyboard doesn't  do anything (it works when I use a PS/2 to USB adapter to connect it to a PC). I might have the pins configured incorrectly, but I don't think I have. (However, the pinout of the PS/2 thing doesn't allow me to hook it up to the VCC and GND pins on the GPIO, so instead I do ps2_vcc_pin <= '1'; ps2_gnd_pin <= '1'; in my VHDL code, which some sources say is fine but I still want to mention it)

As a test, I destroyed an old mobile phone charger which outputs 5.0V and tried attaching it to the ground and vcc pins on the ps/2. I figured that at least numlock should light up, but it didn't. I don't understand why, as this are, as far as I understand, the only pins that are inputs for the keyboard (or can the unconnected pins make some difference?).

What is the easiest way to use the keyboard with my FPGA? There are some answers online, but they mainly suggest using a voltage divider while I can't figure out where the vcc and gnd should come from. I assumed they should be just 5 volt if 3.3 is not enough, but this doesn't seem to work.
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #1 on: August 02, 2016, 04:37:32 pm »
Quote
As a test, I destroyed an old mobile phone charger which outputs 5.0V and tried attaching it to the ground and vcc pins on the ps/2. I figured that at least numlock should light up, but it didn't. I don't understand why,
Normally the numlock lights up because the PC has told it to via a PS2 command.

Quote
What is the easiest way to use the keyboard with my FPGA? There are some answers online, but they mainly suggest using a voltage divider while I can't figure out where the vcc and gnd should come from. I assumed they should be just 5 volt if 3.3 is not enough, but this doesn't seem to work.
PS2 is 5V, so you are going to have to provide a 5V supply to the keyboard.
The signals can be put through a logic level converter between the keyboard and your 3.3V FPGA.
 
The following users thanked this post: Kilrah, rubenvann

Offline Someone

  • Super Contributor
  • ***
  • Posts: 5251
  • Country: au
    • send complaints here
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #2 on: August 03, 2016, 12:08:01 am »
Be careful about the input specifications but the easiest solution would be digilents example:
https://reference.digilentinc.com/_media/basys2:basys2_sch.pdf
 

Offline macgeorge

  • Newbie
  • Posts: 9
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #3 on: August 03, 2016, 08:34:06 am »
Although the PS/2 protocol requires 5V, I have used two PS/2 keyboards of different manufacturers powered by 3.3V of my Terasic DE0 nano SoC board and they worked fine (in order to avoid the mandatory input protection when using 5V peripherals). I don't remember the first keyboard's model, the second one was a Logitech Internet 350 keyboard.

As MosherIV suggested, the keyboard LEDs light using a PS/2 command, however I have noticed that the LEDs on my keyboards switch on momentarily when the keyboard is powered on by 3.3V (similar to when the computer boots).
 

Offline stj

  • Super Contributor
  • ***
  • Posts: 2196
  • Country: gb
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #4 on: August 05, 2016, 02:13:18 pm »
open the keyboard and see what wires it uses.
early ps2 keyboards&mice had an external reset signal - newer ones left it out of the design.
 

Offline stj

  • Super Contributor
  • ***
  • Posts: 2196
  • Country: gb
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #5 on: August 05, 2016, 05:51:33 pm »
the shell is connected to braid in the cable for shielding - it's GND / 0v

other than that, you should have VCC, clock and data.
and maybe reset - on old stuff.
most modern keyboard and mouse controllers are duel protocol and can also "speak" USB btw.
 

Offline edavid

  • Super Contributor
  • ***
  • Posts: 3561
  • Country: us
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #6 on: August 05, 2016, 07:35:43 pm »
I have a 3.3V FPGA, and I want to connect a PS/2 port to the GPIO. However, the keyboard needs 5.0 volt and 0.50 mA.
I tried hooking it up to the GPIO directly, but the keyboard doesn't  do anything (it works when I use a PS/2 to USB adapter to connect it to a PC). I might have the pins configured incorrectly, but I don't think I have. (However, the pinout of the PS/2 thing doesn't allow me to hook it up to the VCC and GND pins on the GPIO, so instead I do ps2_vcc_pin <= '1'; ps2_gnd_pin <= '1'; in my VHDL code, which some sources say is fine but I still want to mention it)

Note, 0.50mA is not correct.  A PS/2 keyboard can draw up to 275mA.  Although a modern one will use less current, don't try to power it from a port pin.
 

Offline stj

  • Super Contributor
  • ***
  • Posts: 2196
  • Country: gb
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #7 on: August 06, 2016, 12:18:06 am »
that should have been obvious, the 3 led's will need 5-20ma each
 

Offline Kilrah

  • Supporter
  • ****
  • Posts: 1852
  • Country: ch
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #8 on: August 06, 2016, 09:00:41 am »
The fact that any device that needs power needs to get power from an appropriate power rail is obvious enough not to usually be specifically mentioned?
 

Offline Kilrah

  • Supporter
  • ****
  • Posts: 1852
  • Country: ch
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #9 on: August 06, 2016, 04:37:36 pm »
Edit 2: Actually, I'm not 100% sure that was the reason. When I measured the voltage I only drove a led connected in series with a resistor, and I read somewhere that power supplies typically give a lower voltage when a higher current is drawn.
Yeah but that would be in the range of 0.1V less with a significant load... you definitely got a dud.
 
The following users thanked this post: rubenvann

Offline Kilrah

  • Supporter
  • ****
  • Posts: 1852
  • Country: ch
Re: Connecting ps/2 keyboard to 3.3 volt fpga
« Reply #10 on: August 07, 2016, 04:26:38 pm »
These old things were typically unregulated, the charge controller was in the phone. Yes the rating is misleading. Use something with an USB output, that's pretty sure of being 5V... but still check it just in case.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf