PS2 Keyboard Library compatability with newer ps2 keyboards.

Status
Not open for further replies.

BLMinTenn

Well-known member
Paul, members of the board,

I have been working with the PS2 Keyboard library with the teensy 3.2 platform and cannot get my keyboard to work. I would like to note that the keyboard is brand new, has a 6 pin mini DIN PS2 connector, is running on its own power supply (5V+) and grounded between the microcontroller and keyboard. Trying the same setup with the Arduino UNO gives me the same dead end result (no response) so, I think there maybe something wrong with the library.

On the positive side of things, the same keyboard works on the UNO with the "PS2KeyAdvanced" library written by Paul Carpenter. The only drawback is that the library will not compile on the Teensy 3.1/2 platform which I am using.

I have tried every pin on the teensy except 13 & analog only pins:) with no advancement forward and in terms of code, the "simple Test" example that comes with the library is being used.

If someone that has a few minutes could they please help.

Thanks :eek:
BLMinTenn
 
All,

An update. I am not exactly sure what seems to be the issue when it is not working. So, any advice is welcome.

I have confirmed that the wiring is correct and I have had random success on the UNO and T3.2 platforms, but the intermittent working of the keyboard is troubling me. I have checked voltage at each of the pins... Data, CLK, +5V. 5V is more like 4.9V, while the CLK & data are at 3.3V. So, is this correct or is it something with the power supply for the keyboard itself?

So, this is looking more like a hardware issue instead of a library problem. Thanks to Paul for such a mature PS2Keyboard Library.

So, can a hardware guru please chime in and give some advice.

I plan on trying some older keyboards in hopes to fix my problem because all blogs that I read seem to hint around that older keyboards work and newer ones do not. Is it possible that the newer keyboards are looking for an ACK when Paul's library only listen for responses and not returns ACK's.

Please help and thank you...
BLMinTenn
 
All,
Guess I am in a rut again but my suspissions are spot on. I found an old IBM PS2 keyboard and on the first try, everything started to work. Unfortunately, other unexpected problems are now happening. The function keys are enabled by changing zero to a 1... and this works in the arduino R3 Uno. When I go to the Teensy 3.2/1 platform, the function keys do not work. So, again another head scratching night... I have searched the forum... and no match to my particular problem.

I guess this last question will most likely go unanswered as this thread has no replies :confused:

What can be causing the Teensy 3.1/2 platform not to respond to the function keys? Any suggestions?

Thanks
BLMinTenn
 
My reply may not be helpful since I have no programming experience with PS/2 keyboards, but I want to ask out of scientific curiosity: What is the reason for using a PS/2 keyboard nowadays where most peripherals have been switched over to USB?
 
I built a project last year in April using a brand new PS/2 keyboard and a Teensy 3.2. It worked then. Maybe something has changed or broken since?

I suppose I could dig out the hardware and test again.....
 
One quick question: have you tried 4.7K pullup resistors (to 5V) on both data signals? Perhaps the keyboard you have it getting stuck in USB mode if it's not seeing 5V pullups early enough?
 
Theremingenieur,
I want to use the PS2 keyboard because its easier to interface with the Teensy compared to USB. I think that USB requires a master / slave setup to even work... Yes, Yes, I know there's a USB on the end of the 3.2 but, I am using that with the Serial Monitor to output the characters. So, USB will not work in this situation.

