ATSC decoder example in GR 3.7.1

As a part of my quest to understand some of the examples in GR (and
eventually contribute some well-commented GRC examples of my own),
I’ve been messing around with the atsc_rx.py script. Unfortunately,
since I have a USRP2, I can’t sample at 6.4Msps like the script wants.
Instead, I tried sampling a strong local TV station at 10Msps and
resampling at 6.4Msps, but the result is a ton of errors in the
script’s output and a large TS file that I can’t make sense of.

I tried the following steps. First, capture a few seconds of raw TV
signal (channel 39 in my area is the physical frequency of WSB):

uhd_rx_cfile -f 623M --samp-rate=10M -s wsb.iq

In a local copy of atsc_rx.py, I added the following filter:

resamp = filter.fractional_resampler_cc(0, 10/6.4)

Then I added the resampler to the graph at the bottom of the script:

tb.connect( srcf, is2c, resamp, rrc, ilp, duc, c2f, fpll, lp_filter)

Finally I ran the script:

./atsc_rx.py wsb.iq wsb.ts

The console fills with errors related to the ATSC stream:

8404
Using Volk machine: avx_64_mmx_orc
Setting initial_freq: 3065000.000000
atsc_field_sync_demux: synced (FIELD-1) at 426209 [delta = 426209]
atsc_viterbi_decoder: new starting offset = 0
atsc_field_sync_demux: lost sync at 464481
!!! atsci_equalizer: expected field sync, didn’t find one
atsc_field_sync_demux: segment number overflow
atsc_viterbi_decoder: new starting offset = 7
!!! atsci_equalizer: expected field sync, didn’t find one
atsc_field_sync_demux: segment number overflow
atsc_field_sync_demux: lost sync at 1225761
atsc_viterbi_decoder: new starting offset = 1…

(and so on, many times over)

I tried playing the output TS in vlc and reading it with avconv, but
both programs found tons of errors with the file and couldn’t do
anything useful with it. For the record, with some tweaking of the Tx
settings, I was able to transmit the captured IQ file over the air and
play the clip on a nearby TV (on a different, unused channel), so I
know the data is in there somewhere.

My eventual goal is to turn this script into a GRC version, complete
with GRC xml files for the ATSC blocks currently included in GR.
However, I can’t begin this process without having it working in the
first place. Is there anyone out there who understands the current
script and can modify it to work with an adjustable input sample rate?
That would go a long way toward helping me understand it all. Thanks
in advance.

Ethan T (courtarro)

On Tue, Oct 15, 2013 at 10:01 PM, Ethan Trewhitt
[email protected] wrote:

As a part of my quest to understand some of the examples in GR (and
eventually contribute some well-commented GRC examples of my own),
I’ve been messing around with the atsc_rx.py script. Unfortunately,
since I have a USRP2, I can’t sample at 6.4Msps like the script wants.
Instead, I tried sampling a strong local TV station at 10Msps and
resampling at 6.4Msps, but the result is a ton of errors in the
script’s output and a large TS file that I can’t make sense of.

Hi Ethan,

I just wanted to point out that we’ve been working with Andrew D.
on fixing up ATSC to a) work better and b) work with 3.7. He’s made a
good start on things here:

https://github.com/glneo/gnuradio/tree/atscfixup

There’s still work to be done, and Johnathan and I have been talking
about how to best get this into GNU Radio. If you’re pursuing this
project, definitely look here and maybe talk directly with Andrew.
He’s apparently gotten pretty busy with school work this semester, so
having another person working on this might be really good to finish
it up.

Thanks,
Tom