Digital Modem on a DSP: from Simulation to Real-Time Implementation
A complete digital modem (transmitter and receiver) on a DSP: from a MATLAB model to fixed-point C code running in real time on a DSP/FPGA board.
Overview
This project is a complete digital modem (a transmitter and a receiver) built for a special communication system and running in real time on a DSP processor. The modem turns digital data into a signal for transmission, and on the receiving side turns the received signal back into data.
Because of the nature of this project, I do not write its technical details here, and only show my work and my skills. The project is mostly software and has no product photo; the pictures on this page show the DSP and FPGA board I tested it on and its debugger.
My work
I was given the MATLAB model of the modem (I did not write it), and my job was to convert it to C and turn it into a real program on the DSP:
Conversion to fixed point. The DSP I used works faster and with less power on integers. So I rewrote the calculations of the floating-point MATLAB model as integer fixed-point arithmetic, keeping the accuracy at the level that is needed.
C programming. I wrote the transmitter and the receiver in C, from the MATLAB model, about fifteen thousand lines in total. I wrote them first on a computer, checked correctness there, and then moved them to the DSP.
Optimization for the DSP. The program must run in real time. So I studied and applied how to use memory (internal and external), data transfer with DMA, double buffering (ping-pong), the cache and compiler optimization, and compared several implementations of the main blocks by clock cycles.
Testing on hardware. I ran the program on a DSP and FPGA development board with a JTAG debugger, compared the output with the reference model using test data files, and measured the clock usage.
Versioning and documentation. I kept several successive versions and wrote a technical report that explains fixed-point basics, working with the DSP, optimization and resource usage.
The diagram below shows the workflow.
Results
Compiler optimization alone brought the clock usage of the transmitter code for a large test data set from about 3.3 billion to about 0.53 billion cycles, more than six times faster.
With all the optimizations, processing one frame uses from about half a percent to about half of the available clock, depending on the frame type; so the program runs in real time with a good margin.
The memory use of the DSP was checked too and is acceptable (under 60% of the internal memory).
Tools and skills
DSP processor: TI TMS320C6455, with Code Composer Studio and an XDS200 debugger
Languages: C and C++, MATLAB, and Python for analysis
Fixed-point arithmetic and real-time optimization (EDMA, cache, memory, compiler)
Signal processing and digital communication systems
Testing against a reference model, technical documentation
Summary
The implementation of a complete digital modem on a DSP, from a MATLAB model to a real-time program on hardware; an example of work on the border of signal processing, embedded programming and optimization.
Gallery
BLOG
Related posts
Questions about this project?
If you have questions about this project, or a similar one in mind, I would be glad to hear from you.