Python/digital examples and UHD

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,

over the weekend I spend some time trying to update the demos to work
with the UHD, I just started playing with git, so if you see something
stupid let me know :wink:

I put what I got on (in the uhd-examples branch):

[email protected]:mfischer/gnuradio-mfischer.git

However the part where it ‘automagically’ picks rx/tx bitrates is not
really working as I have no idea how to detect what device I’m talking
to. Also please note that as I don’t have the right values for bitrates
and samples_per_symbol don’t be surprised if the examples crash :wink:

The old generic_usrp.py had ranges for the possible decimation /
interpolation factors as we don’t have this in UHD I’m a bit confused on
how to continue.

I started to add a function

samp_rate_range_t get_rx_samp_rate_range()

to UHDs single_usrp_sink / multi_usrp_sink which internally would ask
the corresponding _dev for the right ranges, depending on what device
you’re talking to. I still have to figure out the ranges part though.

[email protected]:mfischer/uhd-mfischer.git

As I don’t really have insight into the longtime plan for UHD,
I’m not sure whether that’s the way to go though…

Can someone give me any hints whether this actually makes sense?

Happy hacking,

  • -Moritz
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJM82xBAAoJEOjnDXL6I0uZ4icQAJt3+Z82fs2LGRZ+4ndKVat0
DMPzRW1EN3T4EKIyAY9N4/weLwXvT5vuyKc+2i/mlPzhjS+ssJKfsnbLJNfNgK0Q
Notdvyv1ItNZtrD2/l5MpM/dyR0dwVpLJnmF6jrH0zOX0yiBdah80/YAz5ISrxtm
nKNmo0DJ/hZqWPQkklYbMrDirdLACPTzRwqh+JVJHBOOiVnoyXbmxakY2Ta1Ea+d
4BpOOV4h5daGQeC+9BKODY/aNtkemCvHBZdC3FQA/8IxnoRnJWTohT4Dyxc+Ypgo
AKOaYUGk1uPuJ1JrCP1883umBBm5Pf4x4Obe0yJ8s3RXWuWB80f40Kx/Qbc4CXnG
e3rXN50E4lF76JZm4bJqzlextQ28bXRVkeCM+AeaM/nTECRHaY2QhQhAWCA2iFCC
/amJjdQpm8fiDk1gx1hpXWeQk2eyvx3Uy4Oe9L5JgiVMFBD+4yvwqIqGcRwIxo/i
ladOfOTiJ9d0tcYXZ9Injg4QDAtHwtmFO8nF8WVnzvPlPHiGQaOwpgtJu7aPJRt/
+96HR/lT7VFCGmawJbsig4jbXgSQ0oxsRkJ6A+IxjCDN56wtABiyIdbu0575BU7w
I/SjuIZ6xe9H+NFs/ZYmb5ImMiZFq2fV3Tn3ljZJrcaf1IMRQ+a2yoSgo4In5O7C
+7H/Ru9tHCRR5J52m587
=AHQt
-----END PGP SIGNATURE-----

On Mon, Nov 29, 2010 at 4:02 AM, Moritz Fischer
[email protected] wrote:

As I don’t really have insight into the longtime plan for UHD,
I’m not sure whether that’s the way to go though…

Can someone give me any hints whether this actually makes sense?

Happy hacking,

  • -Moritz

Thanks, Moritz. I’ll try to take a look at this sometime.

Have you used the version 2 digital code, yet (benchmark_tx2,
benchmark_rx2, usrp_receive_path2, etc.)? One of the things I did was
include better resampling so that you can get any bit rate you want.
You still have to go through the process of selecting the USRP’s
sample rate that’s closest to your desired rate, and then the
resampling takes care of the rest.

What I do with the UHD driver is ask for a sample rate. It will then
set its sample rate to whatever the closest rate it can do. You can
the read back the actual sample rate of the USRP with get_samp_rate().
I then use this value to determine the difference between my desired
sample rate and the actual sample rate, which I then plug into the
arbitrary resampler.

Tom

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/29/2010 03:47 PM, Tom R. wrote:

Thanks for your reply Tom,

