EE 345S Real-Time Digital Signal Processing Lab Fall 2007

Slides:



Advertisements
Similar presentations
Chapter 3 Basic Input/Output
Advertisements

Chapter 10 Input/Output Organization. Connections between a CPU and an I/O device Types of bus (Figure 10.1) –Address bus –Data bus –Control bus.
A look at interrupts What are interrupts and why are they needed.
I/O Unit.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
Communication Lab - Interrupts 1/13 Sequential Programming  Our C++ programs are sequential ( סדרתיים), they start at the first instruction and end at.
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: internal fault (e.g.. divide by.
A look at interrupts What are interrupts and why are they needed.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
Introduction to Interrupts
EE 445S Real-Time Digital Signal Processing Lab Fall 2011 Lab #2 Generating a Sine Wave Using the Hardware & Software Tools for the TI TMS320C6748 DSP.
The 8051 Microcontroller and Embedded Systems
INTERRUPTS PROGRAMMING
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Interrupts Signal that causes the CPU to alter its normal flow on instruction execution ◦ frees CPU from waiting for events ◦ provides control for external.
Revised: Aug 1, ECE 263 Embedded System Design Lessons 23, 24 - Exceptions - Resets and Interrupts.
EE 445S Real-Time Digital Signal Processing Lab Fall 2013 Lab #2 Generating a Sine Wave Using the Hardware & Software Tools for the TI TMS320C6748 DSP.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
I/O Interfacing A lot of handshaking is required between the CPU and most I/O devices. All I/O devices operate asynchronously with respect to the CPU.
Microprocessors 1 MCS-51 Interrupts.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
1 Interrupts, Resets Today: First Hour: Interrupts –Section 5.2 of Huang’s Textbook –In-class Activity #1 Second Hour: More Interrupts Section 5.2 of Huang’s.
6-1 Infineon 167 Interrupts The C167CS provides 56 separate interrupt sources that may be assigned to 16 priority levels. The C167CS uses a vectored interrupt.
ECE 447 Fall 2009 Lecture 7: MSP430 Polling and Interrupts.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
بسم الله الرحمن الرحيم MEMORY AND I/O.
EE 345S Real-Time Digital Signal Processing Lab Fall 2007 Lab #2 Generating a Sine Wave Using the Hardware & Software Tools for the TI TMS320C6713 DSP.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
EE 345S Real-Time Digital Signal Processing Lab Fall 2008 Lab #3 Generating a Sine Wave Using the Hardware & Software Tools for the TI TMS320C6713 DSP.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
MICROPROCESSOR BASED SYSTEM DESIGN
CS501 Advanced Computer Architecture
Microprocessor and Assembly Language
68HC11 Interrupts & Resets.
Microprocessor Systems Design I
The process starts from the I/O device
Timer and Interrupts.
Computer Architecture
Interrupts In 8085 and 8086.
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
EE 445S Real-Time Digital Signal Processing Lab Spring 2017
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Lecture 5: Lab 3 – Active HW Accelerator Design
8259 Chip The Intel 8259 is a family of Programmable Interrupt Controllers (PIC) designed and developed for use with the Intel 8085 and Intel 8086 microprocessors.
* * * * * * * 8051 Interrupts Programming.
Generating Sinusoidal Signals
The TMS320C6x Family of DSPs
Subject Name: Microprocessors Subject Code:10EC46 Department: Electronics and Communication Date: /20/2018.
Computer System Overview
Interrupts Interrupt is a process where an external device can get the attention of the microprocessor. The process starts from the I/O device The process.
Chapter 10 Interrupts.
EE 445S Real-Time Digital Signal Processing Lab Fall 2013
11.1 Interrupt Mechanism, Type, and Priority
X1 & X2 These are also called Crystal Input Pins.
Moving Arrays -- 2 Completion of ideas needed for a general and complete program Final concepts needed for Final DMA.
COMPUTER PERIPHERALS AND INTERFACES
Lecture 9: TI MSP430 Interrupts & Low Power Modes
Interrupts.
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
CNET 315 Microprocessor & Assembly Language
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
COMP3221: Microprocessors and Embedded Systems
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

EE 345S Real-Time Digital Signal Processing Lab Fall 2007 Lab #2 Generating a Sine Wave Using the Hardware & Software Tools for the TI TMS320C6713 DSP Wael Barakat

Outline Sine Wave Generation Outputting Methods Function Call Lookup Table Difference Equation Outputting Methods Polling Interrupts Direct Memory Access (DMA)

Sine Wave Generation One-sided discrete-time signal of frequency ω0 cos(ω0n)u[n] One-sided continuous-time signal of frequency ω0 cos(2πf0t)u(t) Using a sample frequency fs such that fs > 2.f0 Substitute t=nTs=n/fs cos(2π(f0/fs)n)u[n] ω0=2π(f0/fs) radians/sample

Sine Wave Generation Function Call: Use the C library function sin(x) whenever a sine value is needed, approximated as the ratio of 2 10th order polynomials in x Computation: 21 multiplications, 21 additions and 1 division Memory Usage: 22 coefficients and 1 intermediate variable (x) and one constant (2) Lookup Table: Pre-compute and store one period of samples, can even store one-half or one-quarter period and use symmetry. Frequency is ω0=2πN/L L is the period Interpolate stored values to get result at all frequencies No computation needed, just memory reads.

y[n] = (2 cos 0) y[n-1] - y[n-2] + x[n] - (cos 0) x[n-1] Sine Wave Generation Difference Equation: Input x[n] and output y[n] (zero IC’s) y[n] = (2 cos 0) y[n-1] - y[n-2] + x[n] - (cos 0) x[n-1] Results from z-transform of cos(ω0n)u[n] Computation: 2 multiplications and 3 additions Memory Usage: 2 coefficients, 2 previous values of y[n] and 1 previous value of x[n] Drawback is the build-up of error due to feedback

Outputting Methods Polling: means constantly monitoring a device, a flag or a register until its value changes. Poll XRDY (transmit ready) bit of the McBSP0 (Multi-Channel Buffered Serial Port) serial port until TRUE then write to DXR (data transmit register) of the McBSP1. If XRDY is TRUE, function returns the sample and the value 1, If XRDY is FALSE, function returns immediately without sending a sample and return the value 0.

Serial Port Transmitter CPU writes a 32-bit word to the DXR. XRDY flag is cleared whenever data is written to DXR. After a word is shifted out of XSR, a transfer of the DXR to the XSR is performed. XRDY flag is set. When XRDY is set, serial port transmitter sends an interrupt request (XINT) to CPU.

Serial Port Receiver Bits received serially into RSR. When word is complete it is transferred to RBR. RBR copied to DRR if it is empty. RRDY bit in SPCR is set when RSR is moved to DRR and is cleared when DRR is read. When RRDY is set, McBSP generates a CPU interrupt request (RINT).

Outputting Methods Polling: for ( ; ; ) // Infinite Loop { } x_left = scale*sin(angle_left); x_right = scale*sin(angle_right); // Increment phase angles of sine waves angle_left += delta_left; angle_right += delta_right; // Reduce angles modulo 2 pi so no overflow if (angle_left > 2.0*PI) angle_left -= 2.0*PI; if (angle_right > 2.0*PI) angle_right -= 2.0*PI; WriteSample( x_left, x_right ); } Multiply the sin() by a scale so that it doesn’t become 0 when it’s converted to integer since |sin()|<1 and floats less 1 are converted to 0

Outputting Methods Polling: void WriteSample( float left, float right) { Uint32 ileft  = (Uint32) left; Uint32 iright = (Uint32)right; Uint32 output; /* Combine ileft and iright into a 32-bit word */ output = (iright << 16) | (ileft & 0x0000ffff); /* DSK6713_AIC23_write polls the Ready flag of the serial port and returns true/false to indicate success. */ while(!DSK6713_AIC23_write(hCodec, output)); } Convert float to integer Combine both samples into a 32-bit word to transmit via McBSP1 Poll XRDY bit and write output to McBSP0 DXR

Outputting Methods Polling: Most of the time in the polling method is spent in the infinite loop waiting for the XRDY flag to get set, DSP is doing nothing, A more efficient approach is to let DSP run tasks in background (modulating/demodulating, coding/decoding…), So, serial port will interrupt background tasks when sample is received and needs to be transmitted.

Outputting Methods Interrupts: are signals from hardware/software indicating the need for attention or change of execution. C6713 DSP has a vectored priority interrupt controller that can handle 16 different interrupts: RESET interrupt has highest priority, cannot be masked, NMI (Non-Maskable Interrupt) has the second highest priority (used to notify DSP of serious hardware errors), 2 reserved maskable interrupts come next, 12 additional maskable interrupts (INT4-INT15) have the lowest priority.

Interrupts Interrupt Source Default Mappings Interrupt Control Registers

Outputting Methods Conditions for an interrupt to occur: Global Interrupt Enable bit (bit 0 of Control Status Register) must be set to 1. If GIE=0, no maskable interrupt can occur, Non-Maskable Interrupt Enable bit (in the Interrupt Enable Register) must be set to 1. If NMIE=0, no maskable interrupt can occur, Bit corresponding to desired interrupt must be set to 1 in Interrupt Enable Register. When interrupt occurs, corresponding bit in IFR (interrupt flag register) is set to 1. No higher priority interrupt flag should be set to 1 in IER.

Outputting Methods When CPU interrupt ‘n’ occurs, program execution jumps to byte offset 32×n in an Interrupt Service Table (IST) which contains 16 Interrupt Service Fetch Packets (ISFP) each containing 8 32-bit instructions. ISFP may contain an entire Interrupt Service Routine (ISR) or may branch to a larger one.

Outputting Methods When an interrupt occurs: DSP sets corresponding interrupt flag in IFR to 1, If GIE=NMIE=1 and no higher priority interrupts are pending, interrupt is serviced: GIE copied to PGIE and GIE is cleared, Flag bit in IFR is cleared indicating interrupt is serviced, Return address is put in the Interrupt Return Pointer (IRP), Execution jumps to corresponding ISFP entry, Service routine must save the CPU state and restore it on exit.

Outputting Methods /* Select McBSP1 transmit int for INT15 */ intr_map(CPU_INT15, ISN_XINT1); /* Hook our ISR to INT15 intr_hook(tx_isr, CPU_INT15); /* Clear old interrupts INTR_CLR_FLAG(CPU_INT15); /* Enable interrupts INTR_ENABLE(CPU_INT_NMI); /* Set INT15 bit in IER INTR_ENABLE(CPU_INT15); /* Turn on enabled ints INTR_GLOBAL_ENABLE();