Hi Marcus, Thank you for your answer, I made a simple flowgraph to summarize my problem.
Here is also the backtrace of the segfault: #0 pmt::eqv_raw (x=x@entry=0x0, y=0x2529300) at /usr/local/src/gnuradio/gnuradio-runtime/lib/pmt/pmt.cc:1104 #1 0x00007f7f159065f6 in pmt::assv_raw (obj=0x0, alist=0x7f7ebc000930) at /usr/local/src/gnuradio/gnuradio-runtime/lib/pmt/pmt.cc:1235 #2 0x00007f7f15906683 in pmt::assv (obj=..., alist=...) at /usr/local/src/gnuradio/gnuradio-runtime/lib/pmt/pmt.cc:1248 #3 0x00007f7f15906700 in pmt::dict_has_key (dict=..., key=...) at /usr/local/src/gnuradio/gnuradio-runtime/lib/pmt/pmt.cc:937 #4 0x00007f7f0154f5db in gr::uhd::usrp_block_impl::msg_handler_command (this=0x256fcf8, msg=...) at /usr/local/src/gnuradio/gr-uhd/lib/usrp_block_impl.cc:501 #5 0x00007f7f01551ba2 in boost::_mfi::mf1<void, gr::uhd::usrp_block_impl, boost::intrusive_ptr<pmt::pmt_base> >::operator() (a1=..., p=0x256fcf8, this=0x261a1e0) at /usr/include/boost/bind/mem_fn_template.hpp:165 #6 boost::_bi::list2<boost::_bi::value<gr::uhd::usrp_block_impl*>, boost::arg<1> >::operator()<boost::_mfi::mf1<void, gr::uhd::usrp_block_impl, boost::intrusive_ptr<pmt::pmt_base> >, boost::_bi::list1<boost::intrusive_ptr<pmt::pmt_base>&> > (a=<synthetic pointer>, f=..., this=0x261a1f0) at /usr/include/boost/bind/bind.hpp:313 #7 boost::_bi::bind_t<void, boost::_mfi::mf1<void, gr::uhd::usrp_block_impl, boost::intrusive_ptr<pmt::pmt_base> >, boost::_bi::list2<boost::_bi::value<gr::uhd::usrp_block_impl*>, boost::arg<1> > >::operator()<boost::intrusive_ptr<pmt::pmt_base> > (a1=..., this=0x261a1e0) at /usr/include/boost/bind/bind_template.hpp:32 #8 boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, gr::uhd::usrp_block_impl, boost::intrusive_ptr<pmt::pmt_base> >, boost::_bi::list2<boost::_bi::value<gr::uhd::usrp_block_impl*>, boost::arg<1> > >, void, boost::intrusive_ptr<pmt::pmt_base> >::invoke (function_obj_ptr=..., a0=...) at /usr/include/boost/function/function_template.hpp:159 #9 0x00007f7f0155cac2 in boost::function1<void, boost::intrusive_ptr<pmt::pmt_base> >::operator() (a0=..., this=0x261a1d8) at /usr/include/boost/function/function_template.hpp:773 #10 gr::basic_block::dispatch_msg (this=<optimized out>, which_port=..., msg=...) at /usr/local/src/gnuradio/gnuradio-runtime/include/gnuradio/basic_block.h:134 #11 0x00007f7f15beffd3 in gr::tpb_thread_body::tpb_thread_body (this=0x7f7ecb7fddc0, block=..., start_sync=..., max_noutput_items=<optimized out>) at /usr/local/src/gnuradio/gnuradio-runtime/lib/tpb_thread_body.cc:107 ---Type <return> to continue, or q <return> to quit--- #12 0x00007f7f15bde434 in gr::tpb_container::operator() (this=0x26c6990) at /usr/local/src/gnuradio/gnuradio-runtime/lib/scheduler_tpb.cc:46 #13 gr::thread::thread_body_wrapper<gr::tpb_container>::operator() (this=0x26c6990) at /usr/local/src/gnuradio/gnuradio-runtime/include/gnuradio/thread/thread_body_wrapper.h:51 #14 boost::detail::function::void_function_obj_invoker0<gr::thread::thread_body_wrapper<gr::tpb_container>, void>::invoke (function_obj_ptr=...) at /usr/include/boost/function/function_template.hpp:159 #15 0x00007f7f15b7bfa0 in boost::function0<void>::operator() (this=<optimized out>) at /usr/include/boost/function/function_template.hpp:773 #16 boost::detail::thread_data<boost::function0<void> >::run (this=<optimized out>) at /usr/include/boost/thread/detail/thread.hpp:116 #17 0x00007f7f149605d5 in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0 #18 0x00007f7f186486ba in start_thread (arg=0x7f7ecb7fe700) at pthread_create.c:333 #19 0x00007f7f1837e41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109 As I can see the problem is when reading my dict, but it seems to be right. Again here is what I sent to the usrp command message: pmt::pmt_t command = pmt::make_dict(); command = pmt::dict_add(command, pmt::mp("gain"), pmt::mp(gain)); // Specify gain ommand = pmt::dict_add(command, pmt::mp("antenna"), pmt::mp("TX/RX")); // Switch antenna command = pmt::dict_add(command, pmt::mp("chan"), pmt::mp(0)); // Specify channel message_port_pub(pmt::mp("cmd") , command); Thank for your help! De : Marcus Müller Envoyé le :Wednesday, December 5, 2018 11:30 À : samuel verdon; usrp-users@lists.ettus.com Objet :Re: [USRP-users] Segmentation fault commands to USRP with gnuradio Hi Samuel, luckily, these days, segfaults are rather rare in stock GNU Radio, and UHD. Can you share your exact flowgraph, or a GDB-generated backtrace, with us? Best regards, Marcus On Wed, 2018-12-05 at 10:31 +0100, samuel verdon via USRP-users wrote: > Hello, > > I’m trying to command my usrp B200mini via its command port. I used > the documentation from here: > https://www.gnuradio.org/doc/doxygen/page_uhd.html > > here is my command: > pmt::pmt_t command = pmt::make_dict(); > command = pmt::dict_add(command, pmt::mp("gain"), > pmt::mp(gain)); // Specify gain > command = pmt::dict_add(command, pmt::mp("antenna"), > pmt::mp("TX/RX")); // Switch antenna > command = pmt::dict_add(command, pmt::mp("chan"), > pmt::mp(0)); // Specify channel > message_port_pub(pmt::mp("cmd") , command); > > I connect my block to a debug message block, and I received this > > ************MESSAGE DEBUG PRINT*************** > ((chan. 0) (antenna, TX/RX) (gain, 63)) > > But when I connect to the “UHD: USRP sink” I get a segmentation > fault… ☹ > I have tried different command always the same problem. > Can someone show me an example working with tis command? > I am quite deseparate.. > > Ubuntu 16.04 > Gnuradio 3.7.12 > UHD driver UHD_3.11 > > Thank you for your help > > _______________________________________________ > USRP-users mailing list > USRP-users@lists.ettus.com > http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com