Exercise 3: Serial Interface (RS232)

Similar documents
Minimal UART core. All the project files were published on the LGPL terms, you must read the GNU Lesser General Public License for more details.

CIC ENGINEERING 345 CENTER STREET EAST PEORIA, IL PH FAX µmpis Control Software

Lecture #3 RS232 & 485 protocols

Design and FPGA Implementation of a High Speed UART. Sonali Dhage, Manali Patil,Navnath Temgire,Pushkar Vaity, Sangeeta Parshionikar

ST600 TRANSMITTER OPERATING INSTRUCTIONS

Technical description MT24. User manual WARNING GENERAL INSTRUCTIONS GENERAL DESCRIPTION

Manual IF2008A IF2008E

AR-DN-RS232. An-10 / Rapid RS232 Interface. Product Guide. Overview. Features

EE 314 Spring 2003 Microprocessor Systems

APPLICATION BULLETIN. SERIAL BACKGROUNDER (Serial 101) AB23-1. ICS ICS ELECTRONICS division of Systems West Inc. INTRODUCTION CHAPTER 2 - DATA FORMAT

Local Asynchronous Communication. By S.Senthilmurugan Asst.Professor/ICE SRM University. Chennai.

Ultrasonic Multiplexer OPMUX v12.0

Luminescence Sensors. Operating Instruction

I2C Demonstration Board I 2 C-bus Protocol

WIEG4PRT-A Four port Wiegand to RS232 Converter.

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

ScienceMode for the MOTIONSTIM8

Lab 6 Using PicoBlaze. Speed Punching Game

SV613 USB Interface Wireless Module SV613

For Direct computer control see the Data Out connector description. For Radio control see the Data In connector description.

VBRC 5. Radio Communicator. Installer Manual

USB Multifunction Arbitrary Waveform Generator AWG2300. User Guide

ROTRONIC HygroClip Digital Input / Output

Back to. Communication Products Group. Technical Notes. Local/Remote Control, 9300 Series

Electronics / Water analogy. Resistor. Inductance. Capacitor. Water Electronics Energy - Energy Pressure - Voltage Flow - Current Volume - Charge

Model 4xx. Plug-in Series Of FSK Modems USER GUIDE. (TI) 20 Jan 06 DWG: A GDI COMMUNICATIONS LLC PO Box I-80 Exit 1 Verdi, NV 89439

Ocean Controls KT-5221 Modbus IO Module

WTPCT-M. eeder. Pulse Counter/Timer Module. Technologies FEATURES SPECIFICATIONS DESCRIPTION. Weeder Technologies

Voltage regulator TAPCON 260

Modem 1200 baud 500FSD10 EDS500 series - FSK modems

PRODUCT MANUAL VHF & UHF Pocket Paging Transmitter. Version 1.00 April 2017

Design and Simulation of Universal Asynchronous Receiver Transmitter on Field Programmable Gate Array Using VHDL

WIE232-A Dual Wiegand to RS232 Converter.

CDR-915 Data Radio Module INTEGRATOR S GUIDE

2F. No.25, Industry E. 9 th Rd., Science-Based Industrial Park, Hsinchu, Taiwan Application Note of OGM220, AN001 V1.8

Applications. Operating Modes. Description. Part Number Description Package. Many to one. One to one Broadcast One to many

Home Automation, Inc. Omnistat2. RC-1000 and RC-2000 Communicating Thermostat. Serial Protocol Description

Embedded Radio Data Transceiver SV611

Asynchronous Serial Communications The MC9S12 Serial Communications Interface (SCI) Asynchronous Data Transfer

Radio Module for MHz. Band RMCx4-1 ; RMCx9-1

Answering frequently asked Questions (Firmware V.107)

Communication With NC-Module

WTDIN-M. eeder. Digital Input Module. Technologies FEATURES SPECIFICATIONS DESCRIPTION. Weeder Technologies

High power radio transmission module MR03 type

WTDOT-M. eeder. Digital Output Module. Technologies FEATURES SPECIFICATIONS DESCRIPTION. Weeder Technologies

LAX016 Series Logic Analyzer User Guide

Lab 2.2 Custom slave programmable interface

Artifex LIV 110. Laser Diode Characterization System. Engineering

