discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] usrp_fft.py questions


From: Anastasopoulos Achilleas
Subject: Re: [Discuss-gnuradio] usrp_fft.py questions
Date: Wed, 20 Apr 2005 17:38:51 -0400 (EDT)

Dear all,

I guess I should have spent more time experimenting and
studying the examples before asking these questions.
In any case, I have resolved both issues:

As it turns out the ADC's (I guess due to some
hardware mismathces etc) may add a DC term at the output.
This offset can be eliminated easily by adding some
more code in the python script.
The example "tweak_adc_offset.py" can help with this:
so what I did is I left the RX-A and RX-B open and run
tweak_adc_offset.py
The oscope showed the DC values for channels A and B
which have to be compensated. In my case was 322 and 180
for channels A and B, respectively.
Then I run
tweak_adc_offset.py -0 322 -1 180 and the oscope
verified an almost 0 offset for both of the channels.

I added the piece of code in both usrp_fft.py and usrp_oscope.py
to be able to compensate for this offset in all these programs:

parser.add_option ("-0", "--adc-offset-0", type="int", default=0,
                           help="set adc offset to OFFSET",
metavar="OFFSET")
        parser.add_option ("-1", "--adc-offset-1", type="int", default=0,
                           help="set adc offset to OFFSET",
metavar="OFFSET")
        parser.add_option ("-2", "--adc-offset-2", type="int", default=0,
                           help="set adc offset to OFFSET",
metavar="OFFSET")
        parser.add_option ("-3", "--adc-offset-3", type="int", default=0,
                           help="set adc offset to OFFSET",
metavar="OFFSET")

where the parsing of arguments is taking place and
the following piece of code

        # I added this to correct for the DC offset
        # Experiments: it seems that 322 and 180 works for my USRP
        FR_ADC_OFFSET_3_2 = 2   # hi 16: ADC3, lo 16: ADC2
        FR_ADC_OFFSET_1_0 = 3
        self.u._write_fpga_reg (FR_ADC_OFFSET_1_0, ((options.adc_offset_1
& 0xffff) << 16) | (options.adc_offset_0 & 0xffff))
        self.u._write_fpga_reg (FR_ADC_OFFSET_3_2, ((options.adc_offset_3
& 0xffff) << 16) | (options.adc_offset_2 & 0xffff))

right after the definition of the usrp source.

I attach the corrected script usrp_fft.py and usrp_oscope.py

It wouldn't be hard to add a piece of code in all usrp-related
scripts that compensates for the DC offset automatically at the
beginning of the program.
All is needed is to measure the average DC term and use some sort of
AGC (I think it is already implemented in gnuradio) to drive the DC offset
close to 0. I might take a crack at it later, but now I am satisfied
with the manual way of compensation.

Best
Achilleas

Attachment: usrp_fft.py
Description: Text document

Attachment: usrp_oscope.py
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]