

C64UserPortMidi
Simple MIDI input and output interface using Commodore 64 user port. Utilizes an ATtiny2313 microcontroller and 6n138 opto-isolator.
- Size
- 62.5 × 47.5 mm
- Copper layers
- 2
- Thickness
- 1.6 mm
- Parts
- 25
- Nets
- 45
- Pads
- 108
- Tracks, vias
- 172, 21
- Pours
- 1
- Routed
- Yes
- KiCad
- KiCad 6 (file 20211014)
- Created
- 25 Feb 2021
- Updated
- 3 Jan 2023
Overview
C64UserPortMidi is an open-source printed circuit board by relic-se, from the relic-se/C64UserPortMidi repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 62.5 × 47.5 mm with 25 parts on 45 nets, routed with 172 tracks and 21 vias.
It is built around the ATTINY2313-20PU. Its parts include 7 resistors, 4 capacitors, 4 connectors, 2 ICs and 2 diodes. It belongs with the interfaces and adapters and retro computing and games boards and the AVR (ATmega, ATtiny) boards of this library.
Main components
1README
README.mdCommodore 64 User Port Midi Device
Simple Midi Input & Output via the Commodore 64 User Port Interface
Created by D Cooper Dalrymple 2021 - dcdalrymple.com
Licensed under GNU GPL V3.0
I found myself in possession of a Commodore SX-64 and a desire to make music with it. After quickly finding Cynthcart, I wasn't too happy about the idea of plugging both the Cynthcart cartridge and a separate Datel midi cartridge into in a Mini X-Pander+ all sticking out of the hood of my SX-64. I had assumed that the User Port would have been a great interface for transmitting the necessary midi input data to whatever SID program you're jamming with. That's where this project comes in.

Functionality
The concept is fairly simple: the stream of data from the midi input will be piped into a buffer by the microcontroller. After representing the value of each byte on the data bus of the user port (PB0-7), it will then trigger the user port's flag interrupt (FLAG2) to indicate new data is available. The compatible Commodore software that has an interrupt registered for the user port's flag pin then adds that 8-bit data register to a data buffer. The midi information would then need to be processed by the main loop of the software. Easy peasy!
I am aware that there are serial lines available on the user port that have been used for RS-232 communication and such, but I wanted to use the least amount of resources when transferring data from the bus to the Commodore software. A simple lda $DD01 is all that is necessary to get the full byte during a flag interrupt.
The 8 bits of the user port are bi-directionally connected to the microcontroller, and a data transfer back to the microcontroller can be flagged using the dedicated GPIO pin, PC2. This functionality can be used to send midi data back out through the Midi Out port and perform additional functionality that has yet to be developed (channel filters, etc).
Components
The microcontroller chosen for this project is the ATtiny2313. Using this micro reduces the total BOM by not requiring an external crystal oscillator, operating at 5V, including a hardware UART controller, and having just the right amount of GPIO.
Overall, the BOM is fairly minimal and using only through-hole components for easy assembly. To quickly get started making your own, I've assembled a Digikey shared cart with the exact hardware requirements and all of the necessary gerber files to order your own PCBs from a distributor such as PCBway.

Development Status
I've just completed revision A of the hardware design which migrated from the ATtiny13 to ATtiny2313 and removed the need for a shift register. I've also added the components required MIDI output since the new microcontroller should be able to handle UART transmission with ease.

The firmware hasn't yet been updated for this new board design, but the functionality should mostly remain the same within the C64 software. I'll provide examples of bidirectional data transfer showcasing the output functionality of the new board once any bugs have been worked out.
I advise from producing your own units until the hardware and software have been fully developed.
Software
A testing cartridge for the C64 is in development and mostly complete. This easily fits on a small 4kb/8kb lo-rom cart and could be compiled for floppy if needed. It can be run in emulation, but it isn't very useful unless the debugging data is enabled.
I plan to fork the Cynthcart repo once testing is completed to include full compatibility with this device.
Parts
25| Qty | Value | Footprint | References |
|---|---|---|---|
| 5 | 220 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R1, R2, R4, R5, R6 |
| 3 | 0.1uF | Capacitor_THT:CP_Radial_D5.0mm_P2.00mm | C1, C2, C3 |
| 1 | 10k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R7 |
| 1 | 10uF | Capacitor_THT:CP_Radial_D5.0mm_P2.00mm | C4 |
| 1 | 1N914 | Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal | D1 |
| 1 | 2N3904 | Package_TO_SOT_THT:TO-92_Inline | Q1 |
| 1 | 4.7k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R3 |
| 1 | 6N138 | Package_DIP:DIP-8_W7.62mm_Socket_LongPads | U2 |
| 1 | ATtiny2313-20P | Package_DIP:DIP-20_W7.62mm_Socket_LongPads | U1 |
| 1 | AVR-ISP-6 | Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_Vertical | J3 |
| 1 | C64-UserPort | Commodore64C:Connector_Edge_2x12_P3.96mm | J1 |
| 1 | LED | LED_THT:LED_D3.0mm | D2 |
| 1 | MIDI IN | Video Connectors:din-5 | J2 |
| 1 | MIDI OUT | Video Connectors:din-5 | J4 |
| 1 | MIDI Output Bypass | Jumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mm | JP1 |
| 1 | PC2 | TestPoint:TestPoint_THTPad_D1.5mm_Drill0.7mm | TP4 |
| 1 | PD4 | TestPoint:TestPoint_THTPad_D1.5mm_Drill0.7mm | TP1 |
| 1 | PD6 | TestPoint:TestPoint_THTPad_D1.5mm_Drill0.7mm | TP3 |
| 1 | RST Bypass | Jumper:SolderJumper-2_P1.3mm_Bridged_RoundedPad1.0x1.5mm | JP2 |
Similar boards
- 2 layers88 × 102 mm

- 2 layers174 × 80 mm

Keyb
coprolitebbs/ps2-keyboard
Самодельная клавиатура с интерфейсом ps/2. Собрана на Attiny2313A и сдвиговых регистрах 74HC595 и 74HC165.
115 parts7GPL-3.0 - 2 layers50 × 60.5 mm

- 2 layers437.8 × 127.8 mm

- 2 layers63.5 × 48.3 mm

- 2 layers170 × 50.5 mm

- 2 layers

- 2 layers91.4 × 53.3 mm

Questions
How big is the C64UserPortMidi PCB?
It measures 62.5 × 47.5 mm and has 2 copper layers, 1.6 mm thick.
What parts does the C64UserPortMidi use?
25 parts, built around the ATTINY2313-20PU. 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.
Where can I download the C64UserPortMidi KiCad files?
From the relic-se/C64UserPortMidi repository on GitHub, at the commit this page was made from: the board is hardware/C64UserPortMidi.kicad_pcb and its schematic hardware/C64UserPortMidi.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Can I use the C64UserPortMidi design in my own project?
Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).