ECE/CS 5780/6780: Embedded System Design

Similar documents
CS/ECE 5780/6780: Embedded System Design

A B C D E F 0480 FE B F5 3B FC F3 E 1A 1D 2A 2D 3A 3D 4A 4D 5A 5D 6A 6D 7A 7D

Asynchronous Data Transfer

HCS12 Serial Communications Interface (SCI) Block Guide V02.06

ECE/CS 5780/6780: Embedded System Design. Introduction to Serial Communication

Introduction to Serial Communication. ECE/CS 5780/6780: Embedded System Design. A Serial Channel. Definitions. SCI versus SPI.

CS/ECE 5780/6780: Embedded System Design

Dallas Semiconductor DS1307 Real Time Clock. The DS 1307 is a real-time clock with 56 bytes of NV (nonvolatile)

Review for Exam 3. Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions

SCI Serial Communication Interface

Lecture 13 Serial Interfaces

Synchronous = SPI (3 options)

Configuration of Local Interconnect Driver Based on AUTOSAR Standard

Freescale Semiconductor, I

MCO556 Practice Test 2

Lab 8 RS232 October 22, 2015

EE 3170 Microcontroller Applications

A Synthesizable VHDL Model of the Serial Communication Interface and. Synchronous Serial Interface of Motorola DSP56002

EE345L Spring 2004 Final Version 3 Page 1 of 8

Concepts of Serial Communication

EE 354 November 13, 2017 ARM UART Notes

Hello, and welcome to this presentation of the STM32 Low Power Universal Asynchronous Receiver/Transmitter interface. It covers the main features of

ECE251: Thursday November 8

1. Specifications Functions Used Operation Software Flowcharts Program Listing... 13

AN Multifunction Serial Interface of FM MCU. Contents. 1 Introduction

Fig.12.5 Serial Data Line during Serial Communication

Module 3.F. Serial Communications Interface (SCI) Tim Rogers 2017

EE345L Spring 2006 May 10, 2006, 2-5pm Page 1 of 8

27.7 SCI Control Registers

ECE/CS 5780/6780: Embedded System Design

General Features of Interrupts. ECE/CS 5780/6780: Embedded System Design. Stack Before and After an Interrupt. Sequence of Events During Interrupt

COMP2121: Microprocessors and Interfacing

Serial Communication Prof. James L. Frankel Harvard University. Version of 2:30 PM 6-Oct-2015 Copyright 2015 James L. Frankel. All rights reserved.

EE445L Fall 2010 Final Version A Page 1 of 10

CoE3DJ4 Digital Systems Design. Chapter 5: Serial Port Operation

SECTION 5 RESETS AND INTERRUPTS

Lab 7: Asynchronous Serial I/O

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

RL78 Serial interfaces

Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar

Interfacing a Hyper Terminal to the Flight 86 Kit

Objectives. Introduction

CS/ECE 5780/6780: Embedded System Design

EEE310 MICROPROCESSORS M. Fatih Tüysüz CHAPTER 7

8051SERIAL PORT PROGRAMMING

Serial Communication

Hierarchy of I/O Control Devices

Clock. EE345L Spring 2003 Final Page 1 of 6. April 9, 2003, 1:00pm-1:50pm. (5) Question 1. Choose A-F. (5) Question 2. Choose A-E. (5) Question 3.

MCS-51 Serial Port A T 8 9 C 5 2 1

Asynchronous & Synchronous Serial Communications Interface. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

Understand the design and operation of the SCI and the I 2 C, IrDA and Smart Card interfaces

ECE 598 Advanced Operating Systems Lecture 6

Lecture #11 Serial Ports Embedded System Engineering Philip Koopman Wednesday, 17-February-2016

CprE 288 Introduction to Embedded Systems (UART Interface Overview)

Addressing scheme to address a specific devices on a multi device bus Enable unaddressed devices to automatically ignore all frames

General Features of Interrupts. ECE/CS 5780/6780: Embedded System Design. Sequence of Events During Interrupt. Stack Before and After an Interrupt

Embedded Systems and Software. Serial Communication

Informatics for industrial applications

UART. Embedded RISC Microcontroller Core Peripheral

Embedded Systems and Software

AN Sleep programming for NXP bridge ICs. Document information

CAN Node using HCS12

8051 Serial Communication

ECE/CE 3720: Embedded System Design

ECE/CS 3720: Embedded System Design (ECE 6960/2 and CS 6968)

LABORATORIO DI ARCHITETTURE E PROGRAMMAZIONE DEI SISTEMI ELETTRONICI INDUSTRIALI

USART Register Description

Universal Asynchronous Receiver / Transmitter (UART)

ECE 598 Advanced Operating Systems Lecture 6

Lecture 10. Serial Communication

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features

F28335 I2C MODULE v1.1

1. Specifications Applicable Conditions Operational Overview of Functions Used Principles of Operation...