Have you used the version 2 digital code, yet (benchmark_tx2,
benchmark_rx2, usrp_receive_path2, etc.)? One of the things I did was
include better resampling so that you can get any bit rate you want.
You still have to go through the process of selecting the USRP’s
sample rate that’s closest to your desired rate, and then the
resampling takes care of the rest.

Well in fact that’s what I was looking at. I called this the
‘automagical’ frequency selection in my last mail :wink:

It appears to me you do this by trying all the tuples of (bitrate,
samples_per_symbol,…) and select the one fitting ‘best’.

So please don’t throw stones at me for asking this question, but from my
understanding the required

desired_samplerate = bitrate x samples_per_symbol / bits_per_symbol (1)

What I do with the UHD driver is ask for a sample rate. It will then
set its sample rate to whatever the closest rate it can do. You can
the read back the actual sample rate of the USRP with get_samp_rate().
I then use this value to determine the difference between my desired
sample rate and the actual sample rate, which I then plug into the
arbitrary resampler.

So what you suggest is basically:

  1. set_samp_rate(desired_samplerate) as in (1)

  2. tmp = get_samp_rate()

  3. and then resample in gnuradio according to tmp / desired_samplerate

or did I get something wrong?

Please don’t get me wrong because I ask a lot of questions :slight_smile:
I don’t ask you guys to do any of my work (like a thesis or the likes).
Just in my opinion having the examples working is really important,
because that’s where new people start to look at when trying to figure
out how stuff works.
And nothing is more frustrating than not even managing to get the
examples running.

Best regards and happy hacking,

Moritz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJM9L5tAAoJEOjnDXL6I0uZtNwP/1JDIggYhvBRw6bJQmQzUjKU
mDKrYyqIdFbLDv0+aC62gTn0g+OVpa11yP585pZcF9tZ5A9ZwIqSEpo6iEPXH883
q6+A3GmogTAqtaydf7seG3PkdV/HXZcAkBRtd0QgjMykKbIOG2hlDTJZsv8Ru0Iz
/dOa6ERrxHQSrYY1DLW/e5dMrwBp8SMGdIT3RlwpuKvQyZmA9xj8rcqxNyvfHuNf
3KT5AFCQQbKrmGXiwb9z+09rFTHWga4hdLbfkX+L4ANz/j2eUDxomLgSVcx1vOEb
0Qqn1MJu2vBRceIdyiAItl3gnocWZ62EQMnvIcoDY9F7Mi9sBCWVV18CWVwPv2SU
P+4o5wRvpV5b7nVn6U0Yi47w0/Wfz5UsYbiGMc/scrpSa0wHuYv7BXsjlOOANrmd
RAYz0Xvk6aIq4P4RuuqeIx1AWfw0tLcQaO7BAAvanZqf6qf+HqP+oMmCQZgWzlhL
hgDuL/7YdpUN66c8xSXivCfFZpf/FOkoKMhF1N7BQ1EM349BrgbPdL3VO0I/jEs/
f7nsMML7FkhJdOF5IH/1QgEl+fGGMNvEmqBqfm3w/pYtUkwX4KDnc6GrHimYrk72
QnFuv2ZWURnyNsvp7pYnH27Bu7ssyYa6DZP+Iu047Ev7iK0oMuqaQaWxDibSSL4c
vMqE5g//R0SsNBcTtiZe
=x5g+
-----END PGP SIGNATURE-----

On Tue, Nov 30, 2010 at 4:05 AM, Moritz Fischer
[email protected] wrote:

You still have to go through the process of selecting the USRP’s
understanding the required

desired_samplerate = bitrate x samples_per_symbol / bits_per_symbol (1)

Yep: (bits/sec) x (samps/sym) / (bits/sym) = samps/sec

  1. tmp = get_samp_rate()

  2. and then resample in gnuradio according to tmp / desired_samplerate

or did I get something wrong?

Nope, that’s what I’ve done. Works great.

Eventually, it’d be great to put the arbitrary resampler into the
USRP. It should be easy to fit this into the N210’s FPGA. But for just
use the pfb_arb_resampler_ccf block. You’ll need to build a set of
filter taps for it, which you can find out how to do this in
gnuradio-examples/python/pfb/interpolate.py.

Tom