Timing Estimation for PSK modems

Jim, KG4SGP just sent me an email asking about how timing recovery (timing estimation) works in the FDMDV modem. In fdmdv.c, this is performed by the rx_est_timing() function.

At the receiver, we need to “sample” the PSK modem signal at just the right time. A timing estimator looks at the received signal and works out the best time to sample. Timing estimation is a major part of a PSK demodulator. if you get the timing estimate wrong, the scatter diagram looks worse and you get more bit errors.

The basic idea is we pass the modem signal through a non-linearity. The non-linearity could be the absolute function (i.e. a rectifier), a square law, or in analog-land a diode. This strips the phase information from the signal leaving the amplitude (envelope of the original signal) bobbing up and down at the symbol rate. Turns out that the phase of this envelope signal is related to the timing offset of the PSK signal. The phase can be extracted using a single point Discrete Fourier Transform (DFT).

Here’s an example using some high school trig functions. Consider a simple BPSK signal that consists of alternating symbols ….,-1,+1,-1,+1….. Once filtered, this will look something like a sine wave at half the symbol rate, r(t)=cos(Rs(t-T)/2), where T is the timing offset, and Rs is the symbol rate. So if Rs=50 symbols/s (50 baud), r(t) would be a sine wave at 25 Hz, with some time offset T.

If we square r(t) we get s(t)=r(t)*r(t) = 0.5 + 0.5*cos(Rs(t-T)), using the trig identify cosacosb=(cos(a-b)+cos(a+b))/2. The second term of s(t) is a sine wave of frequency Rs, with phase = RsT. So if we perform a single point DFT at frequency Rs on s(t), the phase will be related to the timing offset.

That’s pretty much what happens in rx_est_timing(). We use the parallel QPSK signals, and a nice long window of modem samples to get a good estimate in the presence of noise and frequency selective fading.

SM1000 Part 5 – Mysterious Triangle Waves

Getting close to Beta now.

I have just spent a week tracking down a mysterious 256 Hz low level (30mVpp) tone that ended up being a software configuration error in the DAC initialisation code! However before that I thought it was a noise issue caused by PCB layout, or the wrong sort of bypass capacitor. . . . → Read More: SM1000 Part 5 – Mysterious Triangle Waves

SM1000 Part 4 – Killing a PCB and PTT Working

Last Sunday the ADC1 net on the first SM1000 prototype went open circuit all of a sudden. After messing about for a few hours I lifted the uC pin for that net and soldered a fine wire to the other end of the net. That lasted a few days then fell off. I . . . → Read More: SM1000 Part 4 – Killing a PCB and PTT Working

Do Anti-Depressants work?

In the middle of 2013 I had a nasty bout of depression and was prescribed anti-depressant drugs. Although undiagnosed, I think I may have suffered low level depression for a few years, but had avoided anti-depressants and indeed other treatment for a couple of reasons:

I am a man, and men are bad at looking after their . . . → Read More: Do Anti-Depressants work?

SM1000 Part 3 – Rx Working

After an hour of messing about it turns out a bad solder joint meant U6 wasn’t connected to the ADC1 pin on the STM32F4 (schematic). This was probably the source of “noise” in some of my earlier unit tests. I found it useful to write a program to connect the ADC1 input to the . . . → Read More: SM1000 Part 3 – Rx Working

SM1000 Part 2 – Embedded FreeDV Tx Working

Just now I fired up the full, embedded FreeDV “tx side”. So speech is sampled from the SM1000 microphone, processed by the Codec 2 encoder, then sent to the FDMDV modulator, then out of the DAC as modem tones. It worked, and used only about 25% of the STM32F4 CPU! A laptop running . . . → Read More: SM1000 Part 2 – Embedded FreeDV Tx Working

Embedded FreeDV

For the SM1000 development I need a way to embed the core functionality of a FreeDV “mode” in a simple library. A FreeDV “mode” is defined by the Codec 2 rate, the FEC, the frame structure, and the FDMDV modem waveform. Several modes have evolved over the past 18 months, and more are likely . . . → Read More: Embedded FreeDV

SmartMic SM1000 Part 1

So the parts and PCB arrived from the SM1000 last week, and yesterday I started loading. I use a stereo microscope and hand solder each part. It’s actually fun, a nice change from software.

Here is the current (Rev B1) SM1000 schematic if you would like to follow along.

First I assembled the 5V switching supply, . . . → Read More: SmartMic SM1000 Part 1

Democratising HF Radio Part 1

I recently submitted a Shuttleworth Fellowship grant application. I had planned to use the funding to employ people and accelerate the roll out of the project described below. I just heard that my application was unsuccessful (they wanted something more experimental). Never mind, the ideas lives on!

I’m exploring some novel ideas for messaging over . . . → Read More: Democratising HF Radio Part 1

Reducing FDMDV Modem Memory

For the SM1000 (SmartMic) project I need to run the FDMDV HF modem on the STM32F4 micro-controller. However The STM32F4 only has 192k of internal RAM, and the modem in it’s original form uses over 400k. I wrote a unit test to break down the memory usage:

david@bear:~/tmp/codec2-dev/build_dir$ ./unittest/fdmdv_mem
struct FDMDV.......…: 409192
prev_tx_symbols....…: 168
tx_filter_memory......: 1008
phase_tx..........….: 168
freq..................: . . . → Read More: Reducing FDMDV Modem Memory