|
Author | Topic: Jornada Micro Keyboard Hack: RS-232 to PS/2 (Read 10,262 times) |
jtwinters Junior Member
  member is offline
![[avatar] [avatar]](http://www.picobay.com/picodore64/beaker_avatar.jpg)
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Dec 2006 Gender: Male  Posts: 87 Location: Florida USA
|  | Jornada Micro Keyboard Hack: RS-232 to PS/2 « Thread Started on Jan 2, 2007, 7:10pm » | |
The Micro Folding Keyboard (Model#: TKB420HP) made by Micro Innovations is a small portable keyboard for attaching to a Jornada PDA. It basically has all keys needed for adapting to a DTV but unfortunately outputs RS-232 instead of PS/2. The following information describes how to interface this keyboard to DTV Hummer and possible the rest of the DTV versions.
![[image] [image]](http://www.picobay.com/picodore64/jornadaKB-box.jpg)
Out of the box:
![[image] [image]](http://www.picobay.com/picodore64/TKB420HP-unit.jpg) Disassembling the keyboard, you’ll see 5 labeled connections: VCC, RTS, RXD, DCD, and GND. VCC is +5V for this unit. RXD is the line on which data is actually sent, although the keyboard won’t send anything until RTS is pulled high. I do this right on the board by soldering a 1k resistor between the RTS pad and the onboard microcontroller’s Vcc pad (see picture). By doing this, you only need to run three wires from the keyboard (VCC, RXD and Ground).
![[image] [image]](http://www.picobay.com/picodore64/jornada_mod-1.jpg)
As far as what mechanical modifications… I chose to cut away a lot of extra plastic from the two folding halves and superglue the sides together. This effectively created one solid piece. I also glued the flexi-ribbon flat against itself to take up less space.
![[image] [image]](http://www.picobay.com/picodore64/keyboard_installed_sm.jpg)
Since this keyboard outputs RS-232 (9600 baud, 8 data bits, 1 stop bit and no-parity), a PIC 16F88 microcontroller is used to convert the data to PS/2 for the DTV. PS/2 keyboards use “make” and “break” codes. One or more “make” codes is sent when a key is pressed and several “break” codes and are sent on key release. The Jornada keyboard kind of works the same way in that it uses make and break codes, unfortunately the codes are not a one for one match and must be re-mapped by the PIC.
On power up, the PIC will check to see if a regular external PS/2 is attached. If so, it will just go into “repeater” mode and pass along any signals from the PS/2 keyboard to the DTV. The PIC adds a one second delay to get rid of the pesky “V”.
Here’s the circuit (thanks to Joe Rey for redrawing it):
![[image] [image]](http://www.picobay.com/picodore64/Picodore_Keyboard_schematic2.jpg)
The 100k resistor on pin 11 is needed even if you decide not to mess with the external PS/2 connector, so don’t leave it out. The rest is fairly straight forward. The 100uF cap may need to be larger depending on your setup. 100uF worked initially for me until I added an LCD screen to my design. The power surge on start up was too much and the keyboard would not initialize properly until I increased it to 470uF.
For timing, the internal 8 MHz oscillator is used. It seems to work just fine.
Here’s the HEX file: http://www.picobay.com/picodore64/JornadaKB_16F88.hex
And the source code: http://www.picobay.com/picodore64/JornadaKB_16F88.txt
Again, this is for a 16F88 and any $15 JDM PIC programmer will work just fine. The source code is written in PicBasic Pro. The code could probably be reduced to half the size by constructing the send codes on the fly instead of hard coding them. The start, stop parity bit could be added automatically and each make/break code would only take up a byte instead of a word. But the 16F88 has 4K of space and I wasn’t tight on space. Maybe as I add more features, I’ll recode that section. And while I’m at it, I’ll switch to using interrupts to get the data from the Jornada keyboard instead of just waiting for data.
Obviously this is an adapted keyboard and I had to switch some of the key assignments:
Today = ESC (RUNSTOP) Space = INSERT Windows key = Commodore Key FN + Right Arrow = HOME FN + CRTL + Right Arrow = CLR SCN
The 4 keys in the top left are the F1 thru F4 keys, F5 thru F8 with the FN pressed.
I didn't bother to implement the Numlock keypad, there didn't seem to be much point to doing so.
Just for the heck of it I’m posting the PS/2 waveform of a make code for the “A” key. Channel 1 is the clock and Channel 2 is data.
This is from a real PS/2 keyboard.
![[image] [image]](http://www.picobay.com/picodore64/scope%20of%20A%20key.JPG)
And here is the PIC’s emulated PS/2 protocol of the same data.
![[image] [image]](http://www.picobay.com/picodore64/simulated%20A%20key.JPG)
Good luck!
|
|
|
huckle Full Member
   member is offline
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Dec 2005 Posts: 103
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #1 on Jan 2, 2007, 8:49pm » | |
Very good job! Is the keyboard giving out real rs-232 voltage levels? ie, 12+ volts. I'm guessing the 1k resistor on the rxd line is to protect the pic?
| |
|
jtwinters Junior Member
  member is offline
![[avatar] [avatar]](http://www.picobay.com/picodore64/beaker_avatar.jpg)
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Dec 2006 Gender: Male  Posts: 87 Location: Florida USA
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #2 on Jan 2, 2007, 9:00pm » | |
The output voltage levels of the keyboard are 0 and +5V. And yes the 1k resistor is to limit current between the keyboard and PIC. It probably isn't even needed but since I had absolutely no documentation to work with and only one keyboard to reverse engineer, I wasn't taking any chances.
|
|
|
jsaily Full Member
   member is offline
Joined: Feb 2006 Gender: Male  Posts: 229 Location: Finland
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #3 on Jan 9, 2007, 1:34pm » | |
I happen to have a suprlus GoType! keyboard for Handera Palm device. I think this uses also RS232 connection to transfer data, and would make an excellent portable keyboard for DTV.
Any idea if the protocol is much different from the Jornada protocol? I should probably take my scope from the closet and start probing
| |
|
jtwinters Junior Member
  member is offline
![[avatar] [avatar]](http://www.picobay.com/picodore64/beaker_avatar.jpg)
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Dec 2006 Gender: Male  Posts: 87 Location: Florida USA
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #4 on Jan 9, 2007, 3:47pm » | |
Your guess is as good as mine. I'm no expert on PDA keyboards. If it uses make and break codes, like the jornada, then you can easily modify my code to fit your keyboards output.
I don't think there is a stardard scheme for RS232 output on these since the Jornada needed a special driver to use the external keyboard.
|
|
|
copperhorse3 New Member
 member is offline
Joined: Apr 2005 Posts: 3
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #5 on Jan 20, 2007, 11:20am » | |
Hi slightly off topic but...
The medium sized keyboard you originaly planned to use, I don't suppose you know if it was/is compatable with the DTV?
Thank you.
| |
|
jtwinters Junior Member
  member is offline
![[avatar] [avatar]](http://www.picobay.com/picodore64/beaker_avatar.jpg)
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Dec 2006 Gender: Male  Posts: 87 Location: Florida USA
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #6 on Jan 20, 2007, 11:29am » | |
On the contrary, this mini-keyboard worked flawlessly. It was a standard computer keyboard with a USB output. By using a PS/2 to USB adapter, the Hummer was happy with it.
|
|
|
expertsetup Senior Member
    member is offline
![[avatar] [avatar]](http://www.expertsetup.com/~brian/c64/images/wolf.gif)
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Apr 2005 Gender: Male  Posts: 468 Location: California USA
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #7 on Jan 20, 2007, 12:52pm » | |
Good to know the PS2/USB adapter is working with DTV. Open the selection up a bit.
|
|
|
jtwinters Junior Member
  member is offline
![[avatar] [avatar]](http://www.picobay.com/picodore64/beaker_avatar.jpg)
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Dec 2006 Gender: Male  Posts: 87 Location: Florida USA
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #8 on Jan 20, 2007, 1:18pm » | |
Not every USB keyboard will work with an adapter. It all depends on whether the microcontroller in the keyboard is smart enough to sense that it's connected to a PS/2 interface and use that protocol instead of USB. It's really hit or miss.
The middle keyboard in this pic works for sure though...
|
|
|
xxameht New Member
 member is offline
Joined: Feb 2007 Posts: 3
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #9 on Feb 23, 2007, 10:23pm » | |
how hard do you suppose it would be to port that idea to a 12c508?
| |
|
expertsetup Senior Member
    member is offline
![[avatar] [avatar]](http://www.expertsetup.com/~brian/c64/images/wolf.gif)
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Apr 2005 Gender: Male  Posts: 468 Location: California USA
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #10 on Feb 23, 2007, 10:37pm » | |
JT may I also ask what PS2->USB adapter you used? Was it just one of the purlpe devices I have seen or was it an active device?
|
|
|
jtwinters Junior Member
  member is offline
![[avatar] [avatar]](http://www.picobay.com/picodore64/beaker_avatar.jpg)
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Dec 2006 Gender: Male  Posts: 87 Location: Florida USA
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #11 on Feb 25, 2007, 2:29am » | |
Do you mean a USB->PS2 adapter? I just used a little passive adapter that came with the keyboard. It's really nothing special.... all it does is route the PS2 connections to USB. Though, the keyboard has to be smart enough to know that it is in PS2 mode. I don't think all USB keyboards can do that.
|
|
|
expertsetup Senior Member
    member is offline
![[avatar] [avatar]](http://www.expertsetup.com/~brian/c64/images/wolf.gif)
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Apr 2005 Gender: Male  Posts: 468 Location: California USA
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #12 on Feb 25, 2007, 2:56pm » | |
Quote:| Do you mean a USB->PS2 adapter? |
|
I guess so, I think of adapters as a device that connects the Host to a device so in this case the host is PS/2 and the device is USB. So from my point of view its an PS2 host port to USB device adapter. However I assumed this and am far from sure if there is a standard to describe adapters.
Quote:| I just used a little passive adapter that came with the keyboard. It's really nothing special.... all it does is route the PS2 connections to USB. Though, the keyboard has to be smart enough to know that it is in PS2 mode. I don't think all USB keyboards can do that. |
|
Great then the adapter I have should work with kayboards that are 'PS2 compatible'.
Thanks JT.
P.S. I am loving the Beaker Avatar you are using now
|
|
|
Golan Klinger Moderator
     member is offline
![[avatar] [avatar]](http://www.vex.net/~falco/chococat.jpg)
64K is enough for me.
![[homepage] [homepage]](http://s2.images.proboards.com/buttons/www_sm.gif) Joined: Mar 2005 Gender: Male  Posts: 1,031 Location: Toronto, CANADA
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #13 on Feb 25, 2007, 6:46pm » | |
Quote: Quote:| Do you mean a USB->PS2 adapter? |
|
I guess so, I think of adapters as a device that connects the Host to a device so in this case the host is PS/2 and the device is USB. So from my point of view its an PS2 host port to USB device adapter. |
|
While there is no standardized definition, common usage is the opposite. To connect a USB mouse to a computer with a PS/2 port requires a USB to PS/2 adaptor as it is the mouse that is being adapted to work with the PC. Search Google Images for "USB-to-PS2" and "PS2-to-USB" and you'll quickly see the difference. With all that being said, you should always specify *exactly* what you want. If you want a 'female USB to male PS2' adaptor, ask for one.
Semi-OT: One of my pet peeves is people who say things like, "I need a serial cable". That's so ambiguous. It's like going into a restaurant and ordering, "Food". What kind of end connectors? Gender? How many pins? Where do you want the pins to go? <sigh>
|
Call me Golan; my parents did. |
|
nojoopa Full Member
   member is offline
Joined: Sept 2006 Gender: Male  Posts: 169 Location: Finland
|  | Re: Jornada Micro Keyboard Hack: RS-232 to PS/2 « Reply #14 on Feb 26, 2007, 8:02am » | |
Quote:| Great then the adapter I have should work with kayboards that are 'PS2 compatible'. |
| ...if the keyboard doesn't require the 0xF4 activation, as mentioned here. If it does, try the fix by zee.
Someone should include this stuff on the DTV Wiki.
|
|
|
|