
PS2-MSX F4
evandrosouza-developer/ps2tomsxUSB
This one is a full open design (electronics, pcb and firmware) of a PS/2 Keyboard adapter with USB console for use in MSX and other legacy computers - 15x8 matrix(BCD input - 8 bits "Low active" output).

This one is a full open design (electronics, pcb and firmware) of a PS/2 Keyboard adapter with USB console for use in MSX and other legacy computers - 15x8 matrix(BCD input - 8 bits "Low active" output).
PS2-MSX F1 is an open-source printed circuit board by evandrosouza-developer, from the evandrosouza-developer/ps2tomsxUSB repository on GitHub, published under the MIT licence. It is a 2-layer board of 55 × 65 mm with 35 parts on 57 nets, routed with 408 tracks and 0 vias.
It is built around the 2SC1815. Its parts include 18 resistors, 5 capacitors, 3 connectors, 2 transistors and 1 IC. It belongs with the retro computing and games boards and the STM32 boards of this library.
First of all, to people who use or had used MSX, welcome, bem-vindos, welkom, bienvenidos, добро пожаловать, 환영하다 and ようこそ, to visit my repository.
Instead of an application to this old japanese home computer standards is not so widely useful in nowadays, I made this to learn STM32 hardware and software technics, and I'd like it to be useful and let us back in time and make our MSX computer jewlers work with joyful to our pleasure.
The MSX Keyboard enviroment components (PS/2 to MSX Keyboard Converter, MSX Keyboard subsystem Emulator and the modifyed TIO - A simple terminal) are fully functional and debugged and here I used a lot of concepts that, IMHO could be used as idea sources to your applications.
This interface has the function of connect a PS/2 keyboard (or a USB one in compatibility mode) as source to TTL zero (low state) active matrix based computers, like MSX and ZX-Spectrum as destination. It is meant to connect a keyboard, which only provides a PS/2 connector, to a MSX (or any one that have a up to 15 active columns and reads zeroes througth 8 bits - up to 15 x 8 matrix) computer.
The differencial of this design is to allow user to customize and do a hot update of the database layout of this PS/2 Keyboard, as like as the MSX one, through an USB (or async serial) interface and a tty terminal on host side.
The default database mappings for the keyboard layouts are:
Source (PS/2 keyboard): 275 (ABNT2 layout - Brazilian Technical Norms Association);
Target: Brazilian Sharp/Epcom Hotbit HB8000 MSX.
This firmware was made to support both Blue Pill and Black Pill and it is part of the PS/2 to MSX Converter Enviroment, all of them in my github page, that consists:
1)The PS/2 to MSX Keyboard Converter itself, which contains:
1.1) The firmware with source files;
1.2) Doxygen full firmware documentation;
1.3) Schematics and PCB design:
1.3.1) Electronics part Schematics with Kicad files;
1.3.2) Single sided PCB layout with Kicad files and complete set of Gerber files;
1.4) The performance tests of this one are inside the PS/2 to MSX Converter Tester folder.
2)The PS/2 to MSX Converter Tester, which contains:
2.1) The firmware with source files;
2.2) Doxygen full firmware documentation;
2.3) Schematics design with Kicad files;
2.4) The performance tests of the PS/2 to MSX Keyboard Converter are located here.
3) Open tool to create/modify the Database (Translation tables to map from PS/2 Scan Codes to MSX Matrix Codes)
in excel, but it has compatible macros to be executed by Libre Office, Open Office and so on.
4) Tini TTY I/O - `tio` (Linux app with source files) to communicate with console and easily allowing the
user to use it with different keyboard layouts and languages.In case of STM32F103C8T6 (Flash 64K RAM 20K) Blue Pill, you have to aplly STM32F103C6T6 (Flash 32K RAM 10K) without change anything else.
In case of Black Pill, the base system is STM32F401CCU6 so, to use a more memory one, just follow the same instructions here.
This firmware powers and has been tested on the following Windows PS/2 keyboards, with brazilian 275 layout:
The inspiring code for the PS/2 module, a PS/2 to USB keyboard adapter, was originally developed based on Cherry G80-3000LSMDE.
Because Blue Pill has no 5V tolerant pins available to connect PS/2 + MSX + Serial + USB, unlike Black Pill. Even serial (UART) was feasibled using a 3.3V only port.
Although, this limitation came with a bonus: The need of a cheaper and greater availability 32KB flash MCU: STM32F103C6T6
libopencm3arm-none-eabi-gccarm-none-eabi-binutilsIf you plan to debug:
arm-none-eabi-gdbstlink + openocdObs.: If you plan to keep only one copy of LibopenCM3 in your computer, I strongly suggest you to setup the variable OPENCM3_DIR in our system enviroment.
After cloning the repository you need to make the following procedure:
Go to libopencm3 you cloned (eg: cd libopencm3) and make it to be useful by typing:
cd libopencm3
make TARGETS='stm32/f1 stm32/f4'Go to this ps2-msx-kb-conv (PS/2 to MSX Converter) project folder and assure that you choose the right target MCU in the system.h file line 69, and make, as follows:
With a plain text editor:
#define MCU STM32F401
or
#define MCU STM32F103Save the file, and,
Create the image file to be sent to the MCU (Micro Controller Unit):
makeThe created image, compiled with the Arm GNU Toolchain 14.2.Rel1 Released: December 10, 2024, on an aarch64 debian bullseye linux computer is created with the following characteristics, according to the choosen MCU:
arm-none-eabi-size ps2-msx-kb-convF4.elf
text data bss dec hex filename
35796 384 8436 44616 ae48 ps2-msx-kb-convF4.elf
arm-none-eabi-size ps2-msx-kb-convF1.elf
text data bss dec hex filename
27152 352 2492 29996 752c ps2-msx-kb-convF1.elfYou will obviously need a STM32F103C6T6 or a STM32F103C8T6 (F1 chip). I have used chinese blue pills. The software was made aiming in use of compatible processors, like GD32 for example.
The software was made considering 8.000Mhz oscillator crystal, to clock the STM32 microcontroller chip at 72MHz. I tested with both STM32F103C6T6 and STM32F103C8T6.
The connections are:
Obs.: You have to access PPI Ports B0 to B7 (Lines X0 to X7), Port C0 to C3 (Y0 to Y3), Port C6 (Caps Lock, pin 11 of DIP package), and for Russian, Arabic, Korean and Japanese Computers (Cyrillic and Kana alphabets), you have to get access to YM2149/AY3-8910 IOB7, pin 6 of DIP package, or, if your MSX is equipped with S1985(MSX-SYSTEM II), you have to have granted access to pins 71 and 72.
The connection is needed only to update internal PS/2 to MSX key mapping Database.
Config: 115200, 8, n, 1 (115200 bps, 8 bits, no parity, 1 stop bit);
Tx: A2
Rx: A3
Obs.: It is a only 3.3V port, compatible to TTL levels, so do NOT use it with "1" level higher than 3.3V!!
About physical connection: The connection has to be done with TX of your host system connected with RX of the PS/2 to MSX Keyboard Converter (device), and the device's TX has to be connected to host's RX.
You will obviously need a a F4 chip (STM32F401CCU6 or up, if using WeAct Mini F4 compatible black pill).
The software was made considering 25.000Mhz oscillator crystal, to clock the STM32 microcontroller chip at 84MHz. I tested with both STM32F401CCU6 and STM32F401CDU6.
The connections are:
Obs.: You have to access PPI Ports B0 to B7 (Lines X0 to X7), Port C0 to C3 (Y0 to Y3), Port C6 (Caps Lock, pin 11 of DIP package), and for Russian and Japanese Computers (Cyrillic and Kana alphabets), you have to get access to YM2149/AY3-8910 IOB7, pin 6 of DIP package, or, if your MSX is equipped with S1985(MSX-SYSTEM II), you have to have granted access to pins 71 and 72.
USB Type C: Needed only to update internal PS/2 to MSX key mapping Database. To create this Intel Hex file, better to use the Macro based Excel file, so you have to trust and enable macro excecution in excel app. The USB cable is the same as you use with yor mobile phone (USB Type-A Male x USB Type C Male).
Serial console: Same observations of USB are applicable here, with exception of the cable itself. Here the connection has to be done with TX of your host system connected with RX of the PS/2 to MSX Keyboard Converter (device), and the device's TX has to be connected to host's RX.
Config: 115200, 8, n, 1 (115200 bps, 8 bits, no parity, 1 stop bit);
Tx: A9
Rx: A10
Obs.: It uses a 5V tolerant port, which is compatible to TTL levels, so do NOT use it with "1" level higher than 5V!!
This design was developed to connect, as default, an ABNT-2 brazilian PC keyboard to the brazilian MSX Sharp/Epcom HB-8000, but it is very easy to apply a hot change of its mapping:
PS2toMSX_Database_Compiler.xlsm.To edit and compile the Database file, both source and target keyboard layouts, I prepaired a dedicated "key assembler in excel", so I can boldly recommend you to use the excel file PS2toMSX_Database_Compiler.xlsm available at github page.
The Database Compiler file has 3 sheets: One for HB-8000, the second as XP-800 and the third one as an International MSX. Unfortunately, the last one was not tested. Just fillin the table, click on the keyboard image of upper left of the current sheet and wait for VBA has been concluded.
The Database Compiler excel file exports the IHD.hex file (Intel Hex Database) to be hot applyed to PS/2 to MSX Keyboard Converter's Console, when this one boots up with no PS/2 Keyboard pluged in. Just follow console instructions. You may use tio as a terminal linux app to upload it.
I strongly suggest that the Black Pill board be pulled out from PS/2 to MSX Keyboard Converter board, as the power is going to be supplyed from USB and the heavy task to reconnect all will be saved, if you decided not to use the connector on the J1, which would simplify and make the task much safer.
There are 320 lines, so this structure is capable of manage up to 159 PS/2 keys, each key with make and break codes.
The first and last lines are reserved for control (Database version, Database unavailable: seek next, double consistensy check, among others);
On the first line there are information related to this Database version:
- Bytes 0, 1 and 2: Database version ("0x01", "0x00", "0xFF")
- Byte 3: Mapped function. Description:
| (bits 7-6): Reserved - keep it at high state;
| (bit 5): default value of enable_xon_xoff (true to enable it);
| (bit 4): default value of ps2numlockstate at power up (true to enable it);
| (bits 3-0): y_dummy (non valid colunm) - default value is 15 (0b1111);
- Bytes 4-7: Reserved - Keep it as 0xFFFFFFFF;
When this copy of the Database is let unavailable, the first line becomes ("0x00", "0x00", "0x00", "0x00", "0x01", "0x02",
"0x04", "0x08"), meaning to seek the next one.
On the line 319 (the last one) there are information related to this Database integrity:
- Bytes 0-5: Reserved - Keep each byte as 0xFF;
- Byte 6: CheckSum (Integrity);
- Byte 7: bcc (a vertical parity used for integrity);
Line 1 starts the raw of the Database:
The three first columns of each line are the mapped PS/2 scan codes;
Use a ST-Link v2 Programmer (or similar), Black Magic Probe or another Serial Wire supported tool to flash the program using make flash onto the STM32.
If you choose a Black Pill, even you don't have plans to develop, you earn a bonus: you will not have the need of a dedicated programmer like ST-Link, J-link or Black Magic Probe to download your code, as STM32F4x1 MiniF4 already comes with DFU (Device Firmware Upgrade) available in the system ROM to do so through USB. So, on linux, just follow these steps:
sudo apt install dfu-utillsusb command: 0483:df11. Run the command to flash the code itself:
dfu-util -d 0483:df11 -a 0 -s 0x08000000 -D ps2-msx-kb-convF4.binOn windows you can download STM32CubeProg on ST site, replacing step 2. You have to adjust step 6 to this tool. Please follow ST instructions.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 11 | 22R | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal | R1, R2, R3, R4, R5, R6, R7, R8, R9, R17, R18 |
| 4 | 10K | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal | R11, R12, R13, R16 |
| 2 | 100nF | Capacitor_THT:C_Disc_D4.3mm_W1.9mm_P5.00mm | C1, C5 |
| 2 | 220pF | Capacitor_THT:C_Disc_D4.3mm_W1.9mm_P5.00mm | C2, C3 |
| 2 | 33K | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal | R10, R14 |
| 1 | .01 | Kicad:SolderWire-0.25sqmm_1x01_D0.65mm_OD1.7mm_Relief.kicad_SM2000 | JP1 |
| 1 | 150K | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal | R15 |
| 1 | 2N2907 | Package_TO_SOT_THT:TO-92_Inline | Q2 |
| 1 | 2SC1815 | Package_TO_SOT_THT:TO-92_Inline | Q1 |
| 1 | 47uF x 10V | Capacitor_THT:CP_Radial_D5.0mm_P2.50mm | C4 |
| 1 | Conn_01x04 | Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical | J3 |
| 1 | Conn_01x04 | Connector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_Vertical | J2 |
| 1 | Conn_02x17_Odd_Even | Connector_PinHeader_2.54mm:PinHeader_2x17_P2.54mm_Vertical | J1 |
| 1 | Poly Fuse 300mA SMD 0603 or 1206 | BlueBlackPill:Fuse_1206_0603_3216Metric_Pad1.42x1.75mm_HandSolder | F1 |
| 1 | STM32F103C6T6 BluePill | BlueBlackPill:BluePill_1 | U1 |
The 31 most common of 35 parts.