Asynchronous Transmission. Asynchronous Serial Communications & UARTS

General-Purpose Input/Output. Textbook: Chapter 14 General-Purpose I/O programming

Chapter 11: Input/Output Organisation. Lesson 05: Asynchronous RS232C Serial Port data transfer

CDP68HC68S1. Serial Multiplexed Bus Interface. Features. Description. Ordering Information. Pinouts. April 1994

TMS470R1x Serial Communication Interface (SCI) Reference Guide

Special Memory (SM) Bits

ATmega128 USART. Overview

Tutorial Introduction

Serial Communication with PIC16F877A

Asynchronous Transfer of Data with Appended CRC Codes via an SCI Interface

Administrivia. ECE/CS 5780/6780: Embedded System Design. FIFO with Infinite Memory. Introduction to FIFOs

1 = Enable SOD 0 = Disable SOD. Serial Output Data. Fig.12.9 SIM Instruction Format

Software Architecture Document: Addendum

1. Specifications Operational Overview of Functions Used Principles of Operation Description of Software...

School of Computer Science Faculty of Engineering and Computer Science Student ID Number. Lab Cover Page. Lab Date and Time:

UART: Universal Asynchronous Receiver & Transmitter

Sender Receiver Sender

=0 Read/Write IER Interrupt Enable Register =1 Read/Write - Divisor Latch High Byte + 2

19.1. Unit 19. Serial Communications

CHAPTER 5 REGISTER DESCRIPTIONS

Lab 13 Real Time Debugging

Faculty of Engineering and Information Technology Embedded Software. Lab 1 Tower Serial Communications

Hello, and welcome to this presentation of the STM32 I²C interface. It covers the main features of this communication interface, which is widely used

Using UART in radio data transmission with the CDP-02 module By Tomihiko Uchikawa

Freescale Semiconductor, I

Device: MOD This document Version: 1.0. Matches module version: v3 [29 June 2016] Date: 23 October 2017

HP 48 I/O Technical Interfacing Guide

Transcription:

ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 16: SCI Register Configuration and Ritual Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 1 / 19 Administrivia Schedule This is the last lecture whose material will be on Midterm 2. 3/25 is a midterm review lecture. 4/01 is the exam. 6780 projects...get started...please! Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 2 / 19

SCI Register Information & Terminology The information in this lecture is found: Textbook pages 346-9. Chapter 13 of the MC9S12C Family Reference manual (MC9S12C128V1.pdf) which starts at page 383. Break character: all logic 0s with no start, stop, or parity bits. Idle character: all logic 1s with no start, stop, or parity bits. Preamble: synchronizing idle character that begins the first transmission. Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 3 / 19 SCIBD Configuration SCIBD sets the baud rate. SCIBD is a 16 bit register, but only the bottom 13 bits are used. SCI baud rate = Mclk/(16*SCIBD). A value of 26 (decimal) corresponds to a baud rate of 9600 for our MCU. Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 4 / 19

SCICR1 Configuration I Bit 0 - Parity Type (PT) 0 - Even parity 1 - Odd parity Bit 1 - Parity Enable (PE) 0 - Disable parity 1 - Enable parity Bit 2 - Idle Line Type (ILT) 0 - Idle character bit count begins after start bit 1 - Idle character bit count begins after stop bit Bit 3 - Wakeup Condition (WAKE) 0 - Idle line (idle condition on RxD) wakeup 1 - Address mark (1 in MSB of a received char) wakeup Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 5 / 19 SCICR1 Configuration II Bit 4 - Data Format (M) 0-1 start bit, 8 data bits, 1 stop bit 1-1 start bit, 9 data bits, 1 stop bit Bit 5 - Receiver Source (RSRC) 0 - Internal receiver to transmitter connection 1 - External receiver to transmitter connection (via the TxD pin) Bit 6 - SCI Stop in Wait Mode (SCISWAI) 0 - SCI enabled in wait mode 1 - SCI disabled in wait mode Bit 7 - Loop Select (LOOPS) 0 - Normal operation 1 - Loop operation (SCI received section is disconnected from the RxD pin allowing the RxD pin to be used for GPIO.) Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 6 / 19

SCICR2 Configuration I Bit 0 - Send Break (SBK) 0 - No break characters 1 - Transmit break characters Bit 1 - Receiver Wakeup (RWU) 0 - Normal operation 1 - Enables wakeup and inhibits receiver interrupts. Bit 2 - Receiver Enable (RE) 0 - Disabled 1 - Enabled Bit 3 - Transmitter Enable (TE) 0 - Disabled 1 - Enabled Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 7 / 19 SCICR2 Configuration II Bit 4 - Idle Line Interrupt Enable (ILIE) 0 - IDLE interrupts disabled 1 - IDLE interrupts enabled Bit 5 - Receiver Full Interrupt Enable (RIE) 0 - RDRF and OR interrupts disabled 1 - RDRF and OR interrupts enabled Bit 6 - Transmission Complete Interrupt Enable (TCIE) 0 - TC interrupts disabled 1 - TC interrupts enabled Bit 7 - Transmitter Interrupt Enable (TIE) 0 - TDRE interrupts disabled 1 - TDRE interrupts enabled Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 8 / 19

