# UCLA Zigbee PHY examples updated for UHD

**URL:** <https://www.ruby-forum.com/t/ucla-zigbee-phy-examples-updated-for-uhd/207292>\
**Category:** GNU Radio\
**Created:** [May 22, 2011, 11:06pm UTC](https://www.ruby-forum.com/t/ucla-zigbee-phy-examples-updated-for-uhd/207292 "2011-05-22T23:06:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [May 22, 2011, 11:06pm UTC](https://www.ruby-forum.com/t/ucla-zigbee-phy-examples-updated-for-uhd/207292/1 "2011-05-22T23:06:20Z")

</div>

Hello list!

I’ve updated (or at least tried updating) two of UCLA ZIGBEE PHY  
project’s examples to work with UHD - cc2420\_txtest.py and  
cc2420\_rxtest.py. I think the tx one works fine (spectrum analyzer says  
that we truly are transmitting at the given frequency), however the rx  
example isn’t receiving/decoding packages. Could someone take a look at  
the modifications to see what I’m doing wrong (maybe I am setting the  
frequencies/some other parameters wrong - does using  
self.u.set\_center\_freq function suffice, or should I somehow be tuning  
the frequency - if so, how?)?

It seems that the variable self.rcvd\_pktq is empty (line 258 in  
ieee802\_15\_4\_pkt.py):  
(part of the code where we fill up the “msg” variable):  
def run(self):  
while self.keep\_running:  
print “802\_15\_4\_pkt: waiting for packet”  
msg = self.rcvd\_pktq.delete\_head()  
ok = 0  
payload = msg.to\_string()  
print "received packet "

It confuses me why we aren’t receiving packets (especially since the  
cc2420\_channel\_test.py works fine).

This is the output of uhd\_cc2420\_rxtest.py (regardless whether I’m  
running the uhd\_cc2420\_txtest.py on the other machine or not):

kresimir@kresimir-U52F:~/ucla\_zigbee\_phy/src/examples$  
./uhd\_cc2420\_rxtest.py -c 2450000000 -r 100 -A TX/RX -g 20 -f rxtest.dat  
linux; GNU C++ version 4.4.5; Boost\_104200; UHD\_003.001.000-9f1e49e

Blocked waiting for GDB attach (pid = 5466)  
Press Enter to continue:  
cordic\_freq = 2.45G  
data\_rate = 100  
samples\_per\_symbol = 2  
fs = 200  
– Opening a USRP2/N-Series device…  
– Current recv frame size: 1472 bytes  
– Current send frame size: 1472 bytes  
– mboard0 is MIMO master  
Center frequency: 2450000000

> > > gr\_fir\_fff: using SSE  
> > > 802\_15\_4\_pkt: waiting for packet  
> > > Statistics: good 0 received 0

I’ve been using two USRP N210s (also tried on only one with TX/RX as  
transmitter and RX2 as receiver - same thing) for testing with  
gnuradio3.3.0 on Ubuntu 10.10

Links to files:  
[http://marvin.kset.org/~sunshine/uhd\_cc2420\_rxtest.py](http://marvin.kset.org/~sunshine/uhd_cc2420_rxtest.py)  
[http://marvin.kset.org/~sunshine/uhd\_cc2420\_txtest.py](http://marvin.kset.org/~sunshine/uhd_cc2420_txtest.py)

Regards,  
Kresimir

---

<div class="post-metadata">

**Author:** ![Kresimir\_Dabcevic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/6f9a4e/32.png) [@Kresimir\_Dabcevic](https://www.ruby-forum.com/u/Kresimir_Dabcevic)\
**Post date:** [May 23, 2011, 12:55am UTC](https://www.ruby-forum.com/t/ucla-zigbee-phy-examples-updated-for-uhd/207292/2 "2011-05-23T00:55:37Z")

</div>

> Blocked waiting for GDB attach (pid = 5466)  
> Press Enter to continue:  
> cordic\_freq = 2.45G

Not sure whats wrong, but, cordic\_freq should be the error in tuning the  
RF center freq, so only a few kHz really. That may be a good place to  
start looking.

-josh

---

<div class="post-metadata">

**Author:** ![Kresimir\_Dabcevic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/6f9a4e/32.png) [@Kresimir\_Dabcevic](https://www.ruby-forum.com/u/Kresimir_Dabcevic)\
**Post date:** [May 23, 2011, 12:04pm UTC](https://www.ruby-forum.com/t/ucla-zigbee-phy-examples-updated-for-uhd/207292/3 "2011-05-23T12:04:30Z")

</div>

Thanks for the reply Josh.

However, I’m confused by all the frequency setting/tuning functions at  
our disposition. In my example,  
1)I am setting cordic-freq (set by parser) while calling the main  
program, e.g. -c 2450000000 -that’s the frequency I want to set my USRP  
to.

2)output of  
self.u.set\_center\_freq(options.cordic\_freq, 0)  
print “Center frequency: %d” %(self.u.get\_center\_freq())  
is:  
Center frequency: 2450000000

3)output of  
uhd.tune\_request(options.cordic\_freq, 0)  
print “Center frequency: %d " %(self.u.get\_center\_freq())  
print (”%s") %(uhd.tune\_result())  
is:  
Center frequency: 2600000000  
Tune Result:  
Target RF Freq: 0.000000 (MHz)  
Actual RF Freq: 0.000000 (MHz)  
Target DSP Freq: 0.000000 (MHz)  
Actual DSP Freq: 0.000000 (MHz)

Why is uhd.tune\_request setting the center frequency to 2.6 instead of  
2.45 GHz?  
Also, am I calling the uhd.tune\_result function wrong - why are all the  
values 0?  
Furthermore, what is the difference between  
self.u.set\_center\_freq(options.cordic\_freq,0).actual\_rf\_freq and  
self.u.set\_center\_freq(options.cordic\_freq,0) functions?

Regards,  
Kresimir

---

<div class="post-metadata">

**Author:** ![Kresimir\_Dabcevic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/6f9a4e/32.png) [@Kresimir\_Dabcevic](https://www.ruby-forum.com/u/Kresimir_Dabcevic)\
**Post date:** [May 23, 2011, 4:44pm UTC](https://www.ruby-forum.com/t/ucla-zigbee-phy-examples-updated-for-uhd/207292/4 "2011-05-23T16:44:14Z")

</div>

update: turns out the problem was power squelch block - connecting  
self.u directly to self.packet\_receiver did the trick…

---

<div class="post-metadata">

**Author:** ![Kresimir\_Dabcevic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/6f9a4e/32.png) [@Kresimir\_Dabcevic](https://www.ruby-forum.com/u/Kresimir_Dabcevic)\
**Post date:** [May 23, 2011, 7:22pm UTC](https://www.ruby-forum.com/t/ucla-zigbee-phy-examples-updated-for-uhd/207292/5 "2011-05-23T19:22:01Z")

</div>

> However, I’m confused by all the frequency setting/tuning functions at our  
> disposition. In my example,  
> 1)I am setting cordic-freq (set by parser) while calling the main program, e.g.  
> -c 2450000000 -that’s the frequency I want to set my USRP to.

OK, I guess everything is fine. As a matter of terminology, calling it  
center freq might make more sense. The cordic frequency is the DSP  
frequency.

> Why is uhd.tune\_request setting the center frequency to 2.6 instead of 2.45 GHz?  
> Also, am I calling the uhd.tune\_result function wrong - why are all the values  
> 0?

You are making a new (empty tune result object). Not the one returned by  
the set center frequency.

> Furthermore, what is the difference between  
> self.u.set\_center\_freq(options.cordic\_freq,0).actual\_rf\_freq and  
> self.u.set\_center\_freq(options.cordic\_freq,0) functions?

Accessing a parameter vs not accessing a parameter?

-josh
