w1hkj / fldigi

Amateur Radio digital modem application [SF mirror]
http://www.w1hkj.com
GNU General Public License v3.0
108 stars 27 forks source link

navtex: fix and simplify timing recovery logic #34

Open rikvanriel opened 1 year ago

rikvanriel commented 1 year ago

navtex: fix and simplify timing recovery logic

The timing recovery logic was changed to an early / late detector a few years ago in order to make it less sensitive to null crossings, which are easily thrown off by the fact that mark and space have their own low pass filters, and the discriminator calculating the envelope for each separately.

The discriminator output can have mark deviate further from zero than space, or the other way around, which can shift the null crossings around in unpredictable ways.

Finding the actual peaks in the discriminator output itself appears to be a little more predictable. It allows us to get rid of the accumulator logic, and expand the loop bandwidth so we can now track the example NAVTEX signal from https://www.sigidwiki.com/wiki/NAVTEX, which runs about .25% fast, which can be seen from a consistent adjustment of around -2 samples every 8 bit periods.

The resulting code can still decode signals from the USGS (Honolulu), Canada (Moise and Chebogue), and Buenos Aires, all of which are much lower S/N but closer to the nominal baud rate than the example signal.

Signed-off-by: Rik van Riel riel@surriel.com