26
Project Check-off 2 UART Design Jeffrey Tsai

Project Check-off 2 UART Design

  • Upload
    lesley

  • View
    45

  • Download
    0

Embed Size (px)

DESCRIPTION

Project Check-off 2 UART Design. Jeffrey Tsai. Project Thus Far. Main Control FSM. Collision. SRAM. Packet Logic. UART IN. FIFO. UART OUT. FIFO. Audio Out interface. Audio In interface. UART. Message Definition Super-sampling Receiver Implementation Transmitter Implementation - PowerPoint PPT Presentation

Citation preview

Page 1: Project Check-off 2 UART Design

Project Check-off 2UART Design

Jeffrey Tsai

Page 2: Project Check-off 2 UART Design

Project Thus Far

FIFO

FIFO

SRAM

UARTIN

UARTOUT

Main ControlFSM

Collision

Audio Ininterface

Audio Outinterface

Packet Logic

Page 3: Project Check-off 2 UART Design

UART

Message Definition Super-sampling Receiver Implementation Transmitter Implementation Xilinx and Debugging tips (time

permitting)

Page 4: Project Check-off 2 UART Design

Message Definition A low start bit followed by 8 data

bits and a high stop bit. (clock is 250kHz)

The wire is normally high.StartIdle D0 D1 D2 D3 D4 D5 D6 D7 Stop Idle

Time

Figure 3: A UART transmission.

TX

TX_E

Page 5: Project Check-off 2 UART Design

Super-Sampling We watch the incoming wire at 8

times the send rate. (2MHz) This makes it so we can catch a

250Khz message even if its phase is different from our internal 250KHz clock.

Serialdata input

Sample Here

Page 6: Project Check-off 2 UART Design

Receiver Implementation Nick Weaver’s UART – Receive

design. Inputs: Serial-In, Reset, Clock Outputs: D[7:0], DRDY (data-

ready)UART

D[7:0]

DRDY.H

RESET.H

OE.L

SERIAL-IN.H

Clock

Page 7: Project Check-off 2 UART Design

How do I start?!? If the incoming message is 10 bits

in length, and we super-sample at 8x, the message is complete when we receive 80 bits of data.

How do we keep track of where I am in the message?

Page 8: Project Check-off 2 UART Design

8-bit Binary Counter 3 Inputs to figure out : R, CE, C CE is on as long as you are

receiving a new message C is the super-sampled clock

frequency, NOT the incoming baud rate

R is used to reset the counter once the message is complete

Page 9: Project Check-off 2 UART Design

Count Enable Should be high when the input

initially drops low for the start bit. Should stay high for the duration of

the message by means of a PROCEED signal.

CE = INPUT’ + PROCEED

Page 10: Project Check-off 2 UART Design

Clock You’ve seen how to divide clocks

already from previous labs. The clock that’s available on the board

already (not from the Xchecker) is 16MHz.

Use a binary counter to divide it. Sticky point: You send at 250kHz, you

sample at 2MHz, your circuit needs one faster than that. Probably 8MHz.

Page 11: Project Check-off 2 UART Design

Reset Should be reset when the counter

enable is low. When the RESET button on the board

is pressed, the counter should reset. When the message is done, and DRDY

goes high (data ready), this should be reset for safety/reliability reasons.

R = CE’ + RESET + DRDY

Page 12: Project Check-off 2 UART Design

PROCEED Intuitively, it should catch the first

super-sampled bit, and stay high for the duration of the message.

This should be done with a flip-flop. PROCEED = INPUT’ + PROCEED But we sample from the middle of

each signal, so instead, we use Q2 (3rd bit from right of the counter)

Page 13: Project Check-off 2 UART Design

There’s more! But this feedback loop will loop

high forever! So when DRDY or RESET is

asserted, PROCEED must be forced low.

PROCEED = DRDY’ RESET’ (Q2+PROCEED)

Page 14: Project Check-off 2 UART Design

Proceed (cont.)

Page 15: Project Check-off 2 UART Design

Shift Register Inputs the data serially and outputs

it to the rest of our design in a parallel fashion.

All we need to determine is CE for the shift register.

Since we sample on the forth super-sample per sample, just look at counter.

CE = Q0’ Q1’ Q2

Page 16: Project Check-off 2 UART Design

Why just the last 3 bits? 4 = 00000100 12 = 00001100 20 = 00010100 28 = 00011100 36 = 00100100 Etc.

Page 17: Project Check-off 2 UART Design

When do we stop? This design uses a 8-bit shift

register to save space. Thus, we don’t want the stop bit to be shifted in.

We want to stop at 9*8+3 = 75 75= 01001011 DRDY = Q6 Q3 Q2’ Q1 Q0 UART-RECEIVE IS DONE!

Page 18: Project Check-off 2 UART Design

UART-RECEIVE SUMMARY 8 Bit counter:CE = INPUT’ +

PROCEED R = CE’ + RESET + DRDY C = 2MHz Clk

Proceed: PROCEED = DRDY’ RESET’ (Q2+PROCEED)

Shift Register:CE = Q0’ Q1’ Q2DRDY = Q6 Q3 Q2’ Q1 Q0

Page 19: Project Check-off 2 UART Design

UART-RECEIVE (cont) Do not take this for granted! I defined the important signals, the

rest are trivial. Make sure you UNDERSTAND the

design rather than just plugging it in!

Page 20: Project Check-off 2 UART Design

What about transmit? Well, you tell me.

Figure 2: UART Transmitter symbol.

UART / TXD[7:0]

SEND.H

RESET.H

SERIAL-OUT.H (TX)

Clock

OUTPUT_ENABLE (TX_E)

Transmitting

Page 21: Project Check-off 2 UART Design

Specs for UART-Transmit The signal you send must comply with

our message definition. A interrupt input (reset) is needed so

back-off is possible. (remember that in the project, if what you read back isn’t what you wrote, you must stop transmitting)

Need TX_E to be high while transmitting and low otherwise.

Page 22: Project Check-off 2 UART Design

General Tips KISS (keep it simple stupid) If you

have no clue what your circuit does, chances are, neither does anyone else.

Don’t be afraid to play around with the signals in a way that makes it easy for you to debug.

Learn to use the oscilloscope!

Page 23: Project Check-off 2 UART Design

Playing with bus wires A complicated bus lets you

combine multiple wires together to form a bus.

Remember that a bus is just a collection of wires!

Useful if you a bunch of signals that aren’t named to same into a bus.

Page 24: Project Check-off 2 UART Design

Bus wires (cont.) Notice the Simple Box on top right

is unchecked (its checked by default)

Now I can specify each signal individually. Separate each one by comma.

Page 25: Project Check-off 2 UART Design

Bus wires (cont.)

Page 26: Project Check-off 2 UART Design

That’s All! Good luck and start early!