Universal RS232/CMOS to RS422/RS485 Converter

Integrated Servo Motor UCS57

CONV232/422 SERIAL DATA CONVERTER

The MP SERIES CONTROLLER. User s Manual. ISE, Inc.

User manual. Inclinometer with Analog-RS232-Interface IK360

Universally Applicable for Piezoelectric Measuring Technology. Technical Data. Charge Input. Instant value. Extreme values ors statistic measurements

Universally Applicable for Piezoelectric Measuring Technology. Technical Data. Charge Input. Extreme values ors statistic measurements

isys-4004 GUI interface - V2.1 Power up Initialize Peripheral Start Measurement YES LED flashes red Object available LED blinking

VBRC 4. Radio Communicator. Installer Manual

Low Power with Long Range RF Module DATASHEET Description

Voltage regulator TAPCON 240

Charge Meter. Electronics & Software. Universally Applicable for Piezoelectric Measuring Technology. Type 5015A...

Mastr III P25 Base Station Transmitter Tune-up Procedure

RF1276 Long Distance Transceiver module V2.0

Roland Kammerer. 13. October 2010

Catalog

AT-XTR-7020A-4. Multi-Channel Micro Embedded Transceiver Module. Features. Typical Applications

Hardware Design with VHDL Design Example: UART ECE 443

HR1200. Version 1.00 ATIM RADIOCOMMUNICATION 1/11

E205 Long Range Wireless Modem V1.0 Data Sheet

Wireless Communication Modem HG 761

IP 251 Universal Signal Converter SSI parallel RS232 parallel SSI RS232

ECE 4510/5530 Microcontroller Applications Week 6 Lab 5

TD_485 Transceiver Modules Application Guide 2017

Select the single most appropriate response for each question.

EG medlab. Three Lead ECG OEM board. Version Technical Manual. Medlab GmbH Three Lead ECG OEM Module EG01010 User Manual

Tarocco Closed Loop Motor Controller

Line-to-line RMS Volts, 3 phases 4 digits (XXX.X) Volts

Serial Input/Output. Lecturer: Sri Parameswaran Notes by: Annie Guo

Application Note: Demonstrating CAN with nqbasic

Operation. Displayed channel. Measuring range. Status indication/ remote control Key lock Measuring mode/ time constant. Scale.

Texas Instruments Registration and Identification System. Micro-reader RI-STU-MRD1. Reference Manual

R5 RIC Quickstart R5 RIC. R5 RIC Quickstart CONTENTS. Saab TransponderTech AB. Appendices. Project designation. Document title

SonoLab Echo-I User Manual

UNIVERSITI MALAYSIA PERLIS

NEC Display Solutions of America, Inc. UM361X & UM351W Installation Guide Desktop and Ceiling Mount v1.0

Stensat Transmitter Module

ALPHA Encoder / Decoder IC s

PIEXX UX-14(PX) Plus Installation Instructions

RF RECEIVER DECODER RDF1. Features Complete FM Receiver and Decoder. Applications

CL4490 HARDWARE INTEGRATION GUIDE VERSION 1.0. FCC Notice.

EE 209 Lab Range Finder

3V TRANSCEIVER 2.4GHz BAND

Carbon Dioxide (Tiny CO2) Gas Sensor. Rev TG400 User Manual

µchameleon 2 User s Manual

Catalog

THETA DIGITAL. Digital Done Right. Generation VIII. RS232 Control Protocol V 1.02

HC08 SCI Operation with Various Input Clocks INTRODUCTION

TCSS 372 Laboratory Project 2 RS 232 Serial I/O Interface

HC-12 Wireless Serial Port Communication Module

200 us/2 ms/20 ms/200 ms, TDS ( PPM ) Real time data logger, Data logger no., RS232 CONDUCTIVITY METER Model : YK-2005CD

SV-MESH Mesh network series Catalogue

Transcription:

