OH2NLT Extra Keyboard for NUE-PSK modem
Page updated 05.06.2008
My son Johannes OH2GSP ordered NUE-PSK modem. I got it in my hands andconnected it to my JUMA-TRX2 transceiver. After playing few evenings with it ordinary large PC keyboard needed to operate the modem started to disturb me. I managed to get Japanese mobile phone add on keyboard from my friend Jussi OH7TE. First it appeared to me dead. When powering up oscillator ran few milliseconds and thatís all. After few nights and few beers I found how to keep it running. From this point on it was relatively easy to find output pins of the processor and figure out the hardware protocol. Unfortunately this keyboard may be impossible to get anywhere. One to one replication of this project is therefore not possible. I however decided to publish my work as an example how to modify NUE-PSK firmware and how to connect your own devices with it.
Keyboard have originallyoperated with two 1,5V batteries. It could be directly powered from NUE-PSK modems 3,3V supply. As before mentioned keyboard physical interface appeared to be 600 baud serial communication. Keyboard UART output is buffered with non-inverting open collector buffer. Again easy connection to NUE-PSK UART2 input. Only pull up resistor is needed.
First I made piece of software just reading and showing everything the keyboard transmits in hexadecimal format. Very strange protocol was clear quite soon. Keyboard transmits eight bytes per one keystroke. Message format is in hex characters
F2, 02, 01, 00, 00, Type, ScanHi, ScanLo
Type is 0x01 characters and 0x02 for capital characters. Type 0x03 means control/function keys. For unknown reason scan code is divided in to two bytes. High nibble of both bytes is always 0. With my test software I composed scan code map for the keyboard. Scan code map is found in my software source code and inExcel format with the firmware package. Beginning of every message (F2 02 01) is useless because it is the same for all messages. Next two bytes 00 00 are also constant. No scan code or type byte is newer 0x00. This means that 00 00 bytes could be used for real payload message start marker. My keyboard code interpretation is based on this feature. Every 0x00 byte resets the internal state machine. Type 0x03 commands are filtered first. Second phase is to do scan code look up. Look up table output is ASCII characters or yet another level command codes. Letters are separated from other ASCII characters with a flag bit. This enables lower/upper case conversion for letters only.
Keyboard internal connector
1,2 = ground
connection between 3 and 5 keeps the keyboard running
7 = open collector TX
Simple quick and dirty 3,3V to RS232 level translator
NUE-PSK modem microcontroller dsPIC33FJ128MC706 contains two UART devices. In the NUE-PSK hardware UART#2 is directly connected to connector P4. Planned use for this connector is microcontroller firmware load/update. This connector can of course used for other duties as well.
NUE-PSK Piezo speaker
There is a miniature speaker in NUE-PSK board. Speaker is not used at least in current SW V1.2. I decided to use it to produce key click sound.
Modifications to the NUE-PSK firmware
All modifications to the NUE-PSK firmware should be done with extreme care. Modem DSP functions is very time critical real time tasks. My UART receive function is interrupt based very slim and fast operation. Keyboard logic is executed in the NUE-PSK main loop as the original keyboard functions. By the way original PS2 keyboard is untouched and operational as well. Key click generation is added to the 8kHz sample timer interrupt. This way no other timer interrupts are needed, click timing is good and overhead is low. More details can be found from sw source code.
OH2NLT modified firmware
Modified NUE-PSK firmware and source code can be found here. Project linker script is configured for direct load. If you like to use firmware with NUE-PSK Field programmer you should modify linker script and recompile the software.
2. I recommend 1N4148 diode over the Piezo speaker.
Connecting NUE-PSK with JUMA-TRX2
Link to NUE-PSK pages
Link to JUMA-TRX2 page