Skip to content
This repository has been archived by the owner on Aug 17, 2021. It is now read-only.

Write the PS/2 keyboard/mouse controller firmware #50

Open
thejpster opened this issue Jan 16, 2019 · 2 comments
Open

Write the PS/2 keyboard/mouse controller firmware #50

thejpster opened this issue Jan 16, 2019 · 2 comments

Comments

@thejpster
Copy link
Owner

The AtMega48 drives the two PS/2 ports and the LPT port. It'll need firmware.

There's only 4 KiB flash and 512 bytes RAM so it'll need to be compact!

I propose a basic command/response protocol:

Commands:
0x00 - Reset to serial bootloader (may not implement this)
0x01 - Get keyboard data
0x02 - Get mouse data
0x03 - Get LPT status
0x04 <data...> - Write LPT bytes to buffer
0x05 - Write LPT status bits x
0x06 - Set keyboard LEDs x

Responses:
0x00 - Will reboot
0x01 <data...> - Keyboard data (raw PS/2 Scan Code Set 2)
0x02 <data...> - Mouse data (raw PS/2 mouse data bytes)
0x03 - LPT status
0x04 - Write LPT byte confirmed
0x05 - Write LPT status confirmed
0x06 - Write keyboard LEDs confirmed

This should keep the number of bytes in the Cortex-M4's UART buffer to a minimum (it's only 16 bytes long), and allow the Cortex-M4 to only ask for keyboard data when it's not drawing video.

The AtMega48 will handle keyboard init and mouse init on start-up. It will also handle the handshaking with the printer.

@thejpster
Copy link
Owner Author

Ugh. I couldn't face writing C or C++ for AVR so I bought some STM32F0 chips in TSSOP-20 package, and some TSSOP-20 to DIP adaptors.

On the next PCB revision, the PS/2 connectors will be on a riser PCB with the keyboard controller. You can then remove this and fit a USB keyboard controller instead if desired.

@thejpster thejpster changed the title Write the AtMega48 firmware Write the PS/2 keyboard/mouse controller firmware Aug 18, 2019
@thejpster
Copy link
Owner Author

You could even do a riser board which supported a scan matrix GPIO keyboard (e.g. a C64 keyboard, or an Amiga keyboard).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant