Beruflich Dokumente
Kultur Dokumente
kn
Pro
essor
GEOFFREY CHAUVEAU
XR-EE-SB 2006:008
IF Digital Radio Based on Blackn Processor
Master thesis report
6th March 2006
Georey Chauveau
Acknowledgements
This Master thesis work has been carried out during between September 2005 and February 2006 in the
Radio Program of Siemens VDO in Rambouillet.
First of all, I would like to thank my supervisor at Siemens VDO, Cyrille Potereau, for allowing me to do
this project and introducing me to the world of car radios. His help and advice were very useful during the
project. I would like also to thank my advisor at KTH, David Hammarwall, for his review work. Finally I
would like to extend my thanks everyone at Siemens VDO involved during this project, especially all members
of the Hardware group for their support and for making my time in this company most enjoyable.
i
ii
Contents
Introduction 1
1 Development board 3
1.1 Hardware components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 The Blackn BF533 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2 The development board: EZ-KIT Lite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Purpose of this board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.3 The A/D converter : AD7655 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Connection with the Blackn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.4 Serial ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.5 Connection diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.6 Audio codec AD1836 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Software part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.1 Data transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
SPORT conguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
DMA conguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.2.2 Data processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Choosing clocks and data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Mixing the input signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Designing lters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Demodulation and audio ltering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Moving data to the audio codec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3 First results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.3.1 Talkthrough test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.3.2 Demodulation test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.3.3 FM demodulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3.4 AM demodulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2 Dedicated board 21
2.1 Hardware components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.1.1 Aim of this board and general layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.1.2 BF532 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.1.3 AD converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.1.4 Dierential ADC Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.1.5 Parallel port interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.1.6 Tuner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.1.7 Mixer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
iii
2.1.8 Oscillators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1.9 Audio DAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1.10 External memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
SD-RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1.11 UART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1.12 Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1.13 Electrical schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2 Software part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.2.1 Data reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
PPI conguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
DMA transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.2.2 Signal processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Bandpass ltering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Mixing and lowpass ltering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Demodulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Audio ltering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.2.3 Data transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
SPORT conguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
DMA conguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.3 Radio measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.3.1 SNR and THD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.3.2 Frequency response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4 Source of problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4.1 Clock alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4.2 Clock shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.4.3 Range and saturation of components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.5 Possible improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.5.1 Hardware improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.5.2 Software improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Conclusion 43
A Source code 45
A.1 Main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
A.2 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
A.2.1 Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
A.2.2 Communication ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
A.2.3 Header le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
A.3 Handling of interruptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
A.4 Data processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
B Theoretical results 57
B.1 Radio signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
B.1.1 Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
B.1.2 AM and FM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
AM modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
FM modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
B.2 Equivalent lowpass of the baseband signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
B.3 Demodulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
B.3.1 1st method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
B.3.2 2nd method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
B.3.3 Digital case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
B.3.4 Lowpass lters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
B.3.5 Extracting the audio signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
AM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
FM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
References 65
v
Introduction
Siemens VDO Automotive (SV) Rambouillet is specialized in development and production of car radios and
multimedia systems for car manufacturers (GM, Renault, PSA, BMW ...). The study takes place inside the
"radio program" group which develops platforms (generic hardware and software which are then customized for
each customer) and more especially in the hardware key component group which is in charge of the development
and validation of radio components (microcontroller, DSP, power amplier, etc ...).
The latest generation of car radios uses a new kind of technology to perform the radio reception called
"IF digital". Previously, the FM/AM de-modulation was performed inside the tuner module with analog
components, and an analog signal, which was nearly the audio signal, was delivered to the DSP for nal
processing. With the latest generation of radio, the tuner module is only a front end doing the HF reception
and delivers a not demodulated signal called Intermediate Frequency (IF) to the DSP. This IF is digitalized and
then ltered and demodulated in the DSP. Only a few IC suppliers are providing specic DSP's and software
for car radio with integrated mixers and lters. Siemens VDO Automotive is interested in getting the full
knowledge of this system (hardware and software) in order to make its own improvement and to increase its
number of possible IC suppliers.
The aim of this master thesis is thus to design a complete digital superheterodyne (with frequency transposi-
tion) radio receiver whose main part is a Blackn DSP. The prototype has to use a tuner made by SV providing
an intermediate frequency (IF), a modulated signal at a xed carrier frequency, from an external radio signal.
The design of the receiver is separeted into two parts: a rst prototype on a development board and then a
complete radio receiver on a dedicated board.
1
IF Digital Radio Based on Blackn Processor
2
Chapter 1
Development board
The rst part of the study is focused on the design of a prototype using a development board. The main
task is to make a "proof of concept" and test the functionality of the Blackn DSP in a radio conguration.
An interface between the development board and an external A/D converter has to be built.
The rst section of this part focuses on the description of the hardware components chosen to design the
radio, their specications and the connection between them. The second section deals with the design of the
software that commands all the hardware components and performs the signal processing. The third section
deals with preliminary results.
Components
Here are all the useful features of the development board for the design of a digital radio.
• 32 Mb of SDRAM
• 2 Mb of Flash memory
• USB connectivity
3
IF Digital Radio Based on Blackn Processor CHAPTER 1. DEVELOPMENT BOARD
• Three 90-pin connectors providing PPI, SPI, EBIU Timers0-2, UART, Programmable Flags, SPORT0,
and SPORT1 expansion interfaces for analyzing and interfacing
A complete list of features and all schematics of the EZ-KIT Lite are available on the web site of Analog
Devices (see [7] and [4])
Properties
This component is a cheap 4 input channels 16 bit A/D converter with serial and parallel outputs that can
provide up to 1 million samples per second, according to its reference data sheet [1].
Limitations
The input signal must be in the range 0-5V (a 2.5 V DC signal must be added to a zero-mean input) and
after some tests, the sample frequency can not exceed 385 kHz. Over this frequency, the delay between the
sampling and the transmission of the data bits is too high, and data bits were not sent entirely and interrupted
by a new sampling. No obvious fact could explain such a delay, probably because there was a weakness in the
particular chip mounted on the board.
Frame synchronization signal This signal is used to state the beginning of a data word or the beginning of
the transmission of data words.
Serial data clock signal This signal is a clock synchronized with the transmission of a data bit.
Data signal This signal transmits the data bits one by one at each serial clock pulse.
4
1.1. HARDWARE COMPONENTS
Figure 1.1: Serial port signals (from Hardware Reference Manual, chapter 12 [3])
inputs are reserved for future improvements and connected to ground. Therefore, the transmitted data word
will be a 32 bit word beginning with 16 zeros (the input B data) and nishing with the 16 bits of input A.
See Figure 1.2 for the complete connection diagram and the AD7655 data sheet [1] for more explanations
about the connection of the converter. Photos of the complete prototype are shown in Figures 1.3 and 1.4.
5
IF Digital Radio Based on Blackn Processor CHAPTER 1. DEVELOPMENT BOARD
6
1.1. HARDWARE COMPONENTS
7
IF Digital Radio Based on Blackn Processor CHAPTER 1. DEVELOPMENT BOARD
8
1.2. SOFTWARE PART
SPORT conguration
The receive conguration of the serial port 1 of the Blackn is set by two 32-bit registers: SPORT1_RCR1
and SPORT1_RCR2. The following conguration has been chosen to match the conguration of the A/D
9
IF Digital Radio Based on Blackn Processor CHAPTER 1. DEVELOPMENT BOARD
External CLK The data clock is produced by the A/D converter and is external from the point of view of
the Blackn (corresponding to EXT/INT=LOW on the converter).
External Frame sync The synchronization signal is produced by the A/D converter.
Active Low RFS The synchronization signal is active when its value is low (INVSYNC=HIGH on the con-
verter).
Late frame syncs The rst bit of the receive data word is sampled in the same serial clock cycle that the
frame sync is asserted.
Receive Frame Sync Required A frame sync signal is needed before each data word (not before the rst
data word only). This gives better control on the data in case of a missing bit.
Sampling edge for data and frame syncs Sample data and external frame sync with rising edge of RSCLK.
MSB rst The most signicant bit is sent rst, the least signicant is sent last.
32-bit data The data word contains the 16 bits of the signal B of the converter followed by the 16 bits of the
signal A.
Refer to chapter 12 of Hardware Reference Manual [3] for a complete description of the conguration of the
serial ports.
The serial port SPORT0 used by the audio codec uses primary and secondary sides, 24-bit words and stereo
frame syncs.
DMA conguration
To use DMA transfers for reception, several parameters must be set:
DMA link The DMA peripheral map must be congured to link one DMA channel to SPORT1. Here, the
DMA3 channel is used.
Start address This gives the address in the memory where data will be stored. This address is not set directly:
a table with the right size just needs to be allocated at the beginning of the software and the register
DMA3_START_ADDR points to this table.
Inner loop count This species the number of data to read in. In autobuer mode, when the DMA counter
exceeds this number, the Current Address Register" of the DMA points to the start address again. Here,
only one word is transferred, the value of DMA3_X_COUNT is 1.
Inner loop address increment This increment is the stride that is applied to the Current Address Reg-
ister after transferring each element. SPORT1 transfers 32-bit words, hence the value of the register
DMA3_X_MODIFY is 4 (4 bytes).
Autobuer mode DMA is performed in a continuous way. After the completion of a DMA transfer, all
parameters are reloaded and a new transfer begins.
DMA direction Set to "Write" to specify that this transfer is a write operation.
Transfer word size 32 bits
Data interrupt Set to on to allow completion of work unit to generate a data interrupt.
Refer to chapter 9 of Hardware Reference Manual [3] for a complete description of DMA conguration on
the Blackn.
10
1.2. SOFTWARE PART
Clocks
Core and system clocks The default values of the core clock and system clock are respectively 270 MHz
and 54 MHz. These values, common for applications with low power consumption, are unfortunately too low
to perform signal processing at high rate and thus have to be raised up to their maximum: 600 MHz for the
core clock (limited by the Blackn) and 133 MHz (limited by the SD RAM ). These two clocks are generated
with frequency multipliers and dividers (see Figure 1.6) from a crystal at 27 MHz (an internal oscillator circuit
creates the input clock at 27 MHz). This input frequency can be divided by 2 according to the value of the
variable DF (0 or 1) and is then multiplied by MSEL (1 ≤ MSEL ≤ 64), using an on-chip PLL. This VCO
frequency is afterwards divided by the value of CSEL (1, 2, 4 or 8) to generate the core clock CCLK, and by
the value of SSEL (1 ≤ SSEL ≤ 15) to generate the system clock SCLK. The values of MSEL, CSEL and SSEL
are modied in the registers PLL_DIV and PLL_CTL.
Figure 1.6: Generation of core and system clocks (from Hardware Reference Manual, chapter 8 [3])
Clocks for components using serial ports The A/D converter and the audio codec are used as master
components: they produce their own serial clocks to transmit data on the serial ports of the Blackn. However,
the signal that allows the A/D converter to start a conversion must be external. To have control on the sampling
frequency of this converter, the convert signal is generated by a timer of the Blackn.
To congure this timer, several parameters must be set: its period (a multiple of the system clock period),
its width and its direction (output). The fact that the timer period is a multiple of the system clock adds some
constraints on the choice of the clock parameters, if a particular sampling frequency is sought. Refer to chapter
15 of Hardware Reference Manual [3] for explanations about the conguration of the timers.
All the clocks involved in the data transfer are plotted in Figure 1.7. The lower part refers to the A/D
converter and the upper part to the audio codec. The CONV signal is generated by the timer 1 of the Blackn,
the RSCLK, RDATA and RSYNC by the A/D converter and the TDATA, TSYNC and TSCLK by the audio
codec. The signal that clocks the audio codec is an external oscillator at 12.288 MHz.
11
IF Digital Radio Based on Blackn Processor CHAPTER 1. DEVELOPMENT BOARD
12
1.2. SOFTWARE PART
Designing lters
The output of the mixer passes through a lowpass lter to extract only the low frequencies and remove
the image frequencies. To keep the same time delay for all frequencies a linear phase lter is necessary (see
section B.3.4). Therefore, a FIR lter is used.
With Matlab, a FIR lter with 64 coecients and a cut-o frequency of 10kHz is built (see Figure 1.9).
The coecients of the lter are then rounded to 16 bit precision are stored in a text le. The built-in
function cr_fr16 performs the ltering on a complex number.
13
IF Digital Radio Based on Blackn Processor CHAPTER 1. DEVELOPMENT BOARD
14
1.3. FIRST RESULTS
15
IF Digital Radio Based on Blackn Processor CHAPTER 1. DEVELOPMENT BOARD
Figure 1.12: Output of the mixer before and after ltering (real part): Matlab (left) and DSP (right)
Figure 1.13: Output of the mixer before and after ltering (imaginary part): Matlab (left) and DSP (right)
Figure 1.14: Audio output of the mixer: Matlab (left) and DSP (right)
16
1.3. FIRST RESULTS
1.3.3 FM demodulation
This is a combination between the last two tests: a modulated signal with a carrier frequency of 80 kHz
is sampled at 360 kHz and demodulated. This signal has frequency bandwidth of 3 kHz and carries a 400 Hz
signal. To improve the results, the rst part of the input data words (normally sixteen bits at zero) is used
to remove a part of the noise of the input signal (the cyclic noise created by the AD converter is the same for
every sample and can be removed by subtraction).
The rst values of every signal are stored in memory for verication. See Figure 1.15, 1.16, 1.17, 1.18 and
1.19 for plots of all intermediate signals from the DSP.
The signal on the audio output is represented in Figures 1.20 (without ltering) and 1.21 (ltered).
Figure 1.15: I signals: real part of the output of the mixer before and after ltering
Figure 1.16: Q signals: imaginary part of the output of the mixer before and after ltering
17
IF Digital Radio Based on Blackn Processor CHAPTER 1. DEVELOPMENT BOARD
18
1.3. FIRST RESULTS
Figure 1.20: FM demodulation without ltering (fc =80 kHz, fs =360 kHz, f0 =500 Hz)
Figure 1.21: FM demodulation with ltering (fc =80 kHz, fs =360 kHz, f0 =500 Hz)
19
IF Digital Radio Based on Blackn Processor CHAPTER 1. DEVELOPMENT BOARD
1.3.4 AM demodulation
From a FM radio, it is easy to build a AM radio: only the demodulation part is changed and replaced by a
calculation of the modulus of the IQ signal (see Figure 1.22).
Figure 1.22: AM demodulation with ltering (fc =80 kHz, fs =360 kHz, f0 =500 Hz)
20
Chapter 2
Dedicated board
2.1 Hardware components
This part deals with a description of the components chosen for the dedicated board.
As shown on Figure 2.1, a tuner provides an IF signal with a carrier frequency of 10.7 MHz from a RF signal
with a carrier frequency around 100 MHz (FM). Several components are compulsory to build this radio receiver:
a tuner, a mixer (to work at a low carrier frequency), an AD converter to sample the modulated signal, a DSP
to demodulate the sampled signal and an audio DA converter to produce sound.
21
IF Digital Radio Based on Blackn Processor CHAPTER 2. DEDICATED BOARD
2.1.2 BF532
A Blackn BF532 is used for this board for convenience, since the BF533 is only available in a BGA package
(very dicult to solder and to debug). The main dierences between these two DSP are the maximum core clock
frequency (400 MHz instead of 600 MHz) and the amount of internal memory (32 kbytes less of instruction
SRAM and 32 kbytes less of data SRAM). However, the BF532 oers the same connectivity as the BF533
(same number of serial and parallel interfaces). Tests done on the demonstration board showed that this
memory capacity and this clock frequency were enough for a radio application.
2.1.3 AD converter
The AD converter used on this board is a ADS8402I [14] from Texas Instruments. This converter provides
a 16 bit parallel interface and a sampling frequency up to 1.25 MHz. Moreover, it accepts a dierential input
with an input voltage range between −Vref and Vref (Vref is an external voltage reference, here 2.7 V). This chip
is supplied with an analog voltage 5 V and a digital voltage 3.3 V. The sampling frequency is controlled by a
timer (Timer 0) of the DSP. In order to use only one timer, the Timer 0 pin of the DSP is connected to both the
conversion pin of the AD converter and the PPI_CLK pin of the DSP. At every falling edge of a clock signal,
a new conversion begins while the previous sample is read.
Data signals Up to 16 data signals are used to convey each data bit.
Clock signals This signal is a clock synchronized with all the data signals.
Frame synchronization signals These three signals can be used to distinguish dierent groups of data words
(these are often used to transfer video but are not needed here).
2.1.6 Tuner
The tuner (made by Siemens VDO) is a front-end converting a RF signal to an IF signal with a carrier
frequency of 10.4 MHz. This tuner is driven by an external oscillator of 100 kHz and the frequency selection is
2
commanded by the DSP or by an external command (with I C instructions).
2.1.7 Mixer
Due to hardware limitations, the IF signal can not be directly sampled and a frequency transposition of
the IF is required. The mixer is a RF2713 chip used to shift the spectrum of the IF to a carrier frequency of
300 kHz. This frequency is chosen to work at a sampling frequency of 1200 kHz. The output of the mixer is
not directly the baseband signal to avoid problems with DC components. The mixer is driven by an external
oscillator of frequency 20.8 MHz (twice 10.4 MHz) (see schematics 2.6 and datasheet of the RF2713[13]). The
output of the mixer has two frequency components: one useful component centered at 10.7 − 10.4 = 0.3 MHz
and one image component centered at 10.7 + 10.4 = 21.1 MHz . A lowpass lter is therefore necessary after the
mixer to keep only the low frequency.
22
2.1. HARDWARE COMPONENTS
2.1.8 Oscillators
The board needs three oscillator circuits:
These circuits use quartz crystals and logical gates (inverters, counters, etc) to create oscillations (the 18 MHz
oscillation circuit is embedded inside the DSP, only the quartz is external). Basically, an inverter is connected
in parallel with the quartz to create oscillations and a counter or a D ip-op is used to divide the frequency
to the desired value. See Figures 2.5 and 2.6 for complete electrical schematics.
SD-RAM
A 133 MHz 16 Mbytes SD-RAM can be used to store some data during the execution of the program. The
memory chosen is a Micron MT48LC8M16A2TG-75 IT with 4 banks, each containing 2 millions words of 16
bits (4096 rows by 512 columns). The SD-RAM is not currently used but is here in prevision of a future need.
Flash
To store the program instructions, a Flash memory is required. The memory used on this board is a Spansion
S29JL032H90. This memory has a storage capacity of 32 Mbits (2 M words of 16 Bits) organized in two banks
(one of 8 Mbits and one of 24 Mbits).
2.1.11 UART
To allow a connection between the DSP and an external device, a ICL3221CAZ chip is used to convert the
UART signals into RS-232 signals. The SUB-D9 connector can then be used to connect the board to the serial
port of a PC for example.
23
IF Digital Radio Based on Blackn Processor CHAPTER 2. DEDICATED BOARD
Figure 2.2: Electrical schematics: connection with the power supply board and the JTAG
24
2.1. HARDWARE COMPONENTS
31
IF Digital Radio Based on Blackn Processor CHAPTER 2. DEDICATED BOARD
32
2.2. SOFTWARE PART
PPI conguration
Several options are available to congure the PPI with the PPI_CONTROL register.
Data length: 16 bits The PPI reads 16-bit words. This congures the accurate number of "Programmable
Flags" pins as PPI data pins.
Skip data This allows to skip a part of transmitted data (often one of two samples) when using frame syncs
(not used here)
Receive mode The PPI can be either in Receive mode or in Transmit mode.
33
IF Digital Radio Based on Blackn Processor CHAPTER 2. DEDICATED BOARD
Internal trigger To initiate the transmission of data, an internal or external trigger can be used. An internal
trigger is generated by the software and an external one by a single pulse on the 1st frame syncs pin
(PPI_FS1).
DMA transfer
The DMA transfers regarding the PPI are descriptor based and not register based as on the development
board. A descriptor is simply a variable that contains the address of a register where to write data in and the
address of the following descriptor to read. This allows the processing of an array while a DMA transfer into
another one.
DMA link The DMA peripheral map must be congured to link one DMA channel to the PPI. Here, the
DMA channel 0 is used.
Next descriptor This gives the address of the next descriptor to use. This descriptor contains the address in
the memory where data will be stored. Two descriptors are used to write into two dierent arrays and
these descriptors points to each other as well to in
Inner loop count Thirty-two words are transferred, so the value of DMA0_X_COUNT is 32.
Inner loop address increment This increment is the stride that is applied to the Current Address Reg-
ister after transferring each element. The PPI transfers 16-bit words, hence the value of the register
DMA0_X_MODIFY is 2 (2 bytes).
Descriptor list mode DMA is performed in a continuous way as long as a currently used descriptor points
to another one. After the completion of a DMA transfer, the next descriptor is loaded and a new transfer
begins.
DMA direction Set to "Write" to specify that this transfer is a write operation.
Data interrupt Set to on to allow completion of work unit to generate a data interrupt.
Clocks
Core and system clocks From a 18 MHz clock (produced by an external quartz), a 396 MHz core clock and a
132 MHz system clock are produced by choosing DF=0, MSEL=22, CSEL=0 and SSEL=3. The corresponding
conguration register values are 0x0003 for PLL_DIV and 0x2c00 for PLL_CTL (see section 1.2.1 for more
explanations) .
Clocks for the AD converter To set the sampling frequency of the AD converter to 1.2 MHz, the DSP
generates the convert signal with one of its timer (Timer 0). The period of this timer is 110 times the period
of the system frequency, thus the register TIMER0_PERIOD is set to 0x0000006e. In order to save one timer,
the convert signal is the same as the read signal: when the timer signal is low, the sampling of the input signal
begins while the previous sample is transferred to the DSP.
The external quartz (18 MHz) that drives the DSP is chosen especially to be able to generate a sampling
frequency of 1.2 MHz with core and system clocks close to their maximum. This sampling frequency makes the
computation easier, for the mixing to obtain the I and Q signals consists only of multiplications by 1, i, −1 and
−i.
Clocks for the audio DA converter The DA converter has an integrated PLL and needs no external clock
to be driven. The serial data clock and the frame synchronization clock are generated by the DSP by conguring
internal registers. To choose the sampling period (or frame synchronization period) and the serial data clock,
34
2.2. SOFTWARE PART
the adequate values of the register TCLK_DIV and TFS_DIV must be set according to the following formula
(valid in stereo mode):
TSCLK0 frequency
SPORT0TFS frequency =
2(SPORT0_TFSDIV + 1)
System CLK frequency
SPORT0TSCLK frequency =
2(SPORT0_TCLKDIV + 1)
Here, the sampling frequency is 37.5 kHz, the System clock frequency 396 MHz and 20 data clock cycles are
required to transmit one sample for each audio channel, hence a data clock frequency of 2 × 20 × fs = 1500 kHz.
Thus it is obtained: TCLK_DIV = 40 = 0x0000002b and TFS_DIV = 19 = 0x00000013.
Bandpass ltering
First, the 32 samples are ltered through a 63th order bandpass FIR lter to remove all components of the
signal outside the frequency range 150 kHz - 450kHz (see Figure 2.12).
35
IF Digital Radio Based on Blackn Processor CHAPTER 2. DEDICATED BOARD
Demodulation
Since the sampling frequency of the audio output is 37.5 kHz, only one audio sample out of the 32 input
samples needs to be demodulated. The rst two values of the I and Q signals are used to calculate the phase
dierence between the two rst values of the complex signal (I+jQ).
Audio ltering
The nal step in the data processing is the audio ltering. Two goals are aimed: rst deemphasize the high
frequencies, and then remove the noise.
The deemphasis lter is a 2nd order IIR lowpass lter used to retrieve the original audio signal: in an FM
system the higher frequencies contribute more to the noise than the lower frequencies. Therefore, FM radios use
preemphasis (a highpass lter) before the modulation. After the demodulation, the opposite operation must be
done (see Figure 2.13 ).
The second lter is a FIR lowpass lter that removes all frequencies over 15 kHz.The bandwidth of the lter
is tweaked to achieve the best hearing.
SPORT conguration
2
The DA converter accepts only I S data. The serial port must therefore be congured to send clock and
2 2
data signals according to the I S specication (cf. Figure 2.14). The particularity of the I S format is that
36
2.2. SOFTWARE PART
frame syncs are held constant to indicate which audio signal is sent (left or right) and that data are driven with
the rising edges of the serial clock whereas frames syncs are driven with the falling edges of the serial clock.
2
Figure 2.14: I S format
2
The conguration to meet the I S specications is the following:
Transmit Frame Sync Required A frame sync signal is needed before each data word (not before the rst
data word only). This gives better control on the data in case of a missing bit.
Driving edge for data and frame syncs Drive data and internal frame sync with falling edge of TSCLK.
2
(This is a trade o between the I S format and what the Blackn can do with an internal frame syncs)
MSB rst The most signicant bit is sent rst, the least signicant is sent last.
Data length The sound is encoded with 16 bits.
Secondary side disabled Only one data channel is needed here.
Stereo frame sync enabled This is used for stereo audio codec and changes the frame synchronization signal
into a left/right signal.
DMA conguration
The DMA transfer is register based and generates an interruption after each transfer to load the audio signal
into the source register.
DMA link The DMA peripheral map must be congured to link one DMA channel to SPORT0. Here, the
DMA2 channel is used.
Start address Address in the memory where data will be read: an array of two 16-bit words is created and
the register DMA2_START_ADDR points to this table.
Inner loop count Two words are transferred, the value of DMA2_X_COUNT is 2.
Inner loop address increment SPORT0 transfers 16-bit words, hence the value of the register DMA2_X_MODIFY
is 2 (2 bytes).
Autobuer mode DMA is performed in a continuous way. After the completion of a DMA transfer, all
parameters are reloaded and a new transfer begins.
DMA direction Set to "Read" to specify that this transfer is a read operation.
37
IF Digital Radio Based on Blackn Processor CHAPTER 2. DEDICATED BOARD
38
2.3. RADIO MEASUREMENTS
The THD is measured by applying a narrow 1 kHz notch lter to remove the sound wave and by measuring
the other unwanted signal components. The THD is the ratio between these components and the expected
audio signal and is expressed in percent. Note that the noise is also measured with this experiment, so it is
often referred as "THD + noise" measurement. When the THD is below 5%, the distortion is not heard. Here
the THD is around 3.5%. A THD of 1% is commonly sought.
39
IF Digital Radio Based on Blackn Processor CHAPTER 2. DEDICATED BOARD
40
2.4. SOURCE OF PROBLEMS
Figure 2.17: Audio frequency response (fc = 98 MHz, RF level = 250 µV)
First, the mixer current output can saturate: this can happen on several chips and not on others. This is
due to defects in several chips (perhaps because of a high stress on previous tests).
Moreover, the operational amplier that drives the AD converter is supplied by a single 5 V voltage and
is quite dicult to congure: if too much gain is used, the output saturates and if too low gain is used, the
number of eective bits used by the AD converter is low and the SNR increases. What is complicated here is
that the input RF signal goes from 1 µV to 10 mV in common situations.
In the software demodulation chain, if the clock of the mixer is not aligned with the clock of the tuner, the
value of the audio signal is expected to be not zero. If this mean value is too high, the output (calculated with
xed point numbers can saturate). However, this has never been experienced during the tests.
41
IF Digital Radio Based on Blackn Processor CHAPTER 2. DEDICATED BOARD
42
2.5. POSSIBLE IMPROVEMENTS
Conclusion
This project has shown the capability of the Blackn DSP to work in a radio environment. The rst
prototype built from a development board was designed rapidly and gave encouraging results that allowed the
design of a complete board. This gave also useful information of how much computation was required, how to
link the peripherals to the DSP and which Blackn to use.
The second prototype was a complete board built "from scratch", using an external power supply and a
tuner. This board fullled the minimal r equirements, since it is possible to listen to close FM radio emitters by
simply plugging an external antenna. However, the quality of the receiver is far from a commercial one, but the
main problems have been localized and the hardware parts to improve identied. For future developments, the
choice of the mixer and the components producing the clocks has to be carefully made, since it is critical for the
overall radio. Software alignment of the clock of the mixer is also compulsory. Moreover, software improvements
and developments of other features are realizable: only one third of the ressource of DSP were used and the
source code occupied less than 25 kbytes in the DSP memory. It is therefore possible to use a Blackn as a
basis of a complete radio module.
Regarding an automotive application, other studies are required: several parameters like thermic and mag-
netic dissipations were not taken into account and are critical for an automotive application. Moreover, the
ability to interface the Blackn with other audio sources such as a CD was not tested. There are therefore still
a lot of developments to do to build a fully functional platform.
43
IF Digital Radio Based on Blackn Processor CHAPTER 2. DEDICATED BOARD
44
Appendix A
Source code
Pe
A.1 Main
1 / ∗ Purpose : Read in continous streams of data from the ADC. The data is read into a
memory buffer ( " sPPI_RxBuffer (1 −2) " ) via the PPI interface of the −
ADSP BF532 . A
3 double buffering scheme is implemented so that data in one half is available for
processing while the other half is being filled with new data via DMA operations .
5 A flag ( " Ping_Pong " ) indicates which half is ready for processing .
∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗/
7
9
#include " radioBF .h"
11
// Declare Exception Handler
13 EX_EXCEPTION_HANDLER( e x _ h a n d l e r ) ;
15
fract16
// Declare t h e DMA i n p u t buffer ///////////////////////////////
17
fract16
s P P I _ R x B u f f e r 1 [ Number_of_Samples ] ;
s P P I _ R x B u f f e r 2 [ Number_of_Samples ] ;
19
fract16
/ / Output buffer ///////////////////////////////////////////////
21
fract16
TxBuffer [ 2 ] ;
fract16
AudioLeft ;
23 AudioRight ;
25 // set up DMA descriptors ( sequence = 1 st half , then second half , then repeat )
tDMA_descriptor
// small descriptor model , only start address needs to be fetched
27
tDMA_descriptor
DMA_RX_second ; // declaration
tDMA_descriptor
DMA_RX_first = {&DMA_RX_second , sPPI_RxBuffer1 } ;
short
// i . e . points to the half that DMA is NOT using
35
37
// T r i g o tables for demodulation //////////////////////////////
45
IF Digital Radio Based on Blackn Processor APPENDIX A. SOURCE CODE
39 fract16
#include
cosinus [ ] = {
43 fract16
#include
sinus [ ] = {
fract16
cosinus_modif [ 3 2 ] ;
47
char
sinus_modif [ 3 2 ] ;
sinus_size ;
49
51 // / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
// F i l t e r s
53
/ ∗
55 complex_fract16 coeffs_lowpass []={
57 }; ∗/
// c o m p l e x _ f r a c t 1 6 fir_delayc [ 6 4 ] ;
59 // c f i r _ s t a t e _ f r 1 6 fir_structur_lowpass ;
61
fract16
// Bandpass ( 3 0 0 kHz )
63
fract16
};
65
fir_state_fr16
fir_delay_bandpass [ 6 4 ] ;
fir_structur_bandpass ;
67
fract16
// Lowpass
69
#include " coeffs_lowpass . in "
coeffs_lowpass_reI []={
71
fract16
};
73
fract16
};
75
fract16
fir_delay_I [ 6 4 ] ;
short
fir_delay_Q [ 6 4 ] ;
77
fir_state_fr16
coeff_size ;
fir_state_fr16
fir_structur_lowpass_I ;
79 fir_structur_lowpass_Q ;
81
fract16
// Audio FIR
83
short
};
85
fract16
coeff_size_audio ;
fir_state_fr16
fir_delay [ 6 4 ] ;
87 fir_structur_audio ;
89
iirdf1_state_fr16
// Audio IIR
#define
iir_structur_audio ;
91 NSTAGES 1
const float
// Deemphasis
93 ∗
const float
b_coeffs [ ( 2 NSTAGES) + 1] = {0.3064933 , 0.3064933 , 0};
∗ −0.091342 , −0.295471};
fract16
a_coeffs [(2 NSTAGES) ] = {
95 ∗
fract16
df1_coeffs [(4 NSTAGES) + 2];
97
46
A.1. MAIN
/ ∗
99 const float a_coeffs [(2 ∗ NSTAGES) ] = {
101 };
}; ∗/
105 // / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
int
// C o u n t e r s
107
int
counter_sample ; / / To plot data ( input / output )
111 // f r a c t 1 6 signal_out_plot [ 5 4 5 ] ;
/ / InitSDRAM ( ) ;
121
// Reset t h e DMA s e m a p h o r e s
123
sizeof
Ping_Pong = 0;
sizeof
c o e f f _ s i z e= ( coeffs_lowpass_reI ) /2;
,1) ;
137
139 // Creation of mixing arrays of the same size as the input buffer ( to increase
sizeof
// performance and use hardware loops )
141
int
s i n u s _ s i z e= ( sinus ) /2;
for
k;
147
InitPPI () ;
151 InitSport0 () ;
InitInterrupts () ;
153 EnablePortsDMA ( ) ;
Init_Timer ( ) ;
47
IF Digital Radio Based on Blackn Processor APPENDIX A. SOURCE CODE
159 // When an interrupt has occured , the flag PingPong indicates which half of the
while
// received data the main loop can process
161 (1) {
163 }
165 } // main
167
169
173 EX_EXCEPTION_HANDLER( e x _ h a n d l e r )
while
{
175 (1) ;
A.2 Initialization
A.2.1 Clocks
1 /∗ PLL S e t u p . c : c o n f i g u r e s t h e i n t e r n a l PLL o f t h e BF532 t o s e t t h e c l o c k s
∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗/
3
∗pPLL_DIV = 0 x0003 ;
13 ∗pPLL_CTL = 0 x2c00 ;
ssync () ;
15 idle () ;
17
} // end Init_PLL
10 / /GP mode , RX mode , 0 frame syncs , internal trigger , sample on falling edge
∗pPPI_CONTROL = 0 x787c ;
48
A.2. INITIALIZATION
14
// Map DMA0 to PPI
16 ∗pDMA0_PERIPHERAL_MAP = 0 x0000 ;
20 ∗pDMA0_NEXT_DESC_PTR = (&DMA_RX_first ) ;
22 ∗pDMA0_X_MODIFY = 2;
24 ∗pDMA0_X_COUNT = Number_of_Samples ;
26
void InitSport0 ( void )
28 {
∗pDMA2_PERIPHERAL_MAP = 0 x2000 ;
40
// Configure DMA2 Using register
∗pDMA2_START_ADDR = TxBuffer ;
∗pDMA2_X_COUNT = 2;
∗pDMA2_X_MODIFY = 2;
50 }
52
void EnablePortsDMA ( void )
54 {
64 }
{ / / The timer drives the sampling period of the ADC and the reading of data
49
IF Digital Radio Based on Blackn Processor APPENDIX A. SOURCE CODE
74 }
2 __INCLUDE_DEFINED
4 #include
#include
<c d e f B F 5 3 2 . h>
#include
< s y s \ e x c e p t i o n . h>
10
#include
<math . h>
#include
<c o m p l e x . h>
12 < f r a c t . h>
14
#ifndef
#include
__FILTER_DEFINED
16
#endif
< f i l t e r . h>
18
/ ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
20 Symbolic constants
∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗/
22
#define
// ADC CONSTANTS
24
#define
Number_of_ADC_bits 16
#define
Number_of_Samples 32 // Block size of words / c h a n n e l to b e DMA ' d from ADC
26 Word_Size 16
28
#define
// SPORT0 word length
SLEN_16 0 x000f
30
#define
/ / DMA flow mode
32 FLOW_1 0 x1000
34 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
Prototypes
36 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗/
38 void void
void void
InitSDRAM ( ) ;
void void
InitFlash ( ) ;
40
void void
Init_PLL ( ) ;
void void
InitPPI ( ) ;
42
void void
InitSport0 ( ) ;
void void
InitInterrupts ( ) ;
44
void void
EnablePortsDMA ( ) ;
void void
Init_Timer ( ) ;
46
void void
Process_Data ( ) ;
Demodulation ( ) ;
48 EX_INTERRUPT_HANDLER( PPI_RX_Isr ) ;
EX_INTERRUPT_HANDLER( Sport0_TX_ISR ) ;
50
/ ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
52 Global variables
50
A.3. HANDLING OF INTERRUPTIONS
∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗/
54 extern fract16
extern fract16
sPPI_RxBuffer1 [ ] ;
extern fract16
sPPI_RxBuffer2 [ ] ;
56
extern fract16
TxBuffer [ 2 ] ;
extern fract16
AudioLeft ;
58 AudioRight ;
62 extern fract16
extern short
input [ ] ;
input_size ;
64
struct
struct
sDMA_descriptor {
66 ∗
volatile short ∗
sDMA_descriptor next_descriptor ;
start_address ;
68
typedef struct tDMA_descriptor
};
sDMA_descriptor ;
70
extern tDMA_descriptor DMA_RX_first ;
72
extern fir_state_fr16
extern fir_state_fr16
fir_structur_audio ;
74
extern fir_state_fr16
fir_structur_lowpass_I ;
extern fir_state_fr16
fir_structur_lowpass_Q ;
76
extern iirdf1_state_fr16
fir_structur_bandpass ;
iir_structur_audio ;
78
extern int
extern int
counter_sample ;
80
extern int
counter_in ;
counter_out ;
82
84 extern fract16
extern fract16
cosinus [ ] ;
fract16
sinus [ ] ;
86
fract16
cosinus_modif [ ] ;
extern char
sinus_modif [ ] ;
88 sinus_size ;
90
92
extern fract16
// P l o t s
extern fract16
signal_in1_plot [ ] ;
94
extern fract16
signal_lowpass_plot1 [ ] ;
extern fract16
signal_lowpass_plot2 [ ] ;
96
extern fract16
signal_bandpass_plot [ ] ;
extern fract16
signal_lowpass1filt_plot [ ] ;
98
extern fract16
signal_lowpass2filt_plot [ ] ;
extern fract16
signal_out_plot [ ] ;
100
extern fract16
signal_out_norm_plot [ ] ;
input_signal [ ] ;
102
104
#endif
A.3 Handling of interruptions
/∗ Init Interrupts . c : c o n f i g u r e s DMA i n t e r r u p t s and t h e i r routine
2 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗/
51
IF Digital Radio Based on Blackn Processor APPENDIX A. SOURCE CODE
4
#include " radioBF .h"
6
void InitInterrupts ( void )
8 { // configure interrupts
r e g i s t e r _ h a n d l e r ( ik_ivg8 , PPI_RX_Isr ) ;
12 // assign SPORT0 ISR to interrupt vector 9 (NB : IV8 has priority on IV9 )
r e g i s t e r _ h a n d l e r ( ik_ivg9 , Sport0_TX_ISR ) ;
∗ pSIC_IAR0 = 0 x f f f f f f f f ;
∗ pSIC_IAR2 = 0 x f f f f f f f f ;
20
}
22
24
EX_INTERRUPT_HANDLER( PPI_RX_Isr ) / / PPI DMA Interrupt Service Routine
26 {
32
/ / / / Code to store input s i g n a l ////////////////
34 / / i f ( Ping_Pong ) {
// A u d i o L e f t= sPPI_RxBuffer1 [ 0 ] ;
36 / ∗ if ( c o u n t e r _ s a m p l e <94) {
f o r ( i = 0 ; i <Number_of_Samples ; i ++){
40 c o u n t e r _ s a m p l e ++;
} ∗/
42 // }
// e l s e {
44 // A u d i o L e f t= sPPI_RxBuffer2 [ 0 ] ;
/ ∗ if ( c o u n t e r _ s a m p l e <94) {
46 f o r ( i = 0 ; i <Number_of_Samples ; i ++){
48 }
c o u n t e r _ s a m p l e ++;
50 } ∗/
// }
52 / ∗ if ( c o u n t e r _ s a m p l e <3008) {
i n p u t [ c o u n t e r _ s a m p l e ]= A u d i o L e f t ;
54 c o u n t e r _ s a m p l e ++;
} ∗/
56 // / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
Process_Data ( ) ;
60
EX_INTERRUPT_HANDLER( Sport0_TX_ISR ) / /SPORT0 DMA Interrupt Service Routine
62 {
52
A.4. DATA PROCESSING
64 ∗pDMA2_IRQ_STATUS = 0 x0001 ;
/ ∗ if ( c o u n t e r _ s a m p l e ==0){ A u d i o L e f t= 0 x0000 ; }
68 i f ( c o u n t e r _ s a m p l e ==1){ A u d i o L e f t= 0 x8000 ; }
i f ( c o u n t e r _ s a m p l e ==2){ A u d i o L e f t= 0 x0000 ; }
70 i f ( c o u n t e r _ s a m p l e ==3){ A u d i o L e f t= 0 x7fff ; }
c o u n t e r _ s a m p l e ++;
72 i f ( c o u n t e r _ s a m p l e ==4){ c o u n t e r _ s a m p l e =0; } ∗/
/ ∗
74 i f ( c o u n t e r _ s a m p l e ==0){ A u d i o L e f t= 0 x8000 ; }
i f ( c o u n t e r _ s a m p l e ==1){ A u d i o L e f t= 0 x7fff ; }
76 c o u n t e r _ s a m p l e ++;
i f ( c o u n t e r _ s a m p l e ==2){ c o u n t e r _ s a m p l e =0; } ∗/
78
/ / / / / Code to store output s i g n a l ////////////////////
80 //
82 s i g n a l _ o u t _ p l o t [ counter_out − 1300]= A u d i o R i g h t ;
} ∗/
84
// / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
86 TxBuffer [ 0 ] = AudioLeft ;
TxBuffer [ 1 ] = AudioRight ;
3 ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗/
#include " radioBF .h"
5
fract16
fract16
b u f f e r _ i n [ Number_of_Samples ] ;
7
fract16
b u f f e r I [ Number_of_Samples ] ;
fract16
b u f f e r Q [ Number_of_Samples ] ;
9
fract16
I [ Number_of_Samples ] ;
Q [ Number_of_Samples ] ;
11
fract16 signal_out , signal_out_f , signal_out_norm , signal_prec ;
13
15
short
void
k;
17 Process_Data ( )
19
short i ;
27
if
// Mixer /////////////////////////////////////////////
( Ping_Pong ) {
53
IF Digital Radio Based on Blackn Processor APPENDIX A. SOURCE CODE
fir_structur_bandpass ) ;
else
}
31 {
fir_structur_bandpass ) ;
33
for
}
( i = 0 ; i <Number_of_Samples ; i ++){
35 b u f f e r I [ i ]= m u l t _ f r 1 x 1 6 ( b u f f e r _ i n [ i ] , cosinus_modif [ i ] ) ;
b u f f e r Q [ i ]= m u l t _ f r 1 x 1 6 ( b u f f e r _ i n [ i ] , sinus_modif [ i ] ) ;
37 }
// c f i r _ f r 1 6 ( l o w p a s s , IQ , Number_of_Samples , &f i r _ s t r u c t u r _ l o w p a s s ) ;
f i r _ f r 1 6 ( bufferQ , Q, 32 , &f i r _ s t r u c t u r _ l o w p a s s _ Q ) ;
43
// Use these functions to filter and decimate the signal
45 // f i r _ d e c i m a _ f r 1 6 ( b u f f e r I , I , 32 , &f i r _ s t r u c t u r _ l o w p a s s _ I ) ;
// f i r _ d e c i m a _ f r 1 6 ( b u f f e r Q , Q, 32 , &f i r _ s t r u c t u r _ l o w p a s s _ Q ) ;
47
49 // Demodulation /////////////////////////////////////
Demodulation ( ) ;
51
/ / asm ( " nop ; " ) ;
53
A u d i o L e f t=s i g n a l _ o u t _ n o r m ;
55 A u d i o R i g h t=s i g n a l _ o u t _ n o r m ;
// Plots ////////////////////////////////////////////
57 / ∗ s i g n a l _ o u t _ p l o t [ k ]= s i g n a l _ o u t ;
s i g n a l _ o u t _ n o r m _ p l o t [ k ]= s i g n a l _ o u t _ n o r m ;
signal_lowpass_plot1 [ k ∗ Number_of_Samples+ i ]= b u f f e r I [ i ];
61 signal_lowpass_plot2 [ k ∗ Number_of_Samples+ i ]= b u f f e r Q [ i ];
s i g n a l _ l o w p a s s 1 f i l t _ p l o t [ k ∗ Number_of_Samples+ i ]= I [ i ] ;
63 s i g n a l _ l o w p a s s 2 f i l t _ p l o t [ k ∗ Number_of_Samples+ i ]=Q [ i ] ;
} ∗/
65 // }
67 }
69
73 / / d e l t a _ p h i=a n g l e ( x ( i +1) . c o n j ( x ( i ) ) ) ;
75 fract16 A, B ;
77 // precision )
A=a d d _ f r 1 x 1 6 ( m u l t _ f r 1 x 1 6 ( I [ 0 ] , I [ 1 ] ) , m u l t _ f r 1 x 1 6 (Q [ 0 ] , Q [ 1 ] ) ) ;
79 B=s u b _ f r 1 x 1 6 ( m u l t _ f r 1 x 1 6 ( I [ 0 ] , Q [ 1 ] ) , m u l t _ f r 1 x 1 6 ( I [ 1 ] , Q [ 0 ] ) ) ;
ix )
83
54
A.4. DATA PROCESSING
85 // Audio processing
/ / s i g n a l _ o u t _ n o r m=s i g n a l _ o u t ;
87
// Deemphasis
91 // Other filtering
93
}
55
IF Digital Radio Based on Blackn Processor APPENDIX A. SOURCE CODE
56
Appendix B
Theoretical results
B.1 Radio signal
B.1.1 Modulation
An audio signal can not be directly transmitted through the air over long distances. It has indeed a frequency
between 20 Hz and 20 kHz and the range would be very low with an electromagnetic medium. Moreover, if
another transmitter sends a second audio signal, the receiver will receive both signals without being able to
separate them.
To solve this problem, a high frequency electromagnetic wave that carries the audio signal is used. Therefore,
dierent audio signals can be sent using dierent carrier frequencies.
The carrier signal is a simple high frequency sinusoid: c(t) = cos(2πfc t) (fc is the carrier frequency).
The audio signal m(t) is modulated with the carrier signal to form the transmitted radio signal (bandpass
signal):
a(t) and φ(t) are parameters of m(t) (see section B.1.2 below).
B.1.2 AM and FM
Two kinds of modulation are used in analog auto radio communications: Amplitude Modulation (AM) and
Frequency Modulation (FM).
57
IF Digital Radio Based on Blackn Processor APPENDIX B. THEORETICAL RESULTS
AM modulation
The audio signal is modulated on the amplitude a(t) of the bandpass signal:
Hence,
s(t) = k (1 + m(t)) cos(2πfc t) (B.3)
For radio communications, AM signals use carrier frequencies between 150 kHz and 285 kHz with a bandwidth
of 4.5 kHz. Radio using AM modulation are transmitted with high power (1 to 2 MW).
δ(f − fc ) + δ(f + fc ) M (f − fc ) + M (f + fc )
S(f ) = k + (B.4)
2 2
FM modulation
The audio signal is modulated on the frequency f of the bandpass signal:
1 d
f = fc + (φ(t)) = fc + km(t) (B.5)
2π dt
Hence,
Z t
φ(t) = 2πk m(τ )dτ
0
and Z t
s(t) = S cos(2πfc t + 2πk m(τ )dτ ) (B.6)
0
Radios using FM, are carried by frequencies between 88 MHz and 108 MHz, and use a bandwidth around
155 kHz. The transmitted power is low (2 W).
S j2πfc t jK sin(2πfm t)
s(t) = e e + e−j2πfc t e−jK sin(2πfm t) (B.7)
2
ejK sin(2πfm t) is continuous and periodic with period 1/fm , thus expandable as a Fourier series:
∞ Z 2π
x=2πfm t X 1
ejK sin(2πfm t) = ejK sin(x) = Cn ejnx with Cn = ejK sin(x) e−jnx dx
n=−∞
2π 0
Z 2π Z 2π
1 1
Cn = cos (K sin (x) − nx)dx + j × sin (K sin (x) − nx) dx
2π 0 2π 0
Z 2π
1
cos (K sin (x) − nx) dx = Jn (K) with Jn the nth order Bessel function of the rst kind.
2π 0
Z 2π Z π Z 2π
1 1 1
and sin (K sin (x) − nx) dx = sin (K sin (x) − nx) dx + sin (K sin (x) − nx) dx
2π 0 2π 0 2π π
Z π Z 0
1 1
= sin (K sin (x) − nx) dx + sin (K sin (x) − nx) dx
2π 0 2π π
=0
58
B.2. EQUIVALENT LOWPASS OF THE BASEBAND SIGNAL
Hence,
Cn = Jn (K)
∞
X
jK sin(2πfm t)
thus e = Jn (K)ejn2πfm t
n=−∞
∞
X
and, with the same method, e−jK sin(2πfm t) = ejK sin(−2πfm t) = Jn (K)e−jn2πfm t
n=−∞
Hence
∞
S X
ej2πfc t Jn (K)ejn2πfm t + e−j2πfc t Jn (K)e−jn2πfm t
s(t) =
2 n=−∞
∞
X
=S Jn (K) cos (2π (fc + nfm ) t)
n=−∞
or s(t) = I(t) cos(2πfc t) − Q(t) sin(2πfc t) with I(t) = a(t) cos(φ(t)) and Q(t) = a(t) sin(φ(t)) (B.9)
A(t) is the equivalent lowpass of the modulated signal ; I(t) and Q(t) are called in-phase and quadrature
components of the modulated signal. It should be noted that
B.3 Demodulation
The goal of the demodulation is to extract the information from the bandpass signal. The rst step is to
extract the equivalent lowpass A(t).
59
IF Digital Radio Based on Blackn Processor APPENDIX B. THEORETICAL RESULTS
60
B.3. DEMODULATION
The lowpass lter must be such that for every eigen input signal x(t) = X sin(2πf t) the output of the lter
isy(t) = Y (f ) sin(2πf t + ϕ(f )) = Y (f ) sin (2πf (t − τ )) with τ a constant value independent of f . This leads
to ϕ(f ) = −2πf τ and the phase oset of the output signal is linear with the frequency. (All these relations are
true in discrete and continuous time-domain)
The transfer function of the lter is thus (in frequency domain) H(f ) = A(f )e−2πjτ f with A(f ) a real
function and τ a constant. Hence, the impulse response of the lter is h(t) = a(t) ∗ δ(t − τ ) (with ∗ the
convolution product). Since A(f ) is real, its time equivalent a(t) is an even function of time. Hence h(t) is such
that
Reciprocally, we consider a causal discrete FIR lter with symetrical coecients and time response h[n].
h[n] = a[n]∗δ[n−n0 ] with a[n] an even function (a[n] = a[−n])
If this lter is an even order lter, we can write
−2πjf n0
and 2n0 the order of the lter. Then the frequency response of the lter is H(f ) = A(f )e . Since a[n] is
even, A(f ) is real. If the input signal of this lter is a sinusoid of frequency f , the phase oset of the output is
ϕ(f ) = −2πf n0 (linear with the frequency) and the output has a constant time delay of n0 independent of f .
If the lter is an odd order lter, the Z-transform of the impulse response is:
k−1 k−1
2 2
k k
X X
H(ν) = bi e−2πjiν + e−2πj(k−i)ν = bi e−2πjν(i− 2 ) + e−2πjν( 2 −i) e−πjkν
i=0 i=0
k−1
2
X k
= 2bi cos 2π(i − )ν e−πjkν = A(ν)e−πjkν with A(ν) a real function
i=0
2
The phase oset of a sinusoidal output of frequencyf is thus ϕ(f ) = −πf k (linear with the frequency) and the
k
output has a constant time delay of independent of f .
2
Therefore, a FIR lter with symetrical coecients will produce a constant time delay, regardless of the
frequency of the input signal.
61
IF Digital Radio Based on Blackn Processor APPENDIX B. THEORETICAL RESULTS
AM
Here, the audio signal is modulated in the amplitude of A(t) and
p
m(t) = k 0 |A(t)| = I 2 (t) + Q2 (t) (B.11)
FM
The audio signal is modulated in the frequency of A(t). The phase of A(t) is therefore extracted and
dierentiated.
0 d
Q(t)
d
k dt arctan I(t) if I(t) > 0
m(t) = k 0 (arg A(t)) = (B.12)
dt k 0 d arctan Q(t) + π if I(t) < 0
dt I(t)
62
Appendix C
Front end SV IF digital front end generation 2. This module is already existing: no development on this part
is needed.
I/Q Modulation Full study of this part is needed. This block must provide the baseband I/Q signals to be
digitalized. The choice of the component for the prototype is free but must be as much integrated as
possible. Another option is rst to digitalize the IF signal and then generate the I/Q signals internally in
the DSP.
A/D converter In a rst step, an audio A/D can be used in order to work with a mono signal. The second
step will be a study of an A/D converter allowing to digitalize the complete signal (with stereo and RDS)
with the maximum performance.
63
IF Digital Radio Based on Blackn Processor APPENDIX C. MASTER THESIS PROPOSAL
Blackn This chip is a hybrid between a microcontroller and a DSP, allowing to generate control signals and
perform signal processing calculations in the same chip. First step will be done using a development board
(ADSP-BF533 EZ-KIT Lite). A second step may be to develop a dedicated board.
Framework The framework must provide the input/output function with control of the tuner module (I C
2
bus).
Selectivity ltering This block lters the I and Q signals to remove the adjacent channel. On a rst step,
the lter will be static but improvement can be made so this lter is dynamic to improve the adjacent
channel rejection when needed without decreasing the quality of the main channel.
Demodulation Demodulate the I and Q signals. This function must provide the AM and FM demodulation
and the basic information about the received signal (frequency oset and eld strength).
Stereo demodulation From the demodulated signal, this block detects the stereo pilot and demodulates the
stereo band.
RDS demodulation This extracts the RDS information from the demodulated signal. It must provide the
RDS clock and data. RDS decoding is not requested.
Phase diversity Build a second IF path using a second tuner module and antenna. From the two received
signals, the DSP builds a "clean" one using beam forming technique and a CMA algorithm.
64
C.4. EXPECTED RESULTS
the protocol for the transmission of the input datas on the data port, with regard to potential interferences
with the other components of the development board.
The second step is to weld the A/D converter on a printed circuit with its supply sources and surrounding
components and to connect it with the development board.
The third step is to build the software that will perform the demodulation of the signal. A rst version will
do a Talkthrough to test if the IF signal is received and handled accurately .
65
IF Digital Radio Based on Blackn Processor APPENDIX C. MASTER THESIS PROPOSAL
66
Bibliography
[1] Analog Devices. AD7655 Data Sheet. http://www.analog.com/UploadedFiles/Data_Sheets/
309183105AD7655_b.pdf.
[2] Analog Devices. AD8138 Data Sheet. http://www.analog.com/UploadedFiles/Data_Sheets/
67526251AD8138_e.pdf.
[3] AnalogDevices. ADSP-BF533 Blackn Processor Hardware Reference. http://www.analog.
com/processors/epManualsDisplay/0,2795,,00.html?SectionWeblawId=207&ContentID=
69184&Language=English.
[4] Analog Devices. ADSP-BF533 EZ-KIT Liter Evaluation System Manual. http://www.analog.com/
UploadedFiles/Associated_Docs/179226691ADSP_BF533_EZ_KIT_Lite_Manual_Rev_2.0.pdf.
[5] AnalogDevices. ADSP-BF53x/BF56x Blackn Processor Programming Reference. http://www.
analog.com/processors/epManualsDisplay/0,2795,,00.html?SectionWeblawId=207&ContentID=
67993&Language=English.
[6] Analog Devices. Blacknr specications. http://www.analog.com/UploadedFiles/Data_Sheets/
320040195ADSP_BF531_2_3_b.pdf.
[7] Analog Devices. EZ-Kit features. http://www.analog.com/UploadedFiles/Product_Highlights/
52029341983041ADSP_BF533_EZKIT__C__final.pdf.
[8] Analog Devices. Getting started with Blacknr processors. http://www.analog.com/UploadedFiles/
Associated_Docs/59930206865030blk_ug_40_web.pdf.
[9] Jacques Antoine, Jean-Luc Colette, Gilles Duc, Hervé Guéguen, and Daniel Poulton. Signaux et systèmes.
a
Supélec, 2002. (01218/.. 2002).
[10] Dominique Beauvois, Laurent Le Brusquet, Marie-Anne Lefebvre, and Yves Tanguy. Introduction aux
signaux et systèmes. a
Supélec, 2002. (01217/.. 2002).
[11] Jean-Claude Dany, Jean-Louis Gutwiller, Lionel Husson, Pierre Leray, and Armelle Wautier. Signal et
communication. a
Supélec, 2003. (11127/.. 2003).
67