Updated TX path in UCLA_ZigBee_PHY


#1

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 L. removed_email_address@domain.invalid