Problem reading Ps2 keyboard arduino

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
1. I am using arduino mega, and arduino 1.8.8. Code is compied using O3 optimization. I have changes Os to O3 in platform.txt at 3 places for fast code.

2. I have foloowing features enabled in arduino:
a) code send data serial through usb port available on mega i.e. Serial0 at 9600 baud rate and also used to burn code via arduino software
b) code reads data serially through a device, only rx pin is used, tx not connected. Serial2 at 2400 baud rate
c) Lcd 20x4. : standard arduino library
d) I2C based rtc ds1307 : https://github.com/PaulStoffregen/DS1307RTC
e) Internal eeprom to read & store data
f) serial port used to trasmit data , only tx is used, rx unconnected. Serial3 at 9600 baud.
g) Timer 3 at period interrupt of 20ms to scan 4 keys connected at pins.
h) A ps2 keyboard : https://www.pjrc.com/teensy/td_libs_PS2Keyboard.html


3. Problem is when i start the code, i read nothing from PS2 keyboard even if I press the keys on ps2 keyboard. If I keep on pressing some ps2 keyboard for around 10sec, then keyboard start working fine.

4. If i disable everything in code except ps2 library, then code works fine.

5. in complete code, i dont see anywhere i disable keyboard lib.

6. what i suspect, is that i have too many serial interrupt on rx pin, that may be causing issue, as it may interrupt the ps2 code. I dont read serial interrupt actually, as I read on sequentially in mainloop code. where to disable serial interrupt?

7. if not, what else could be issue
 

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
I realised, it works fine in below case:
1. When i power up system, without connecting PS2 keyboard, and then connect PS2 keyboard i,e after power up, then it works, all three led on keyboard blinks and it works fine.

2. Whereas when i power up the system with ps2 keyboard connceted, then keyboard dont work. If then i keep pressing some key, after sometime all three led blink & then keyboard works. But i have to press key for more than 15-20sec
 
Top