• 0
fpga_babe

HID protocol on Basys3

Question

Hi,

I am using Basys3 board and I want to write a RTL module in FPGA to get the character from USB Keyboard.

From the Digilent reference of basys3, if the FPGA side only receive the data from Keyboard, then the PS_CLK and PS_DAT ports can be as input direction.

My question is that, to receive the keycode from a keyboard, do we need to send configuration to Keyboard before hand ?

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0
Posted (edited)
12 hours ago, fpga_babe said:

to receive the keycode from a keyboard, do we need to send configuration to Keyboard before hand ?

From the Basys3 Reference Manual:

The Auxiliary Function microcontroller hides the USB HID protocol from the FPGA and emulates an old-style PS/2
bus. The microcontroller behaves just like a PS/2 keyboard or mouse would. This means new designs can re-use
existing PS/2 IP cores.

I've written code for Digilent's PS/2 interface and have never configured the keyboard. Be aware that pressing some keys send more than one keycode byte. I don't have the Baysys3 board so I can't confirm that the PS/2 emulation is exactly as claimed.

[edit] One of the Forums around here is the Project Vault where users can (should) post code and projects. You might find my submission 'Fast Inter-board Interface' to have some interesting stuff to get you started. Look in the HDL source for the Genesys.

Edited by zygot

Share this post


Link to post
Share on other sites
  • 0

HI, 

Thank you for your reply.

In my case of my project, the key board keep sending automatically the self-test passed code "AA" after a short time that there is no case press.

Things like this:

- Reset FPGA

- Press any key --> keycode return is "AA"

- Press some more key ( not fixed number of keys) --> return correct Keycode of keyboard. I use Leds on Basys3 to display the keycode value.

- Stop pressing key

- Press any key again --> keycode return a "AA".

I have a doubt that the PIC send the request to Keyboard to do self-test by itself. Is there anyone can confirm this point ? 

Also, would it be true if the PIC is waiting some command from the FPGA to comunicate with the Keyboard ? 

 

Share this post


Link to post
Share on other sites
  • 0

So, one of the problems with learning stuff at work is that your employer doesn't want to pay to have you learn stuff that takes time away from making money for the company. It's short-sighted but who said companies were smart or thinking you or about next year?

One of the nice things about doing this as a hobby, once you develop sufficient skill,  is that you can ask any question you desire, create projects to investigate the answer and learn any skill or subject that interests you. The up-front pay is lousy but down-range investment can be pretty good... and it's usually a heck of a lot more satisfying.

If you've got the basic skills; build stuff, test stuff and learn stuff. It's not a bad hobby.

All of this is to suggest that you answer you own questions. You might get lucky and have someone offer an opinion but there's no guarantee that this will happen or that the opinion is correct. I can only tell you that code that I post to the forums works well enough on the hardware it was designed to work on and does what I want for a particular purpose.

This is an assumption but you probably don't want to write IP for a particular board or implementation of an interface anyway.

Share this post


Link to post
Share on other sites
  • 0

Hi. 

I simple post the question about digilent hardware which i am working on. I stated it clearly above. They sale products, i bought it and used it. They have a forum and i can post a question. However, it is not mandatory to get an answer. That's it. Please dont go too far from technical problem on this forum.

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
11 hours ago, fpga_babe said:

Please dont go too far from technical problem on this forum.

The way that I created the code we are referring to was to use the method that I suggested in my last post. In that case I connected a PS/2 keyboard ( does anyone even make one of those any more? ) to the Genesys PS/2 connector and figured out how it behaved ( with a bit of internet searching ). For the Genesys board the only thing between the keyboard signals and the FPGA is a couple of resistors. In my view my previous advice was all related to the 'technical problem'. But  hey, I hear what you are saying. No one has to pay attention to or even read my modest musings.... but if I don't share them no one can.

Edited by zygot

Share this post


Link to post
Share on other sites
  • 0
On ‎5‎/‎1‎/‎2019 at 2:00 AM, jpeyron said:

Hi @fpga_babe,

Sorry for the late response. We were out of the office for some of last week. 

Here is a verified verilog keyboard project for the Basys 3 that prints the key code out through the USB UART bridge.

best regards,

Jon

Thank you Jon.

I will check it.

Share this post


Link to post
Share on other sites
  • 0

I can solved my problem using my verilog module.

The FPGA can receive the correct keycode from Keyboard through the PIC. The only concern is that, the PIC perform self-test after a period of idle status. (No key pressed).

I understood is as an internal operation of PIC. Anyway, I can confirm my verilog design function, so there is no more question.

Thank you for your support !

Share this post


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