Exercise 3: Serial Interface (RS232) G. Kemnitz, TU Clausthal, Institute of Computer Science May 23, 2012 Abstract A working circuit design for the receiver of a serial interface is given. It has to be examined and tested. Afterward the corresponding transmitter has to be designed and the receiver has to be extended by additional functions. 1 RS232 The PCs in the exercise room and the experimental board are linked by a serial cable through which data may be transmitted in byte. From the 9-pin SUBD-plug of a serial terminal only 3 pins are used: Pin 2: RxD, input receiver Pin 3: TxD, output transmitter Pin 5: ground A zero is represented by a negative and a one by a positive voltage. The conversion of the usual logic levels high and low to positive and negative voltages is done in a special circuit, at the experimental board in IC14. In the ucf-file the receiver input is named RxD and the transmitter output TxD. The transmission is organized byte-wise. During transfer pause the transmitted signal is TxD= 1. Each data package starts with a start bit 0. Then follow 8 data bits, an optional parity bit and a stop bit that is 1 (see figure 1). After the stop bit the start bit of the next transmission may follow or the transfer pauses. The parity bit is the modulo-2- or EXOR-sum of the data bits and is used for error-detection. start bit 8 data bit parity bit stop bit (optional) 0 D(0) D(1) D(2) D(3) D(4) D(5) D(6) D(7) P 1 bit time = 1/baude rate Figure 1: Data frame of an RS232 transmission The transmitter of a serial terminal consists of a circuit to provide the clock and Tel. 05323/727116 1

an automaton to transform a byte to a data sequence corresponding to the protocol. The basic clock CLK on our experimental board has a frequency of 50MHz. This clock is usually first divided to a frequency 16 times higher then the baud rate and a duty cycle 1:1: process ( c l k ) variable counter : i n t e g e r range 0 to c T e i l e r 1 := c T e i l e r 1 ; begin i f r i s i n g e d g e ( c l k ) then i f counter = 0 then clk 16x baud <= not clk 16x baud ; counter := c T e i l e r 1 ; else counter := counter 1 ; end i f ; end i f ; end process ; The following tabular shows denominator values for various baud rates: baud rate cteiler (basic clock 50 MHz) 2,4 kbaud 648 4,8 kbaud 324 9,6 kbaud 162 19,2 kbaud 81 The clock clk 16x baud is divided by 16 in a subsequent divider (4 bit counter) and used as transmitter clock. The transmitter automaton should be specified as a state graph. As long as there are no transmission, the automaton stays in the pause state and keeps the transmission line TxD = 1. If a transmission starts the automaton goes through the states: send start bit: TxD<= 0 send bit 0: TxD<=D(0)... send bit 7: TxD<=D(7) send parity bit: TxD<=D(0) xor D(1) xor... xor D(7) send stop bit (TxD<= 1 ) The data to be transmitted are generally produced by a circuit that is not clocked with the baud rate. To pass the data to the transmitter a handshake protocol is required (figure 2): the data source sets the request signal req to 1 and provide data at the bus Din. the serial sender receives the data as soon as it is ready for reception and acknowledges receipt by grant<= 1. serial sender submits the data. serial sender waits on withdraw of the request (wait on req= 0 ) and deactivates grant. Waiting on the next request. Send- and handshake sequence have to merged to one state graph, whereby only the sampled request signal should be processed (figure 3). 2

req_del= 1 grant<= 1 D<=Din ct:=0 send start bit pause/stop bit TxD<= 0 TxD<= 1 ct=7 and req_del= 0 grant<= 0 req_del= 0 grant<= 0 wait on with draw of req_del TxD<= 1 sende bit TxD<=D(ct) ct<7 ct:=ct+1 ct=7 and req_del= 1 ct Din req_del grant bit counter data to be transmitted sampled request signal acknowledge signal Figure 2: State graph of the transmitter with handshake Remarks: The automaton in figure transmits data without parity bit. The transmitter is described by an operation graph, which nodes control a counter and at which edges counter values are evaluated. The description also may be changed so, that the bit to be send is distinguished by the automaton state instead of the counter state. The data type of the counter signal should be an integer with a range from 0 to 7 to select one of 8 bits from D. The receiver works with the same baud rate as the transmitter. From this he knows the bit time. About the start time it is informed indirectly by the falling edge at the begin of the transmission. From start time and bit time the sample times for the single bits have to be calculated. The solution includes the 1:16 prescaler. The receiver starts as the transmitter with the pause state. Instead on a transmit requests it waits on a falling edge of the sampled receive signal RxD del. The signal RxD here has to be sampled with a several times higher rate, in the example the 16 times higher rate than the baud rate. As soon as the data line turns to zero, the automaton switches to the next state and sets the prescaler to zero. All further state transitions are performed when the prescaler reaches half of its maximum value, i.e. in the middle of the time between two state transitions of the sender, when the submitted data are stable and valid. During the first state transition a zero is expected on receiver line (start bit). With the 2. to 9. state transition data bits are sampled. During the 10th transition it will be checked that the stop bit is one. In case an additional parity bit is transferred for error detection, it also has to be sampled and checked. The transfer of the received data to the following circuit generally is done via a handshake protocol (figure 3): after an error-free reception of a byte the serial receiver activates a write request signal waits on an acknowledge and deactivates the request signal waits on deactivation of the acknowledge signal. Remarks: No parity bit. vt is a counter modulo 16. 3

