CS150 Project Checkpoint 1. Controller Interface Dreamkatz Controller Interface 1. The N64 Controller 2. Physical interface 3. Communication protocol.

Post on 20-Dec-2015

221 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

CS150 ProjectCheckpoint 1

Dreamkatz Controller Controller InterfaceInterface

1.1.The N64 ControllerThe N64 Controller2.2.Physical interfacePhysical interface3.3.Communication protocolCommunication protocol4.4.Design structure and FSMDesign structure and FSM5.5.Design implementationDesign implementation6.6.Hints & cautionsHints & cautions

The Nintendo 64 The Nintendo 64 controllercontroller

The Dreamkatz Controller has 9 action buttons, a digital directional pad and an analog stick.

Fits nicely in the average person’s hand

The original connector end have been replaced with a DreamKatz compatible plug.

Has 3 pins: VCC, GND, DATA

Dreamkatz Controller Controller InterfaceInterface

1.1.The N64 ControllerThe N64 Controller

2.2.Physical interfacePhysical interface3.3.Communication protocolCommunication protocol4.4.Design structure and FSMDesign structure and FSM5.5.Design implementationDesign implementation6.6.Hints & cautionsHints & cautions

Establishing the physical Establishing the physical interface: interface: wire wrappingwire wrapping

Materials needed: wire wrap, wire wrap tool, and a little practice.

Wire wraps available from the IEEE office at 204a Cory. (Next door)

Pick three consecutive pins where controller will connect to.

Wire wrap according the diagram on the right.

Wrapping End Unwrapping End

Hole for Wire

Hole for Pin

Slot for Wire

Wire Stripper

three consecutive pins

GND P41 VCC

Dreamkatz Controller Controller InterfaceInterface

1.1. The N64 ControllerThe N64 Controller2.2. Physical interfacePhysical interface

3.3.Communication Communication protocolprotocol

4.4. Design structure and FSMDesign structure and FSM5.5. Design implementationDesign implementation6.6. Hints & cautionsHints & cautions

Establishing data Establishing data communication:communication:Protocol Specifications Part IProtocol Specifications Part I

One data line means it handles receiving and transmitting serially. The way you had input data into your LFSRs from a ROM this week is an example of a serial input.

Board sends a request and controller responds with its status.

000000011…

1 s 3 s

logic 11 s3 s

logic 0

Data line when IDLE, is high.

Bits are encoded, each 4us long:

Establishing data Establishing data communication:communication:Protocol Specifications Part IIProtocol Specifications Part II

Example, the above sequence is 0x01. This happens to be the request byte.Notice transmission always begins with a falling edge.MSB of the data is sent out first. The last bit is always a stop bit.After the request byte is sent, the controller will respond with a 32 bits of data and also a stop bit.Basically, each bit will correspond to a button.

0 0 0 0 0 0 0 1 stop bit

MSB first

Dreamkatz Controller Controller InterfaceInterface

1.1. The N64 ControllerThe N64 Controller2.2. Physical interfacePhysical interface3.3. Communication protocolCommunication protocol

4.4.Design structure and Design structure and FSMFSM

5.5. Design implementationDesign implementation6.6. Hints & cautionsHints & cautions

Design StructureDesign Structure

Three main blocks:Three main blocks:

Controller FSMController FSM

IDLE

REQUESTREQUEST

RECEIVINRECEIVING DATAG DATA

sub-FSM

sub-FSM

FSM TimingFSM Timing

Top-level FSM should cycle every 1ms as shown above.

We are basically polling the controller.

Thus, the idea is we have updated info on the controller button status every 1ms.

Transmission Timing Transmission Timing Transmitting should be done in the request state. The byte we send is always the request byte, 0x01.How to generate logic 1 and logic 0? 4Mhz clock each clock cycle lasts 250ns.Thus, logic 0: 12 cycles low, 4 cycles highThere is no idle time between consecutive bits.Remember: 9th bit must be a stop bit

Receiving is much trickier.

logic 0

4 us

000000011…

000000011…

Super-samplingSuper-sampling

Data rate is 250Khz, can we just stick the data wire to a shift register running on a 250Khz clock? NO

!Have to worry about phase shifts!

Serialdata input

Sample Here

Imagine the waveform going into your flipflops are all shifted in time!Communication between devices running on different clocks requires a special mechanism to synchronize receiving, known as SUPERSAMPLING.Watch the incoming wire at 16 times the send rate. (4Mhz vs. 250Khz)

Receive TimingReceive Timing

Line when idle is high. The start of a data stream is characterized by a falling edge.We can use that edge for synchronization.Count 5 or 6 4Mhz clock cycles after a falling edge run and then sample the wire.`

start of bitstart of bit start of next start of next bitbit

supersample interval = 250 ns

(4mhz clock)

sample sample herehere

Logic 1

Logic 0

Quick pause… questions?Quick pause… questions?

Dreamkatz Controller Controller InterfaceInterface

1.1. The N64 ControllerThe N64 Controller2.2. Physical interfacePhysical interface3.3. Communication protocolCommunication protocol4.4. Design structure and FSMDesign structure and FSM

5.5.Design Design implementationimplementation

6.6. Hints & cautionsHints & cautions

IO Block

Make sure there’s always a BUF corresponding to the type of PAD connected.

I/O Block & Clock dividerI/O Block & Clock divider

Clock divider

A counter can divide clocks by multiples of 2.Make sure you use a BUFG before sending the clock out.

Controller BlockController Block

Recall that P41 is wired wrapped to the data line.

And also that it serves as input and output of bits.

What’s problem if

HintsHints & & CautionsCautions

Counters! Shift registers! Counters! Shift registers!

Avoid the use of copy and paste in your schematics, ESPECIALLY IPADs and OPADs.

Oscilloscope…knows all.(Unless its probes are broken…)

top related