SCISR1 Configuration I Bit 0 - Parity Error (PF) 0 - No parity error 1 - Parity error Clear PF by reading SCISR1 followed by SCIDRL. Doesn t get set in case of OR. Bit 1 - Framing Error (FE) 0 - No framing error 1 - Framing error Clear FE by reading SCISR1 with FE set followed by SCIDRL. Doesn t get set in the case of OR. When sets prohibits further data reception. Bit 2 - Noise Flag (NF) 0 - No noise 1 - Noise Clear NF by reading SCISR1 followed by SCIDRL. Doesn t get set in the case of OR. Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 9 / 19 SCISR1 Configuration II Bit 3 - Overrun (OR) 0 - No overrun 1 - Overrun Incoming data is lost, but the current data is intact. Clear OR by reading SCISR1 with OR set followed by SCIDRL. Bit 4 - Idle Line (IDLE) 0 - Receiver input is active or has never become active since last IDLE flag clear 1 - Receiver input is idle Clear IDLE flag by reading SCISR1 with IDLE set followed by SCIDRL. Bit 5 - Receive Data Register Full (RDRF) 0 - Data not available in SCI data register 1 - Received data available in SCI data register Clear RDRF by reading SCISR1 with RDRF set followed by SCIDRL. Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 10 / 19

SCISR1 Configuration III Bit 6 - Transmit Complete (TC) 0 - Transmission in progress 1 - No transmission in progress Clear TC by reading SCISR1 with TC set then writing to SCIDRL. TC is set when the TDRE flag is set and no data, preamble, or break character is being transmitted. Bit 7 - Transmit Data Register Empty (TDRE) 0 - No byte transferred to the transmit shift register 1 - Byte transferred to transmit shift register Clear TDRE by reading SCISR1 with TDRE set followed by writing to SCIDRL. Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 11 / 19 SCISR2 Configuration Bit 0 - Receiver Active (RAF) 0 - No reception in progress 1 - Reception in progress Bit 1 - Transmitter Pin Data Direction in Single-Wire Mode (TXDIR) 0 - TxD pin used as an input in Single-Wire mode 1 - TxD pin used as an output in Single-Wire mode Bit 2 - Break Transmit Character Length (BK13) 0 - Break character is 10 or 11 bits long 1 - Break character is 13 or 14 bits long Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 12 / 19

SCIDRL & SCIDRH Configuration SCIDRL is used for bits 0-7 for transmit and receive. SCIDRH bit 6 is the ninth data bit transmitted when in 9-bit mode. SCIDRH bit 7 is the ninth data bit received when in 9-bit mode. When running in 9-bit mode access SCIDRH before SCIDRL. Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 13 / 19 SCI Initialization SCIBD = 26; //9600 baud SCICR1 = 0x00; //no parity, 8 data bits, normal operation SCICR2 = 0x2C; //receiver & transmitter enable, //RDRF interrupt enable Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 14 / 19

SCI Transmit Ritual Check for TDRE by reading SCISR1. Write data to SCIDRL. if(scisr1 & TDRE) { SCIDRL = data; Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 15 / 19 SCI Receive Ritual Check for RDRF by reading SCISR1. Read data from SCIDRL. if(scisr1 & RDRF) { data = SCIDRL; Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 16 / 19

SCI Initialization #define TDRE 0x80 #define RDRF 0x20 #define TXINT 0x80 void SCI_Init(void){ asm sei RxFifo_Init(); // empty FIFOs TxFifo_Init(); SCIBD = 52; // 9600 bits/sec SCICR1 = 0; // M=0, no parity SCICR2 = 0x2C; // enable, arm RDRF asm cli // enable interrupts Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 17 / 19 SCI Interface ISR // RDRF set on new receive data // TDRE set on empty transmit register interrupt 20 void SciHandler(void){ char data; if(scisr1 & RDRF){ RxFifo_Put(SCIDRL); // clears RDRF if((scicr2&txint)&&(scisr1&tdre)){ if(txfifo_get(&data)){ SCIDRL = data; else{ SCICR2 = 0x2c; // clears TDRE // disarm TDRE Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 18 / 19

SCI In/Out Character // Input ASCII character from SCI // spin if RxFifo is empty char SCI_InChar(void){ char letter; while (RxFifo_Get(&letter) == 0){; return(letter); // Output ASCII character to SCI // spin if TxFifo is full void SCI_OutChar(char data){ while (TxFifo_Put(data) == 0){; SCICR2 = 0xAC; // arm TDRE Scott R. Little (Lecture 16: SCI Config) ECE/CS 5780/6780 19 / 19