discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Updated TX path in UCLA_ZigBee_PHY


From: Sanna Leidelof
Subject: [Discuss-gnuradio] Updated TX path in UCLA_ZigBee_PHY
Date: Mon, 23 Feb 2009 14:08:22 +0100

Hi,

I've added a few changes to the IEEE 802.15.4 TX path in UCLA_ZigBee_PHY and now the code works with the current gr trunk (3.1.3). The code is tested using cc2420_txtest.py on one computer and cc2420_txtest.py on another computer. (Since the RX path already has been updated by Leslie Choong, as seen earlier in this thread, everything now works with the current gr release!)

The changes concerns ieee802_15_4.py, ieee802_15_4_pkt.py and cc2420_txtest.py, and are attached below. I appreciate comments!

Regards,
Sanna


Changes:
_______________________________________________________________
_______________________________________________________________
--- old_ieee/ieee802_15_4_pkt.py    2009-01-27 18:22:42.000000000 +0100
+++ new_ieee/ieee802_15_4_pkt.py    2009-02-23 10:51:53.000000000 +0100
 
     Send packets by calling send_pkt
     """
-    def __init__(self, msgq_limit=2, pad_for_usrp=True, *args, **kwargs):
+    def __init__(self, pad_for_usrp=True, *args, **kwargs):
         """
     Hierarchical block for the 802_15_4 O-QPSK  modulation.
 
@@ -157,15 +157,20 @@
 
         See 802_15_4_mod for remaining parameters
         """
+    try:
+        self.msgq_limit = kwargs.pop('msgq_limit')
+    except KeyError:
+        pass
+
     gr.hier_block2.__init__(self, "ieee802_15_4_mod_pkts",
                 gr.io_signature(0, 0, 0),  # Input
-                gr.io_signature(0, 0, 0))  # Output
+                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output
         self.pad_for_usrp = pad_for_usrp
 
         # accepts messages from the outside world
-        self.pkt_input = gr.message_source(gr.sizeof_char, msgq_limit)
+        self.pkt_input = gr.message_source(gr.sizeof_char, self.msgq_limit)
         self.ieee802_15_4_mod = ieee802_15_4.ieee802_15_4_mod(self, *args, **kwargs)
-        self.connect(self.pkt_input, self.ieee802_15_4_mod)
+        self.connect(self.pkt_input, self.ieee802_15_4_mod, self)
 
     def send_pkt(self, seqNr, addressInfo, payload='', eof=False):
         """

_______________________________________________________________
--- old_ieee/ieee802_15_4.py    2009-01-27 18:22:42.000000000 +0100
+++ new_ieee/ieee802_15_4.py    2009-02-23 10:51:21.000000000 +0100
 
 from gnuradio import gr, ucla
@@ -33,7 +33,7 @@
 
 class ieee802_15_4_mod(gr.hier_block2):
 
-    def __init__(self, spb = 2):
+    def __init__(self, *args, **kwargs):
         """
     Hierarchical block for cc1k FSK modulation.
 
@@ -43,13 +43,17 @@
     @param spb: samples per baud >= 2
     @type spb: integer
     """
+    try:
+        self.spb = kwargs.pop('spb')
+    except KeyError:
+        pass
+
     gr.hier_block2.__init__(self, "ieee802_15_4_mod",
-                gr.io_signature(0, 0, 0),  # Input
-                gr.io_signature(0, 0, 0))  # Output
+                gr.io_signature(1, 1, 1),  # Input
+                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output
 
-        if not isinstance(spb, int) or spb < 2:
-            raise TypeError, "sbp must be an integer >= 2"
-        self.spb = spb
+        if not isinstance(self.spb, int) or self.spb < 2:
+            raise TypeError, "spb must be an integer >= 2"
 
         self.symbolsToChips = ucla.symbols_to_chips_bi()
         self.chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST)
@@ -60,8 +64,8 @@
 
 
     # Connect
-    self.connect(self.symbolsToChips, self.chipsToSymbols,
-                   self.symbolsToConstellation, self.pskmod, self.delay)
+    self.connect(self, self.symbolsToChips, self.chipsToSymbols,
+                   self.symbolsToConstellation, self.pskmod, self.delay, self)
 
 class ieee802_15_4_demod(gr.hier_block2):
     def __init__(self, *args, **kwargs):


_______________________________________________________________
--- old_ieee/cc2420_txtest.py    2009-01-27 18:22:42.000000000 +0100
+++ new_ieee/cc2420_txtest.py    2009-02-23 10:56:52.000000000 +0100
  
 from gnuradio import gr, eng_notation
@@ -27,9 +27,9 @@
         return (1, 0)
     return (0, 0)
 
-class transmit_path(gr.flow_graph):
-    def __init__(self, options):
-        gr.flow_graph.__init__(self)
+class transmit_path(gr.top_block):
+    def __init__(self, options):
+        gr.top_block.__init__(self)
         self.normal_gain = 8000
 
         self.u = usrp.sink_c()
