GPIO pin integration to osmosdr in gnuradio via argument

samuel verdon sam.verdon at gmail.com
Mon Jul 17 08:30:57 UTC 2017


Hello,
I’m trying to switch the state of the pin J2_3 of my xb100 through the argument line of the osmosdr block in gnuradio.

To do this, I added this code to the file bladerf_common.cc
1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  /* Support of the XB100 to control pin J2_3 through the argument line*/
  if ( dict.count("xb100") ) {
    if (bladerf_expansion_attach(_dev.get(), BLADERF_XB_100)) {
      std::cout << "Could not attach XB-100" << std::endl;
    } else {
      _xb_100_attached = true;
      std::cout << "Expension XB-100 attached" << std::endl;
      
      if ( bladerf_expansion_gpio_dir_masked_write(_dev.get(),BLADERF_XB100_PIN_J2_3,  1)) {
        std::cout<< "Could not set TRX pin direction" << std::endl;
      }

      std::cout << "J2_3 output direction selected" << std::endl;
      if ( dict["xb100"] == "TX" ) {
        if(bladerf_expansion_gpio_masked_write (_dev.get(),BLADERF_XB100_PIN_J2_3, BLADERF_XB100_PIN_J2_3)){
          std::cout<< "sorry, but I cannot set pin to 1" << std::endl;}
      }

      else if(dict["xb100"] == "RX" ) {
        if(bladerf_expansion_gpio_masked_write (_dev.get(),BLADERF_XB100_PIN_J2_3, 0)){
          std::cout<< "sorry, but I cannot set pin to 1" << std::endl;}
      } else {
        std::cout<< "Wrong parameter specified, should be TX or RX" << std::endl;}
    }
  }
In my osmosdr bloc, I added this argument “ xb100=tx”  but I don’t have my 5V on my pin :(
I don’t understand why the pin is not setted when I start my flowgraph… Could you help me please?

Thank you

Samuel Verdon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/osmocom-sdr/attachments/20170717/ff75f803/attachment.html>


More information about the osmocom-sdr mailing list