[SOLVED] PS/2 Keyboard - FPGA interface problem

Status
Not open for further replies.

Sasha_Mishutina

Newbie level 4
Joined
Aug 21, 2011
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
St.Petersburg
Activity points
1,320
Hello!
I am trying to make interface PS/2 Keyboard with Altera FPGA on Altera DE1 board.
But all data bits I receive are zeros.
I made another curcuit in FPGA that puts all bits from PS2_DAT line in memory when negative edge of PS2_CLK line:

Every time I press and release any key, I recieve this:
-1 start bit is zero
-8 data bit are zero (WHY??)
-1 parity bit is one
-1 stop bit is one
I recieve 3 11-bit packets when press and release key:
0 00000000 1 1
0 00000000 1 1
0 00000000 1 1
Why make code and break code are zeros?
Keyboard is not broken
Maybe any initialization procedure is needed like in PS/2 mouse?
 

Code:
[SIZE=3]always@(posedge PS2_CLK)
	addr<=addr+1'b1;
		
//SRAM memory block: MEM(address,clock,data,wren,q);

MEM mem_block(addr,~PS2_CLK,PS2_DAT,1'b1,LEDG[3]);[/SIZE]
this is the code.
and this is the content of SRAM memory(in-system memort content editor, Quartus II) when I press and release button A:

Maybe i receive 0 data bits because DE1 board has 3.3 V power supply and i have old keyboard that can work only with 5 V? But i am not sure about that...
 

The data from the keyboard is a serial stream. In the few lines of code you show there is no serial conversion. Is there a hardware 'port' that shifts in the keyboard data? There is more code, isn't there?
 

Solved! When PS/2 keyboard send all data bits 0, it means that 00h command send from the keyboard to the host. Command 00h means "Error or buffer overflow".
When I work with Altera DE1 board (switching the LEDs, HEX displays) I can work with USB power supply without 7.5 V USB adaptor. But when I make PS/2 interface on DE1, host's USB port cannot provide adequate power.
I connected 7.5 V power adaptor and PS/2 keyboard interface work proprely!!
DE1 show me scan codes of keyboard=)
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…