4
\$\begingroup\$

In my quest to build my first CPU, I am trying to hook up a PS/2 keyboard to my FPGA. The keyboard is a Perixx PERIBOARD-409P.

After a bit of reading, I hooked up the keyboard to a scope to verify its correct behaviour.

Unfortunately, what I get is a flow of continuous 0xAA codes. I am not able to see any other code, no matter what key I press.

This is happening immediately after the LEDs flash. I read here that the LEDs flash during the POST routine. If everything goes well, the keyboard should send a single 0xAA code to indicate a successful POST operation.

What I don't understand is why I keep getting this code and if there is a way to avoid it.

Does someone have any idea about this?

EDIT

I am using the FPGA's 5 V pins only to power up the keyboard. I connect data and clock directly to the scope. I also tried an Arduino, but the result was similar. The following picture shows my current setup:

enter image description here

From what I have understood about the protocol, what should happen is:

  1. The keyboard is powered-up.
  2. LEDs flash and the keyboard transmits 0xAA (BAT)
  3. When I press a key, the keyboard will drive CLOCK low 11 times, and the DATA is an 11-bit serial word: data = [start, d0,..d7, parity, stop]

The problem I have is that the keyboard gets stuck at step 2. It keeps sending 0xAA and it does not send any other code when I press a key.

I also tried to hook up the keyboard to a normal PC, and it works correctly.

What am I doing wrong?

EDIT - 2

After a lot of browsing, I found this post where they explain that the keyboard I am using implements a different protocol from the standard PS/2.

Basically the PERIPERI keyboard sends the 0xAA and waits for the host to reply back. This is the protocol implemented.

So, I ordered a new (very old) keyboard and I will try to see what happens.

\$\endgroup\$
12
  • 1
    \$\begingroup\$ Does the keyboard get enough voltage and current so it does not reset? Does your FPGA try to communicate with the keyboard, keeping data, clock, or both low for long periods of time, to make it reset? How did you connect the 5V bus to a 3.3V FPGA? I am just assuming here that you give 5V to keyboard and the FPGA has 3.3V IO, but you really don't give much information to work with. Maybe you have a loose wire somewhere. What have you checked and what have you not checked? \$\endgroup\$
    – Justme
    Jun 30, 2022 at 4:47
  • \$\begingroup\$ You're also trying to "build a CPU" ? \$\endgroup\$
    – TonyM
    Jun 30, 2022 at 7:22
  • \$\begingroup\$ @Justme, I edited the question to clarify. \$\endgroup\$ Jun 30, 2022 at 8:48
  • 1
    \$\begingroup\$ It was unrelated to your question...I was wondering if you really meant 'build a CPU'. But, from looking at the course, that's exactly what you're doing. Question upvoted, always great to see people here that are putting the work into their learning :-) \$\endgroup\$
    – TonyM
    Jun 30, 2022 at 9:01
  • 1
    \$\begingroup\$ @IanBland, yes, hasn't it :-) I first thought the OP might have meant 'build an MCU' using an existing CPU and had just got their terminology wrong. I designed a simple interface CPU in an HDL for a positioning control FPGA some years back and wrote its assembler, used soft CPUs in a few other FPGAs, so it's familiar ground. \$\endgroup\$
    – TonyM
    Jul 1, 2022 at 8:21

1 Answer 1

1
\$\begingroup\$

I finally sorted out the mystery. As I pointed out in the comments, it was the keyboards fault.

From the discussion in this thread the keyboard I was using (the PERIBOARD 409P) was following a different protocol from the standard PS/2.

I bought an old PS/2 keyboard from e-bay and the problem was sorted. Now I can finally see the proper scan code for A: enter image description here

Thank you to all commenters for the help!

\$\endgroup\$
1
  • \$\begingroup\$ Giuseppe Rossini - Hi, Thanks for coming back with the answer to your question. In order to effectively mark the topic as solved, and since there are no other answers, please consider "accepting" your answer (click the "tick mark" next to your answer, to turn it green). That shows that you don't need more help and future readers can quickly see that this was the confirmed solution. Thanks. \$\endgroup\$
    – SamGibson
    Jul 5, 2022 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.