I’ve been adding a ps2 keyboard to one of my projects and found firmware based on Atmel’s AVR313 application note didn’t work. After a bit of hunting around on the net and some careful watching on the logic analyser I found out why.
When the AT keyboard is first reset it’s supposed to send an AA if its self-test passed or FD or FC if it failed. But before it does this, it sends a continual stream of AAs with the parity incorrect. Once the computer sends an FE to indicate that there is a parity error, the keyboard stops sending bad AAs and sends a correct AA or an FD or FC. This sounds like someone made a quick fix in the keyboard firmware for mis-matched reset timing (the keyboard always finishes resetting before the computer so the computer could miss the AA/FD/FC).
This was found at http://www.cs.cmu.edu/afs/cs/usr/jmcm/www/info/key2.txt