• 0

PS2 keyboard interface problem



I created a VHDL description to work with the PS2 interface of a Nexys-3 board, but I'm having a problem with the arrow keys. The right arrow key - code E0 74 - works perfectly, but strangely the other three - codes E0 75, E0 6B and E0 72 - do not! I tested with the Ctrl key - code E0 14 - and with the Alt GR - code E0 11 - and they also work perfectly. Since I was unable to understand the problem, I tried with another board - a Basys-3 - and with Vivado. The behavior was exactly the same. Then I picked up an old Spartan-3E board with a true PS2 connector and the whole arrow keys and the Ctrl and Alt GR worked perfectly (I singled these keys out because they are extended keys like the arrow keys).

I'm completely puzzled! Why the same description works in a board and in the other two boards only works with certain keys? The only visible difference among the boards is that the most recent Nexys-3 and Basys-3 use an emulator to emulate PS2, while the old Spartan-3E board does not. May there be the problem?  As someone already experienced the same problem? Thank you.

Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi Manu,

Without the code I can't offer any advice apart from maybe you should copy the serial port output to a pin on a PMOD and look at it with a scope or logic analyser. That way you can at least be sure that the input to your logic is correct or not.

However, it is more than likely some subtle timing issue going on.  If you are really stuck, post your code and I'll have a look at it....


Link to post
Share on other sites
  • 0

Hi Mike,

Thank you for your help. I had indeed routed the PS2 data to LEDs and the values I got from the keyboard where the correct ones for all keys.

I'm sending attached the files. The descriptions are based on the Mr. Pong's book - FPGA Prototyping by VHDL Examples.

I created an output signal for each one of the extended keys - the up, left, right, down arrow keys and the alt-gr and ctrl keys.

As I said, it works perfectly with the Spartan-3E board. With the Basys-3 and Nexys-3 board, only the right arrow key and the alt-gr and ctrl keys work perfectly. The others no.

Thank you again for your help.

Regards, Manuel


Link to post
Share on other sites
  • 0

Apologies if this was the test you mentioned above, but a good test would be to use a scope to look at the PS2 data and clock signals of the PS2 keyboard and compare them to the signals you get from the PIC on the Nexys3 (the PS2 emulator) when the USB-HID keyboard is attached to it. Your problem may be due to differences between your PS2 keyboard and your USB-HID keyboard (or possibly the PS2-to-USB converter if you are using one). You can scope the PS2 signals on the Nexys3 at R115 and R116.

Also note that the Nexys3 requires that you instantiate pull-ups on the PS2 Data and Clock lines in the UCF. I noticed you didn't provide a ucf with your project files...


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now