RxD del= 0 else vt<=0 err<= 0 wait pause gr del= 0 wait on withdraw acknowledge gr del= 1 gr del= 1... <= DI gr del= 0 vt=7 wait on acknowledge test start bit err<=err or RxD del ct<=0 err=0 req<= 1 err= 1 else vt=7 vt=7 and ct<7 ct<=ct+1 sample data DI(ct)<=RxD del vt=7 and ct=7 test stop bit err<=err or (not RxD del) Figure 3: State graph of the receiver with handshake ct must have as for the transmitter the type integer range 0 to 7 to select 1 out of 8 bits in DI. The transmitter is described by an operation graph, which nodes control a counter and at which edges counter values are evaluated. The description also may be changed so, that the bit to be send is distinguished by the automaton state instead of the counter state. 2 Test of the example design Download the files a3 rs232.xise, a3 rs232.vhd and a3 rs232.ucf from the web page in a project folder in your home account. Open the project and then the VHDL-file a3 rs232.vhd with ISE. 1. Reconstruct the state graph of the receiver from the file a3 rs232.vhd and draw it on paper. Compare the so found graph with figure 3. (a) Does it include a parity check? (b) What baud rate is configured? (c) Does the automaton include handshake? (d) How works th echo function? 2. Translate the design and program it into the FPGA. 3. Start a serial terminal on the PC, under Linux use GtkTerm : (a) Anwendungen => Accessories => Serial port terminal Select transmission parameters via the configuration menu Port öffnen. Settings: Port: /dev/ttys0, Speed: 9600 bits per second, Parity: even, Bits: 8, Stop bits: 1, Flow control: none Under Windows use putty Start All Programs... Connection Serial Open Putty select serial terminal settings via 4. Test connection: Send after another the numbers 0 to 9 from the PC to the FPGA and check, that on led(7 downto 0) the corresponding ASCII-Codes 30h to 39h is displayed. 4

3 Design exercises 1. Plug the logic analyzer to the pins DB0 (RxD) and ADR0 (TxD) of the test point header module on expansion connector A2. Download from the web page the file a3 rs232.xml. Adjust the sampling rate and the trigger condition for recording the serial signal from the PC. Why did you select this settings? 2. Design a send automaton, which on pressing button BTN0 sends byte SW(7 downto 0) to the PC. Attention, don t forget de bouncing. Write the send automaton in a new file. Use the following entity description: entity a 3 r s 2 3 2 s e n d e r i s port ( clk 16x baud : in s t d l o g i c ; txd : out s t d l o g i c ; data : in s t d l o g i c v e c t o r (7 downto 0 ) ; req : in s t d l o g i c ; grant : out s t d l o g i c ) ; end entity ; Simulate the automaton with the test-bench a3 rs232 tb.vhd from the web and test the circuit on the board. The logic analyzer may be helpful for trouble shooting. 3. Modify the receiver circuit so that on the two left 7-segment display digits the last received byte is displayed as two hexadecimal numbers. Add a parity check in stage 9 of the automaton and that possible errors are displayed at LED11 of the expansion board traffic light control / number lock at B1. 4 Check list for the compliance test State graphs of the send and the receive automaton on paper. presentation of the measurement results with the logic analyzer Simulation and presentation of the send automaton changes to the receiver. 5