Explain polyphase filter and some README cleanups

master
SaucySoliton 2017-01-12 04:39:09 +00:00
rodzic 7abc86c4e4
commit 43b4eeb5d6
1 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -11,12 +11,10 @@ This version modulates the PLL instead of the clock divider for superior signal
![](doc/spectrum.png)
TODO list
*watchdog for PLL settings to prevent radio interference
*measure PLL loop filter response
watchdog for PLL settings to prevent radio interference
measure PLL loop filter response
It is based on the FM transmitter created by [Oliver Mattos and Oskar Weigl](http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter), and later adapted to using DMA by [Richard Hirst](https://github.com/richardghirst). Christophe Jacquet adapted it and added the RDS data generator and modulator. The transmitter uses the Raspberry Pi's PWM generator to produce VHF signals.
It is based on the FM transmitter created by [Oliver Mattos and Oskar Weigl](http://www.icrobotics.co.uk/wiki/index.php/Turning_the_Raspberry_Pi_Into_an_FM_Transmitter), and later adapted to using DMA by [Richard Hirst](https://github.com/richardghirst). Christophe Jacquet adapted it and added the RDS data generator and modulator. The transmitter uses the Raspberry Pi's clock divider to produce VHF signals.
It is compatible with both the Raspberry Pi 1 (the original one) and the Raspberry Pi 2 and 3. Users of Raspberry Pi 3 should add gpu_freq=250 to /boot/config.txt . The Pi 3 has very sensitive low voltage detection. When low voltage is detected, clocks are reduced to safe values in an attempt to prevent crashes. This program changes clocks to generate the desired radio frequency without the knowledge of the power management system. While it would be possible to detect and undo changes, this would cause radio interference each time it happens. Setting gpu_freq=250 appears to prevent undesired clock changes because the normal value and safe value are the same.
@ -159,7 +157,7 @@ Reception works perfectly with all the devices above. RDS Surveyor reports no gr
### CPU Usage
CPU usage is as follows:
CPU usage on a Raspberry Pi 1 is as follows:
* without audio: 9%
* with mono audio: 33%
@ -179,10 +177,12 @@ The shaped biphase symbol is generated once and for all by a Python program call
Internally, the program samples all signals at 228 kHz, four times the RDS subcarrier's 57 kHz.
The FM multiplex signal (baseband signal) is generated by `fm_mpx.c`. This file handles the upsampling of the input audio file to 228 kHz, and the generation of the multiplex: unmodulated left+right signal (limited to 15 kHz), possibly the stereo pilot at 19 kHz, possibly the left-right signal, amplitude-modulated on 38 kHz (suppressed carrier) and RDS signal from `rds.c`. Upsampling is performed using a zero-order hold followed by an FIR low-pass filter of order 60. The filter is a sampled sinc windowed by a Hamming window. The filter coefficients are generated at startup so that the filter cuts frequencies above the minimum of:
* the Nyquist frequency of the input audio file (half the sample rate) to avoid aliasing,
The FM multiplex signal (baseband signal) is generated by `fm_mpx.c`. This file handles the upsampling of the input audio file to 228 kHz, and the generation of the multiplex: unmodulated left+right signal (limited to 15 kHz), possibly the stereo pilot at 19 kHz, possibly the left-right signal, amplitude-modulated on 38 kHz (suppressed carrier) and RDS signal from `rds.c`. Upsampling is performed using a polyphase filter bank of 32 filters, each with 32 coefficients. To help understand the polyphase filter bank, consider upsampling the input signal by zero stuffing. Then, apply a low pass filter with the cutoff at the original Nyquist frequency. Finally, collect some of the filtered samples at the new sampling rate. The polyphase filter bank does the same thing mathematically, but avoids computing output samples that will not be used. It also avoids processing all of the suffed zeros. The low pass part of the filter is a sampled sinc. The filter is also used to provide pre-emphasis. The low pass filter coefficients are convolved with the pre-emphasis filter, providing pre-emphasis at no additional cost. The combined filter is windowed by a Hamming window. The filter coefficients are generated at startup so that the filter cuts frequencies above the minimum of:
* the Nyquist frequency of the input audio file (half the sample rate) to avoid aliasing (this is the typical case for resampling),
* 15 kHz, the bandpass of the left+right and left-right channels, as per the FM broadcasting standards.
An Octave script to compute the frequency response of the filter is provided in the doc folder.
The samples are played by `pi_fm_rds.c` that is adapted from Richard Hirst's [PiFmDma](https://github.com/richardghirst/PiBits/tree/master/PiFmDma). The program was changed to support a sample rate of precisely 228 kHz.