@@ -93,17 +93,17 @@
    
     (options, args) = parser.parse_args ()
 
-    fg = transmit_path(options)
-    fg.start()
+    tb = transmit_path(options)
+    tb.start()
    
     for i in range(10):
         print "send message %d:"%(i+1,)
-        fg.send_pkt(struct.pack('9B', 0x1, 0x80, 0x80, 0xff, 0xff, 0x10, 0x0, 0x20, 0x0))
+        tb.send_pkt(struct.pack('9B', 0x1, 0x80, 0x80, 0xff, 0xff, 0x10, 0x0, 0x20, 0x0))
         #this is an other example packet we could send.
-        #fg.send_pkt(struct.pack('BBBBBBBBBBBBBBBBBBBBBBBBBBB', 0x1, 0x8d, 0x8d, 0xff, 0xff, 0xbd, 0x0, 0x22, 0x12, 0xbd, 0x0, 0x1, 0x0, 0xff, 0xff, 0x8e, 0xff, 0xff, 0x0, 0x3, 0x3, 0xbd, 0x0, 0x1, 0x0, 0x0, 0x0))
+        #tb.send_pkt(struct.pack('BBBBBBBBBBBBBBBBBBBBBBBBBBB', 0x1, 0x8d, 0x8d, 0xff, 0xff, 0xbd, 0x0, 0x22, 0x12, 0xbd, 0x0, 0x1, 0x0, 0xff, 0xff, 0x8e, 0xff, 0xff, 0x0, 0x3, 0x3, 0xbd, 0x0, 0x1, 0x0, 0x0, 0x0))
         time.sleep(1)
                    
-    fg.wait()
+    tb.wait()
 
 if __name__ == '__main__':
     # insert this in your test code...

_______________________________________________________________
_______________________________________________________________




2009/2/18 Sanna Leidelof <address@hidden>
Thank you all! You've been a great help!

Please let me know if any of you would get the time to port the TX path as well. Until then, I'll see what I can do...

//Sanna


2009/2/17 Leslie Choong <address@hidden>
I have the code working with the current trunk and will hopefully be
updating the CGRAN repository soon. This is all on the RX path,
although the TX path will not be much harder to port....if I or
someone else has the time....
-Leslie

On Mon, Feb 16, 2009 at 9:17 AM, Thomas Schmid <address@hidden> wrote:
> Hi Sanna,
>
> Yes, the code has been updated, but it didn't just yet make it into
> CGRAN. For now, you can get the code from github:
>
> http://github.com/septikus/gnuradio-802.15.4-demodulation/tree/master
>
> Note that the code was ported by Leslie, who is also on this list.
>
> Cheers,
>
> Thomas
>
> On Mon, Feb 16, 2009 at 5:15 AM, Dimitris Symeonidis <address@hidden> wrote:
>> Here's a quick guide, provided by Firas to a similar question of mine:
>> http://lists.gnu.org/archive/html/discuss-gnuradio/2008-08/msg00222.html
>>
>> you might also want to talk with Leslie Choong:
>> http://lists.gnu.org/archive/html/discuss-gnuradio/2008-10/msg00463.html
>>
>>
>> Dimitris Symeonidis
>> "If you think you're too small to make a difference, try sleeping with
>> a mosquito!" - Amnesty International
>>
>>
>>
>> On Mon, Feb 16, 2009 at 13:55, Sanna Leidelof <address@hidden> wrote:
>>> Hi,
>>>
>>> Has anyone updated Thomas Schmid's UCLA_ZigBee_PHY project to work with
>>> top_block and hier_block2 in the current GNU Radio 3.1.3 release? I am in
>>> the beginning of my master's thesis and hoped that I could use Schmid's code
>>> to get started with my implementation of a IEEE 802.15.4 text message
>>> transceiver. I checked out the code from CGRAN:
>>> https://www.cgran.org/cgran/projects/ucla_zigbee_phy/trunk ucla_zigbee_phy ,
>>> but unfortunately this code is based on flow_graph and hier_block from the
>>> old trunk...
>>>
>>> If no such code exists, is there any guideline available to transform a
>>> project from using hier_block to hier_block2 and flow_graph to top_block? I
>>> am a newbie at GNU Radio, is this difficult?
>>>
>>> Regards,
>>> Sanna
>>>
>>> _______________________________________________
>>> Discuss-gnuradio mailing list
>>> address@hidden
>>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>>
>>>
>>
>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
>
>
> --
> "Don't complain; Just work harder" - Randy Pausch
>
> Thomas Schmid, Ph.D. Candidate
> Networked & Embedded Systems Laboratory (NESL)
> University of California, Los Angeles (UCLA)
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>


Attachment: ieee802_15_4.py
Description: Binary data

Attachment: ieee802_15_4_pkt.py
Description: Binary data

Attachment: cc2420_txtest.py
Description: Binary data


reply via email to

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