evandrosouza-developer/ps2tomsxUSB
This one is a full open design (electronics, pcb and firmware) of a PS/2 Keyboard adapter with USB console for use in MSX and other legacy computers - 15x8 matrix(BCD input - 8 bits "Low active" output).

danwerner21/vic2020
A Vic-20 clone created with [almost] all readily available parts

GuitarML/GuitarPedalPCBs
Collection of KiCad circuit board designs for guitar pedals you can build yourself.



IdahoLabResearch/AcCCS
A collection of tools and scripts used to communicate and emulate Electric Vehicle Communication Controllers (EVCC) and Supply Equipment Communication Controllers (SECC).

StudioKAT/Toolbox
主な機能: - オーディオ/CVミキサー(加算・減算) - CVへのオフセット追加(5V/10V)・極性反転 - 1:3 バッファード・マルチプル - 2:2 ユニティミキサー - 3:1 アベレージミキサー(各チャンネルのゲイン = 1/3) - SIGNセクション:インバーター / 半波整流 / 全波整流 - LOGICセクション:アナログOR / アナログAND - S&Hセクション:サンプル&ホールド / ホワイトノイズ出力…


It measures 55 × 65 mm and has 2 copper layers, 1.6 mm thick.
35 parts, built around the 2SC1815. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the evandrosouza-developer/ps2tomsxUSB repository on GitHub, at the commit this page was made from: the board is Documentation/Kicad/F1/PS2-MSX-F1.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.
Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).