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: Marcus Müller
Subject: Re: Sending a message to 'osmocom source' block does not work
Date: Fri, 4 Feb 2022 17:14:37 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0

Hi Kimmo,

as far as I know, the gr-osmosdr blocks don't have such a message port,
and a `git grep "[\"']command[\"']" does confirm that suspicion.

Best regards,
Marcus

On 04.02.22 16:00, Kimmo Lehtinen 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


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

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