Title: Realtime Signal Processing
1Real-time Signal Processing
1) System must keep up with incoming and/or
outgoing data 2) Delays between arrival of data
and its disposition must usually be limited
USB to PC
to 5V
Headphones
Microphone
2Continuous Real-Time Processing
Data being acquired continuously. Data being
output continuously. Use DMA (direct memory
access) to allow data I/O without CPU
involvement. Output is continuous but
delayed. Can use buffers - one is filled
while one is processed while one is output.
3Data Transfers by Direct Memory Access
- All data transfers have to be handled by the CPU.
Data are transferred directly to memory, enabling
the CPU to attend to other tasks.
4Programming for Real-Time Systems
Keep algorithms fast and simple IIR filters have
lower order than FIR Use integer arithmetric
(e.g., 3-point smoother) And/or use hardware
enhancements DMA for data acquisition Hardware
multipliers to allow floating-point
arithmetic Pipelines All this with low power
consumption!
5Processors in C6000 Family
- C67x floating-point processor.
-
- C64x fixed-point processor.
6Texas Instruments TMS320CxDSP chip block diagram
Features of DSP chip
Multiple ALUs Floating point hardware Internal
memory for program and data DMA control External
interrupt controller External ports Timers
7The C6000 Block Diagram
8The C67x Data Paths
- The C67x CPU is divided into two parallel parts,
Data path A and Data path B. - It is stereo.
- With this architecture, it is possible to process
both left and right channels of an audio signal
at the same time.
9TMS320C6713 DSK Hardware
C6713 CPU
Mic In
Line In
Headphones
Expansion
Codec
USB
5V Supply
LEDs
JTAG
RAM
Switches
10Comparing Target Hardware
11Current Methods to DeployEmbedded Real-Time
Systems
Design algorithms at high level (e.g.,
MATLAB) Select target hardware Cost Power
consumption Silicon area Development
time Translate algorithm to target
code Over-the-wall Lack of integrated
development (cross-compilers) Hand
optimization Implement
12A Call for Change
- Cultural wall between Electrical Engineering
and Computer Science - CS deals with discrete mathematics
- Use computational models based on sequential
machines - Support non-deterministic changes in program
control but abstract out physical realities such
as notions of concurrency and physical
constraints on computation - EE deals with continuous mathematics
- Use analytical models based on transfer functions
- Explicitly recognize time but have difficulty
with non-deterministic changes in program control
and partial or incremental specifications - Needs
- Bi-cultural engineers comfortable in both
worlds - Design models that integrate analytical and
computational approaches - Methods to define and design robust systems
-
- See The Discipline of Embedded System Design,
Thomas A. Henzinger and Joseph - Sifakis, Computer Magazine, October 2007, pp.
32-40 (IEEE Computer Society).
13Generating target code from MATLAB
- MATLAB compiler
- mcc m yourmfile recorder player2
- generates C-source files, yourmfile.exe
- and yourmfile.ctf (environment) file
- Simulink
- Uses block diagram representation of a system
- generates C-source files and yourmfile.exe
- Vehicle for MATLAB support of
- external hardware
- Real Time Workshop
- Real Time Windows Target
- Licenses required
- Based on S-Functions
- Generates downloadable code
14Simulink model for thecar cruise control
15Simulink model for theautomatic gain control
Read input from and write output to workspace
agc.mdl
Uses DSP Blockset and Real Time Windows Target
modules
16Simulink model for theautomatic gain control
Read input from and write output to disk files
agc_c.mdl
Uses DSP Blockset and Real Time Windows Target
modules
17Simulink model for theautomatic gain control
Use real-time data input and output
agc_rt.mdl
Uses DSP Blockset and Real Time Windows Target
modules
18Downloading files for Lab 6
- Data (MATLAB files) refspeed.txt (mat format)
agc.txt (mdl format) - Note instructions on website for using files in
MATLAB - As indicated, refspeed is in .mat format. You can
force MATLAB to ignore the extension and load it
as a .mat file using the command load mat
pendin.txt - To use the agc.txt and other model files for
Simulink, you can change the extension to mdl. - One way to do this is to use the dos rename
command at the MATLAB command prompt - dos('rename agc.dat agc.mdl')
- Note that Windows does not let you change the
extension.
19Notes on using mcc and RTW
- To deploy a compiler-generated stand-alone
application to another machine, MATLAB Component
Runtime (MCR) must be installed and configured on
the target. Both the .exe and .ctf (Component
Technology File) files must be on the target.
Windows extracts a real-time operating
environment from the .ctf file, which is platform
dependent and apparently needs to be compatible
with the source machine MATLAB version. - Problems can be introduced if you change the name
of the .exe file from mcc. The safest approach
seems to be to let it keep the same name as the
original m-file. - RTW generates a single file that can be moved
between MATLAB versions at least we havent
encountered problems yet. - An executable file can be built from agc_rt.mdl
but not on the lab machines because supportable
A/D and D/A modules are not available in the lab.
20Automatic gain control
agcin.mat
Input and output files for agc_c.exe obtained on
DSP lab computer November 3, 2008
agcout.mat (Note that agc_c doesn't do much. It
just creates a new file in your default
directory, but this file contains your output for
the input agcin.)
21Running automatic gain control from RTW
Using model agc_c.mdl (compiled April 1, 2008)
Using model agc_c.mdl (compiled February 16, 2006)
22mcc compiler issue
- My compilation test produced this error message
- mccExcludedFiles.txt
- This file contains the list of various toolbox
functions that are not - included in the CTF file. An error will be shown
if any of these functions are called at run-time.
Some of these functions may be from toolboxes
that you are not using in your application. The
reason for this is that these toolboxes have
overloaded some methods that are called by your
code. - If you know which toolboxes are being used by
your code, you can use the -p flag with the -N
flag to list these toolboxes explicitly. This
will cause MATLAB Compiler to only look for
functions in the specified toolbox directories in
addition to the MATLAB directories. Refer to the
MCC documentation for more information on this. - 0 item(s) removed. You can review the
mccExcludedFiles.log file for the list of
functions not included in the CTF archive.
23Final Project
- Objective
- Design a laboratory exercise that would be
appropriate for a one or two week assignment for
1563. It can be either a set of exercises or a
design problem. Your report should include a lab
write-up to describe the lab to students,
including a background section on the area being
studied - Project Ideas (You are free to design your own.)
- Long-term spectrograms.
- Spread Spectrum Communication.
- (See Notes on Modulation on the website.)
- Effects of filtering on music and/or speech.
- 4. A simple speech recognition system.
- 5. Echo Cancellation.
- 6. Frequency transposition of speech.
- 7. The "cocktail party effect".
- 8. Brightness and contrast in color images.
- 9. Segmenting an image.
- Feature extraction in MRI images.
- Morphing instruments
24Final Project Presentations
- Experiment 6
- Deploying MATLAB Algorithms
- Due Monday, April 6
- Exam 2 Wednesday, April 1
- Final Project
- Project titles due April 1
- Â Â Â Class presentations April 13, 15
- Â Â Â Final report noon, April 20