Paul,
Thanks for the reply. To answer your question. No, I have not tried 4.7K pull up resistors to 5V on the DATA and CLK lines. I am using the library as-is with DATA(PIN #4), CLK(PIN #5) directly connected to the Teensu 3.2. I will try this when I get home tonight.

Question? I have seen where the library calls for the use of internal pull-ups in PS2Keyboard::begin()...

Sorry, I could NOT find the code tags.
#ifdef INPUT_PULLUP
pinMode(irq_pin, INPUT_PULLUP);
pinMode(data_pin, INPUT_PULLUP);
#else
pinMode(irq_pin, INPUT);
digitalWrite(irq_pin, HIGH);
pinMode(data_pin, INPUT);
digitalWrite(data_pin, HIGH);
#endif

Could I use INPUT_PULLUP resistors option in the library or do you think this is too much resistance?

Thanks
BLMinTenn
 
Paul,
Well, I tried your resistor idea and it did not work (sorry, only had 2.1K resistors)... it works like a charm on the old IBM keyboard:cool: So I am going to show show some pictures of the setup.
See the schematic...
IMG_3689.jpg

See the keyboard that does not want to cooperate. It works about 20% of the time... and yes the 3 lights for cap lock, number lock & scroll lock flash once on power-up.
IMG_3690.jpg

Now for the keyboard that works except that the function keys F1...F12 on Teensy 3.2. On the UNO everything works like a charm however on the teensy 3.2, its a NO GO.
IMG_3691.jpg

So, I think that the Function Key Problem is over my head. This is where I could use an expert to come and save the day..

Thanks
BLMinTenn
Now for
 
It might not be at all relevant, but I had a frustrating time with a PS2 keyboard about 6 months ago, and made several posts to the forum. Eventually it turned out to be a dual PS2/USB keyboard, and needed an initialisation signal at power on to set PS2 rather than USB mode. This in turn needed changes to the library to support 'send' to the keyboard.

Peter
 
Peter,
I fear that this is the same problem that I am experiencing. As you can see in the second picture, the newer keyboard is hard wired for PS2 and I was not aware that newer keyboards are dual. By the way, did you find a fix for your problem AKA "initialization signal" with a modification to your code? Also, did you have problems with the Teensy 3.2 and the function Keys not working while the Arduino UNO R3 works perfectly. FYI, I tried 2 versions of Arduino IDE... with TeensyDuino 1.20 & 1.31 with the same problems No Function Key response on ARM platform & no go for the new keyboard.

Paul,
Have you had the chance to look into this problem?

Thanks
BLMinTenn
 
I supplied a modified PS2Keyboard library with my post about 6 months ago. You could try that. It includes a 'send' facility.

The other change that I included was returning an int on the begin call, so that you can see if it happy with the IRQpin supplied.

Finally to use the extension, you issue PS2Keyboard.send(255) straight after begin to reset the keyboard.

PS2Keyboard PS2keybd;

int initKeybd()
{ int res=0;
res = PS2keybd.begin(DataPin, IRQpin); // PS/2 Keyboard input
PS2keybd.send(255); // keyboard reset
return res;
}
 
Peter, Paul,.... and Mary LOL

Sorry couldnt help myself. have good news. After another night of hair pulling I finally gained some smarts and found that in the new arduino IDE, the Teensy libraries are in a different location compared to tradition arduino librariy folder. Once I found this fun fact and modified the F1...F12 settings to 1...12, everything started to work with the old keyboard.... however, the new keyboard still does not work.

So, Peter. I tried your library that has send capability and added

kbd.send(255);

just under kbd.begin(5, 4);

and now the old and new keyboards stopped working. So, keep in mind that I am using true ps2 hardwired old (2000's) & new(2016's) keyboards and something about the internals of the new are different. I cant quite put my finger on this yet but, Im not a quitter and more of a tinker-er. So, I will get to the bottom of this by order another new keyboard just in case the one that I have now is defective.

Thanks for your replies and help. Paul, is it recommended to add 4.7K pullup resistors to 5V when interfacing keyboards to ARM Teensies? I have not seen a schematic anywhere that shows the use of resistors.

Thanks
BLMinTenn
 
Thank you for the quick reply Paul. The hyperlink landed me deep inside a vast catalog (I remember when the DigiKey catalog was 3/8" thick paper) showed me lots more interesting pre-fab prototyping HW = Awesome!
 
Status
Not open for further replies.
Back
Top