Keyboards. The PS/2 Protocol

Similar documents
PARALLEL COMMUNICATIONS

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

Communication. Chirag Sangani

Basics of UART Communication

ECE251: Thursday November 8

Locus Engineering Inc

PS232. RS-232 to PS/2 Keyboard Port Adapter Part # SA0009 (Version 4.0) Copyright 2003 L3 Systems, Inc. Redmond

Lecture 25 March 23, 2012 Introduction to Serial Communications

< W3150A+ / W5100 Application Note for SPI >

Carambola2 (-I) Data sheet. Carambola2 is a tiny surface mountable 2.4 GHz Wi-Fi module running OpenWRT linux software

Serial Communication. Simplex Half-Duplex Duplex

DIGITAL COMMUNICATION SWAPNIL UPADHYAY

C:\Users\jacob\Documents\MtSAC\ELEC74 Mt SAC - chipkit\homework Sheets.docx

Using the Z8051 MCU s USI Peripheral as an SPI Interface

Project Final Report Internet Ready Refrigerator Inventory Control System

Serial Communications

or between microcontrollers)

Unwired One. Main Features. Wireless embedded computer

Raspberry Pi - I/O Interfaces

SPI Universal Serial Communication Interface SPI Mode

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

Introduction USART & AVR EVK1100

Serial Communication. Simplex Half-Duplex Duplex

EMBEDDED SYSTEMS WITH ROBOTICS AND SENSORS USING ERLANG

COMP asynchronous buses April 5, 2016

Raspberry Pi. Hans-Petter Halvorsen, M.Sc.

Tektronix DPO Demo 1 Board Instruction Manual

Pmod ESP32 Reference Manual

Universität Dortmund. IO and Peripheral Interfaces

ARDUINO YÚN MINI Code: A000108

18-349: Introduction to Embedded Real-Time Systems

AN5123 Application note

P4S-341 User Manual > Introduction. Overview

ECE 471 Embedded Systems Lecture 20

Embedded Systems. 3. Hardware Software Interface. Lothar Thiele. Computer Engineering and Networks Laboratory

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

AN HI-3200 Avionics Data Management Engine Evaluation Board Software Guide

Serial Communication. Spring, 2018 Prof. Jungkeun Park

ESPino - Specifications

INTRODUCTION TO FLEXIO

Interfacing Techniques in Embedded Systems

Infineon C167CR microcontroller, 256 kb external. RAM and 256 kb external (Flash) EEPROM. - Small single-board computer (SBC) with an

Nano RK And Zigduino. wnfa ta course hikaru4

Prototyping Module Datasheet

Mega128-Net Mega128-Net Mega128 AVR Boot Loader Mega128-Net

Serial Interfacing. Asynchronous Frame

1.6inch SPI Module user manual

Advanced Embedded Systems

ECE 598 Advanced Operating Systems Lecture 6

Lecture 5: Computing Platforms. Asbjørn Djupdal ARM Norway, IDI NTNU 2013 TDT

Lesson 6 Intel Galileo and Edison Prototype Development Platforms. Chapter-8 L06: "Internet of Things ", Raj Kamal, Publs.: McGraw-Hill Education

First Steps to C Mastery

The PS/2 Keyboard and Mouse Interface

P4S-342 User Manual > Introduction. Overview

More on IO: The Universal Serial Bus (USB)

CSCI 6907 PROJECT PROPOSAL LIGHTS OUT MANAGEMENT

Serial Communications

1a)[2] Connect the devices on the left column to items on the right column. Keypad 4x4

DEV-1 HamStack Development Board

Centipede. Datasheet. Centipede is QCA AR9331 SoC based DIP platform with an integrated 2.4 GHz N (1x1) radio

LCD Display. Other I/O. LCD display Flash ROM SPI EPROM Keyboard (PS/2) UART connectors DAC ADC. 2-line, 16 character LCD display

64 bit Bare Metal Programming on RPI-3. Tristan Gingold

Amarjeet Singh. January 30, 2012

OUTLINE. SPI Theory SPI Implementation STM32F0 SPI Resources System Overview Registers SPI Application Initialization Interface Examples

