discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: Sending a message to 'osmocom source' block does not work


From: Jeff Long
Subject: Re: Sending a message to 'osmocom source' block does not work
Date: Fri, 4 Feb 2022 11:13:05 -0500

From a quick look at the gr-osmosdr code, the GRC/YAML file advertises a "command" port, but the actual C++ code does not handle messages. You might want to ask about this on the osmocom list.

On Fri, Feb 4, 2022 at 10:13 AM Kimmo Lehtinen <kimmo.lehtinen@yahoo.fi> wrote:
Hi all,
                                                                               
I am trying to send a messsage from a Python block (of type gr.sync_block) to
'osmocom source', so that I can change the frequency of the receiver.

First, I have in the Python block the command

self.message_port_register_out(pmt.intern('msg_out'))

and then in the work-function of the Python block I give

self.freq = 80e6
key = pmt.intern("freq")
value = pmt.to_pmt(self.freq)
self.message_port_pub(pmt.intern('msg_out'), pmt.cons(key, value))

Then, if I connect the 'msg_out' port of the Python block to 'print' port of the
'Message debug' block, it prints

******* MESSAGE DEBUG PRINT ********
(freq . 8e+07)

But if I connect the 'msg_out' port to 'command' port of the 'osmocom source'
block, I get the following error:

--------
Could not find port: command in:

Traceback (most recent call last):
  File "/home/kimmo/Hydra-plain-fft/Hydra_options.py", line 718, in <module>
    main()

  File "/home/kimmo/Hydra-plain-fft/Hydra_options.py", line 696, in main
    tb = top_block_cls()

  File "/home/kimmo/Hydra-plain-fft/Hydra_options.py", line 410, in __init__
    self.msg_connect((self.epy_block_2, 'msg_out'), (self.osmosdr_source_0, 'command'))

  File "/usr/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 60, in wrapped
    func(self, src.to_basic_block(), srcport, dst.to_basic_block(), dstport)

  File "/usr/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 132, in msg_connect
    self.primitive_msg_connect(*args)

  File "/usr/lib/python3/dist-packages/gnuradio/gr/runtime_swig.py", line 4541, in primitive_msg_connect
    return _runtime_swig.top_block_sptr_primitive_msg_connect(self, *args)

RuntimeError: invalid msg port in connect() or disconnect()
--------


In the genereted Python file there are the following commands which are related to
message passing:

self.msg_connect((self.epy_block_2, 'msg_out'), (self.blocks_message_debug_0, 'print'))
self.msg_connect((self.epy_block_2, 'msg_out'), (self.osmosdr_source_0, 'command'))
                                                                               
I am using Gnuradio 3.8.1.0 (Python 3.8.10) in Ubuntu 20.04.3 LTS

cheers, Kimmo



reply via email to

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