In another project, I already used the Cypress CY8CKIT-059 development board to generate a monochrome VGA display and run the Conway Game of Life on it.
In this project, I use the same configuration and added a connection to a PS/2 keyboard. This allows the board to receive keystrokes from the attached keyboard, send them through a serial line. It can also receive data from the serial line and display this on the VGA screen attached. If you connect the serial input and output together, the keystrokes will appear on the screen.
Hardware UsedThe CY8CKIT-059 is a small and cheap development board that contains the PSoC5LP arm M3 processor. However, in contrast with most of development boards from other manufacturers, it also contains hardware building blocks that can be programmed to custom logic circuits, similar to FPGA's. I have used this to create custom hardware blocks to do the communication to the VGA screen and to the keyboard. Therefore very little additional hardware is needed to connect the keyboard and the vga monitor. It also leaves room for the processor to run other tasks. The picture shows the processor kit on a breadboard with all the components needed to create a video terminal. It is powered by an USB connection to the computer. This connection is also used to download the program into the processor. I did separate the target device from the programming device (called kitprog) and used a socket and pins to connect them together again. If you do so, you will cut the I2C and serial lines, that otherwise make connection to the target processor. They are not needed to program the device.
The following picture shows the breadboard being powered by battery. The kitprog device has also been removed. Please note that the keyboard may draw a considerable amount of power.
The development board has a micro usb connector. This connector cannot be used to program the device, but it us possible to use it from powering the board (and the keyboard) with a standard usb charger. If you want to use it, be sure to solder it properly, put a wire over it and solder that to the connector and through the holes in the print. I found out the it was only soldered with the smd pins and that it come off the print if it was not soldered more properly.
VGA connectionThe vga display rate is 1280 x 720 pixels at 60Hz. This would result in a pixel clock of 74.25 MHz. Because this data rate is too high for the hardware and because not enough ram memory is available to store pixel data, the actual pixel clock is 37MHz, which is nearly half the required frequency. In order to have square pixels, all video lines are repeated, so the effectively visible pixels are reduced to 640x360. This resolution is still sufficient to display 80x25 characters with a nice large font. An 80x25 display is what was used by many video terminals, like the VT100.
Keyboard connectionThe processor handles keyboard data. The protocols handled are 11 bit bidirectional serial data as sent by XT, AT and PS/2 keyboard. The physical connection is a data line and a clock line (5V). USB keyboards are not supported.
For a good description of how these keyboards communicate, see the following document: https://oe7twj.at/images/6/6a/PS2_Keyboard.pdf (the original link referred to in the document seems no longer to exist).
When scancodes are received from the keyboard, they will first be converted from the current scanset (1, 2 or 3) to the USB scancodes. This is to have a standard way of looking up the actual characters, which may be different for different keyboard layouts. Find out more about scancodes in above document.
Once scancodes are converted, they can be looked up in a table along with the current modifier keys (shift, left-alt, right-alt). Then, finally they can be displayed on the screen or sent over the serial line.
Serial communicationThere is only one UART, but you can select which pins to use in the setup page.
Pins 12.6 and 12.7 are internally connected to pins 12.7 and 12.6 of the kitprog. This allows you to send and receive data through a usb connection to a computer with a terminal program (eg putty). If you separate the kitprog from the main board, these pins become disconnected, but you can connect them manually (if you want to). Make sure to connect Rx to Tx and Tx to Rx (12.6 to 12.7 and 12.7 to 12.6)
Pins 12.3 (Rx) and 12.4 (Tx) are not connected and can be used to connect to another device. The levels are CMOS and because the kit is powered by 5V, the high level will also be 5V.
In this new version, it is also possible to change the baudrate between 3600 baud and 115200 baud. The default is 19200 baud. In order to check, the clock is available on pin 2.3 and is 8 times the selected baudrate.
If you want RS232 signals. you can add a MAX232 chip or similar to convert the TTL levels to RS232 levels. If you want to connect to a 3.3V computer, like a Raspberry, be sure to add a level convertor.
The serial protocol can be changed. For instance, it is possible to use a cp1252 character encoding or also UTF-8. The most common ANSI escape sequences will also be sent and understood when received back. For instance, the cursor movements (up, down, left, right and home).
Special KeysWhen you hit the F12 function key, you will get a menu that allows you to modify the default settings.
Keyboard settings:
Newline (ON, OFF)
Auto Repeat (ON, OFF)
Keyboard Layout (US, US-INTL, BELGIAN, UK, GERMAN)
Scanset (AUTO, 1, 2, 3)
Screen Settings:
Foreground Color (Black, Red, Green, Yellow, Blue, Cyan, Magenta, White)
Background Color (Black, Red, Green, Yellow, Blue, Cyan, Magenta, White)
Cursor
Text Size X (1, 2, 3, 4)
Text Size Y (1, 2)
Wrap Around (ON, OFF)
Communication Settings:
Line Local (ON, OFF)
Character Set (UTF-8, Win 1252, ISO-8859-1)
The CODEYou will need to get hold of your copy of PSoC Creator from the Infineon website and install it. Unzip the zip file into a directory of your choice and open the.cywrk file from within PSoC Creator. Build it and flash it to your Cypress development board.
Future StepsBecause there is still ram and processor power left, it would be possible to play games. The processor has 256kbytes of flash memory on board. Less than 10% is used, so it is very well possible to add some other nice stuff. Possibly, a basic interpreter.
Useful links:
Comments
Please log in or sign up to comment.