PCB-STM32-F3U. Development baseboard for the STMicro Discovery-F3 module (STMicro part# STM32F3DISCOVERY)

pcduino V3B XC4350 User Manual

Microcontrollers and Interfacing

SPI Framework Module Guide

Desktop Reader and Wall Reader Adaptor USER MANUAL DOCUMENT REVISIONS

Raspberry Pi Compute Development board

EXPERIMENT 8: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

LinkSprite Technologies,.Inc. pcduino V2

Parallel Data Transfer. Suppose you need to transfer data from one HCS12 to another. How can you do this?

COMP 273 Winter asynchronous I/O April 5, 2012

1.5inch OLED Module User Manual

Systems Programming. Lecture 4 Z16 Architecture and Programming

ESP8266 Application Note Firmware Download Protocol

Cookie User Manual. For NuMicro Edition 1.0. Rev. 1.0 Release: forum.coocox.org.

Product Technical Brief S3C2440X Series Rev 2.0, Oct. 2003

Motherboard to MicroZed Interfaces

ARDUINO MEGA ADK REV3 Code: A000069

Digital Storage Oscilloscope

ECE 598 Advanced Operating Systems Lecture 4

Introduction the Serial Communications Parallel Communications Parallel Communications with Handshaking Serial Communications

MPX-24794S Serial USB Card

keyestudio Keyestudio MEGA 2560 R3 Board

Table of Content Introduction Installations Operations Appendices Troubleshooting Installation

Quick Start Guide TRK-KEA. Kinetis EA Series MCUs for Automotive Electronics Applications. StarterTRAK

CS341 *** TURN OFF ALL CELLPHONES *** Practice NAME

OEM API Specification

User Manual For CP-JR ARM7 USB-LPC2148 / EXP

SPI Xpress. Data sheet

Glomation. Embedded Single Board Computer GESBC-3130S User s Manual

To be familiar with the USART (RS-232) protocol. To be familiar with one type of internal storage system in PIC (EEPROM).

(Embedded) Systems Programming Overview

User Manual. LPC-StickView V3.0. for LPC-Stick (LPC2468) LPC2478-Stick LPC3250-Stick. Contents

EXPERIMENT 7: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

Raspberry Pi board. EB080

Digital Design Laboratory Lecture 6 I/O

ELET114A Bluetooth Module DATASHEET. Website: / 7

Transcription:

Keyboards The PS/2 Protocol

Debugging Always start from a known working state; stop in a working state. If it breaks, what changed? Take a simple small step, check it carefully, then take another small step. Programming is much simpler if you figure out a good order to write the code! Make things visible (printf, logic analyzer, gdb) Fast prototyping, embrace automation, 1-click build Systematic (D&C), not random, search for bug. Form hypotheses and perform experiments Don t be frustrated by bugs, relish the challenge

gpio timer uart printf malloc keyboard fb gl console shell

Serial vs. Parallel Figure from https://en.wikipedia.org/wiki/parallel_communication#/media/file:parallel_and_serial_transmission.gif

UART Used in your printf & the bootloader Start bit, data bits, (0 or 1), stop bits No clock, requires precise timing Figure from http://old.myhdl.org/lib/exe/detail.php/projects:rs232image.png?id=projects%3auart_rs232_receiver_transmitter

Synchronous vs Asynchronous Serial Protocols TX RX Peripheral UART Clock CPU MOSI MISO Peripheral SPI SS Clock Data Peripheral I2C Synchronous has a clock

PS/2 Keyboard PS/2 is an old serial protocol for keyboards (replaced by usb keyboards) Synchronous: CLK and DATA lines 6-pin mini-din connector

Keyboard Scan Codes http://www.computer-engineering.org/ps2keyboard/ Make (press) and Break (release) codes 0xF0 Key Action Scan Code A Make (down) 0x1C A Break (up) 0xF0 0x1C Shift L Make (down) 0x12 Shift L Break (up) 0xF0 0x12

Keyboard Scan Code Demo

PS/2 Protocol Data changes when clock line is high Read data when clock is low Payload: start bit, 8 data bits (lsb-first), parity bit, 1 stop bit (11 total) http://retired.beyondlogic.org/keyboard/keyboar1.gif

PS/2 Protocol Demo (logic analyzer)

Keys (Scan Codes) Characters Characters are printable ASCII control codes: tabs, form feeds, SOH, NAK Special keys - interpreted by the OS or App F1,, F12 Arrows, insert, delete, home, Keys with duplicated functionality Left and right shift, Numbers on keypad vs. keyboard CS148 Lecture 5 Pat Hanrahan, Fall 2011

å CS148 Lecture 5 Pat Hanrahan, Fall 2011

Keys Characters Modifier keys [SHIFT] [OPTION/ALT] [CTRL] [CMD] [FN] Keyboard Viewer CS148 Lecture 5 Pat Hanrahan, Fall 2011

Keys Characters Modifier keys [Shift] CS148 Lecture 5 Pat Hanrahan, Fall 2011

Keys Characters Modifier keys [Caps Lock] CS148 Lecture 5 Pat Hanrahan, Fall 2011

Keys Characters Modifier keys [Shift + Caps Lock] CS148 Lecture 5 Pat Hanrahan, Fall 2011

Keys Characters Modifier keys [Option] Orange = Dead Keys CS148 Lecture 5 Pat Hanrahan, Fall 2011

Keys Characters Modifier keys [Option-A] CS148 Lecture 5 Pat Hanrahan, Fall 2011

Layers (keyboard.h) unsigned char keyboard_read_scancode(void) returns scancode int keyboard_read_sequence(unsigned char seq[]) returns sequence of up to 3 scan codes (with PS2_CODE_RELEASE=0xF0, PS2_CODE_EXTEND = 0xE0) key_event_t keyboard_read_event(void) keeps track of modifier keys returns key_event struct : scancode, modifiers, action, unsigned char keyboard_read_next(void) maps key events to ASCII characters returns ASCII character, modifier and special keys >= 0x90

Parity Bits Parity = XOR of data bits Even/odd parity: an even/odd number of 1s (including parity bit) even odd data data data data data data data data parity 1 1 0 1 0 1 1 0 1 data data data data data data data data parity 1 1 0 1 0 1 1 0 0 Error in transmission Parity is not correct (one bit was flipped) Similar to checksum in boot loader

3.3V Switch

3.3V 3.3V Pull-up Pull-down

DATA and CLK lines are pulled up to 5V Switching on the transistor sets line to 0V Enables bidirectional communication (keyboard or Pi can provide data and clock)

PWM & Sound

Raspberry Pi Stereo Jack

Sound Waves

Pulse-Width Modulation (PWM) pwm_clock, pwm_range, pwm_width pwm.c

Stereo Jack connected to GPIO_PIN40 and GPIO_PIN45

tone.c melody.c audio.c

Continuous Values Can simulate continuous values with fast enough PWM clocking Like you did to control the LED brightness